int main(int argc, char **argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); screen_width = framebuffer_width * zoomed_pixel_size; screen_height = framebuffer_height * zoomed_pixel_size; glutInitWindowSize(screen_width, screen_height); glutInitWindowPosition(20, 20); glutCreateWindow("Triangle rasterization"); glutDisplayFunc(&DrawScene); glutIdleFunc(&DrawScene); //glutReshapeFunc(&ReSizeScene); //glutSpecialFunc(&specialKeyPressed); glutKeyboardFunc(&KeyPressed); //glutMouseFunc(&mouseFunc); //glutMotionFunc(&motionFunc); InitOpenGL(); glutMainLoop(); return 1; }
// CreateWnd: creates a full screen window to span the projectors void CreateWnd(HINSTANCE &hinst, int width, int height, int depth) { // Find the middle projector POINT pt; pt.x = -SCRWIDTH; pt.y = 100; HMONITOR hmon; // monitor handles hmon = MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST); MONITORINFO mi; mi.cbSize = sizeof(MONITORINFO); GetMonitorInfo(hmon, &mi); // Set the window position based on the projector locations int posx1 = mi.rcMonitor.left; int posy1 = mi.rcMonitor.top; // Constants for fullscreen mode long wndStyle = WS_POPUP | WS_VISIBLE; // create the window hwnd1 = CreateWindowEx(NULL, WNDCLASSNAME, WNDNAME, wndStyle | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, posx1, posy1, width, height, NULL, NULL, hinst, NULL); hdc1 = GetDC(hwnd1); PIXELFORMATDESCRIPTOR pfd = { sizeof(PIXELFORMATDESCRIPTOR), 1, PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, PFD_TYPE_RGBA, SCRDEPTH, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, PFD_MAIN_PLANE, 0, 0, 0, 0 }; indexPixelFormat = ChoosePixelFormat(hdc1, &pfd); SetPixelFormat(hdc1, indexPixelFormat, &pfd); // Setup OpenGL hglrc = wglCreateContext(hdc1); wglMakeCurrent(hdc1, hglrc); glewExperimental = GL_TRUE; glewInit(); InitOpenGL(); ShowWindow(hwnd1, SW_SHOW); // everything went OK, show the window UpdateWindow(hwnd1); }
void WindowManager::Reinitialize() { glViewport(0,0,_Window->w,_Window->h); // Resize OpenGL Viewport to fit the screen/window IsGLErrors("ToggleFullscreen"); InitOpenGL(); TM->ReloadTextures(); GetRenderer()->ReinitializeAll(); _Active=true; }
int TryCompileShader(GLenum eGLSLShaderType, char* inFilename, char* shader, double* pCompileTime) { GLint iCompileStatus; GLuint hShader; Timer_t timer; InitTimer(&timer); InitOpenGL(); hShader = glCreateShaderObjectARB(eGLSLShaderType); glShaderSourceARB(hShader, 1, (const char **)&shader, NULL); ResetTimer(&timer); glCompileShaderARB(hShader); *pCompileTime = ReadTimer(&timer); /* Check it compiled OK */ glGetObjectParameterivARB (hShader, GL_OBJECT_COMPILE_STATUS_ARB, &iCompileStatus); if (iCompileStatus != GL_TRUE) { FILE* errorFile; GLint iInfoLogLength = 0; char* pszInfoLog; bstring filename = bfromcstr(inFilename); char* cstrFilename; glGetObjectParameterivARB (hShader, GL_OBJECT_INFO_LOG_LENGTH_ARB, &iInfoLogLength); pszInfoLog = malloc(iInfoLogLength); printf("Error: Failed to compile GLSL shader\n"); glGetInfoLogARB (hShader, iInfoLogLength, NULL, pszInfoLog); printf(pszInfoLog); bcatcstr(filename, "_compileErrors.txt"); cstrFilename = bstr2cstr(filename, '\0'); //Dump to file errorFile = fopen(cstrFilename, "w"); fprintf(errorFile, pszInfoLog); fclose(errorFile); bdestroy(filename); free(cstrFilename); free(pszInfoLog); return 0; } return 1; }
int main (int argc, char **argv) { glutInit(&argc, argv); CreateGlutWindow(); CreateGlutCallbacks(); InitOpenGL(); glutMainLoop(); ExitGlut(); return 0; }
/** * @brief Initializes the SpringApp instance * @return whether initialization was successful */ bool SpringApp::Initialize () { if (!ParseCmdLine ()) return false; #ifdef WIN32 // Initialize crash reporting Install( (LPGETLOGFILE) crashCallback, "*****@*****.**", "TA Spring Crashreport"); #endif // Initialize class system creg::ClassBinder::InitializeClasses (); #ifndef NO_LUA // Initialize lua bindings CLuaBinder lua; if (!lua.LoadScript("testscript.lua")) handleerror(NULL, lua.lastError.c_str(), "lua",MBF_OK|MBF_EXCL); #endif InitVFS (); if (!InitWindow ("RtsSpring")) { SDL_Quit (); return false; } // Global structures ENTER_SYNCED; gs=new CGlobalSyncedStuff(); ENTER_UNSYNCED; gu=new CGlobalUnsyncedStuff(); InitOpenGL(); palette.Init(); // Initialize keyboard SDL_EnableUNICODE(1); SDL_EnableKeyRepeat (SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); SDL_SetModState (KMOD_NONE); keys = new Uint8[SDLK_LAST]; memset (keys,0,sizeof(Uint8)*SDLK_LAST); // Initialize font font = new CglFont(32,223); LoadExtensions(); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); SDL_GL_SwapBuffers(); CreateGameSetup (); return true; }
bool CreateNewWindow() { HWND hWnd = CreateNewWindow_impl(); m_hWnd = hWnd; if (hWnd != INVALID_HANDLE_VALUE) { RegisterWindow(hWnd, this); ResetTimer(); InitOpenGL(hWnd); return true; } return false; }
/* @@@@@@@@@@@@@@@@@@@@@ Returns the opengl graphics driver and sets up global state @@@@@@@@@@@@@@@@@@@@@ */ void GLRB_DriverInit( void ) { GFX_Shutdown = GLRB_Shutdown; GFX_UnbindResources = GLRB_RestoreTextureState; GFX_LastError = GLRB_LastError; GFX_ReadPixels = GLRB_ReadPixels; GFX_ReadDepth = GLRB_ReadDepth; GFX_ReadStencil = GLRB_ReadStencil; GFX_CreateImage = GL_CreateImage; GFX_DeleteImage = GL_DeleteImage; GFX_UpdateCinematic = GL_UpdateCinematic; GFX_DrawImage = GLRB_DrawImage; GFX_GetImageFormat = GL_GetImageFormat; GFX_SetGamma = GLRB_SetGamma; GFX_GetFrameImageMemoryUsage = GL_SumOfUsedImages; GFX_GraphicsInfo = GLRB_GfxInfo_f; GFX_Clear = GL_Clear; GFX_SetProjectionMatrix = GL_SetProjection; GFX_GetProjectionMatrix = GL_GetProjection; GFX_SetModelViewMatrix = GL_SetModelView; GFX_GetModelViewMatrix = GL_GetModelView; GFX_SetViewport = GL_SetViewport; GFX_Flush = GL_Finish; GFX_SetState = GL_State; GFX_ResetState2D = GLRB_ResetState2D; GFX_ResetState3D = GLRB_ResetState3D; GFX_SetPortalRendering = GLRB_SetPortalRendering; GFX_SetDepthRange = GL_SetDepthRange; GFX_SetDrawBuffer = GLRB_SetDrawBuffer; GFX_EndFrame = GLimp_EndFrame; GFX_MakeCurrent = GLimp_MakeCurrent; GFX_ShadowSilhouette = GLRB_ShadowSilhouette; GFX_ShadowFinish = GLRB_ShadowFinish; GFX_DrawSkyBox = GLRB_DrawSkyBox; GFX_DrawBeam = GLRB_DrawBeam; GFX_DrawStageGeneric = GLRB_StageIteratorGeneric; GFX_DrawStageVertexLitTexture = GLRB_StageIteratorVertexLitTexture; GFX_DrawStageLightmappedMultitexture = GLRB_StageIteratorLightmappedMultitexture; GFX_DebugDrawAxis = GLRB_SurfaceAxis; GFX_DebugDrawTris = GLRB_DebugDrawTris; GFX_DebugDrawNormals = GLRB_DebugDrawNormals; GFX_DebugSetOverdrawMeasureEnabled = GLRB_SetOverdrawMeasureEnabled; GFX_DebugSetTextureMode = GL_TextureMode; GFX_DebugDrawPolygon = GLRB_DebugPolygon; InitOpenGL(); // Copy the resource strings to the vgConfig Q_strncpyz( vdConfig.renderer_string, glState.renderer_string, sizeof( vdConfig.renderer_string ) ); Q_strncpyz( vdConfig.vendor_string, glState.vendor_string, sizeof( vdConfig.vendor_string ) ); Q_strncpyz( vdConfig.version_string, glState.version_string, sizeof( vdConfig.version_string ) ); }
int TryCompileShader(GLenum eGLSLShaderType, const char* inFilename, char* shader, double* pCompileTime) { GLint iCompileStatus; GLuint hShader; Timer_t timer; InitTimer(&timer); InitOpenGL(); hShader = glCreateShaderObjectARB(eGLSLShaderType); glShaderSourceARB(hShader, 1, (const char **)&shader, NULL); ResetTimer(&timer); glCompileShaderARB(hShader); *pCompileTime = ReadTimer(&timer); /* Check it compiled OK */ glGetObjectParameterivARB (hShader, GL_OBJECT_COMPILE_STATUS_ARB, &iCompileStatus); FILE* errorFile; GLint iInfoLogLength = 0; char* pszInfoLog; std::string filename; filename += inFilename; glGetObjectParameterivARB (hShader, GL_OBJECT_INFO_LOG_LENGTH_ARB, &iInfoLogLength); if (iInfoLogLength > 1) { pszInfoLog = new char[iInfoLogLength]; if (iCompileStatus != GL_TRUE) printf("Error: Failed to compile GLSL shader\n"); glGetInfoLogARB(hShader, iInfoLogLength, NULL, pszInfoLog); printf(pszInfoLog); filename += "_compileErrors.txt"; //Dump to file errorFile = fopen(filename.c_str(), "w"); fprintf(errorFile, pszInfoLog); fclose(errorFile); delete[] pszInfoLog; } return iCompileStatus == GL_TRUE ? 1 : 0; }
internal void Win32InitOpenGL(HDC WindowDC) { Win32LoadWGLExtensions(); HGLRC OpenGLRC = 0; bool32 ModernContext = true; if(wglCreateContextAttribsARB) { int Win32OpenGLAttribs[] = { WGL_CONTEXT_MAJOR_VERSION_ARB, 3, WGL_CONTEXT_MINOR_VERSION_ARB, 1, WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB #if LUDUS_INTERNAL | WGL_CONTEXT_DEBUG_BIT_ARB #endif , WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB, 0 }; Win32SetPixelFormat(WindowDC); OpenGLRC = wglCreateContextAttribsARB(WindowDC, 0, Win32OpenGLAttribs); } if(!OpenGLRC) { ModernContext = false; OpenGLRC = wglCreateContext(WindowDC); } if(wglMakeCurrent(WindowDC, OpenGLRC)) { InitOpenGL(ModernContext); if(wglSwapInterval) { wglSwapInterval(1); } } else { Win32Log("Couldnt set OpenGL context"); LOG_FORMATTED_ERROR(4096); } }
SCSerror SCSapplication::Create (const SCSstring sTitle, const SCSstring sVersion, const SCSbool iFullscreen) { m_sTitle = sTitle; m_sVersion = sVersion; SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER); if (SCSdisplay::Singleton()->Create(iFullscreen)) return scsHandleError(SCS_ERROR_FRAMEWORK | SCS_ERROR_CREATE | SCS_ERROR_DISPLAY); SDL_WM_SetCaption(m_sTitle.c_str(), m_sTitle.c_str()); InitOpenGL(); SCSgraphics::Singleton()->Init(); SCSmixer::Singleton()->Init(32); return SCS_ERROR_NONE; }
openni::Status SampleViewer::Init(int argc, char **argv) { // initial ros node ros::init(argc, argv, "user_viewer"); ros::NodeHandle n; movePublisher = n.advertise<std_msgs::String>("cmd_erica", 20); // initial variable rightShoulderYaw = 0, rightShoulderPitch = 0, rightElbowTheta = 0, rightElbowYaw = 0; rightShoulderYawPub = 0, rightShoulderPitchPub = 0, rightElbowYawPub = 0, rightElbowThetaPub = 0; leftShoulderYaw = 0, leftShoulderPitch = 0, leftElbowTheta = 0, leftElbowYaw = 0; leftShoulderYawPub = 0, leftShoulderPitchPub = 0, leftElbowYawPub = 0, leftElbowThetaPub = 0; m_pTexMap = NULL; openni::Status rc = openni::OpenNI::initialize(); if (rc != openni::STATUS_OK) { printf("Failed to initialize OpenNI\n%s\n", openni::OpenNI::getExtendedError()); return rc; } const char* deviceUri = openni::ANY_DEVICE; for (int i = 1; i < argc-1; ++i) { if (strcmp(argv[i], "-device") == 0) { deviceUri = argv[i+1]; break; } } rc = m_device.open(deviceUri); if (rc != openni::STATUS_OK) { printf("Failed to open device\n%s\n", openni::OpenNI::getExtendedError()); return rc; } nite::NiTE::initialize(); if (m_pUserTracker->create(&m_device) != nite::STATUS_OK) { return openni::STATUS_ERROR; } return InitOpenGL(argc, argv); }
//----------------------------------------------------------------------------- int main(int argc, char **argv) { // Inicializações. InitOpenGL(&argc, argv); InitCallBacks(); InitDataStructures(); // Ajusta a função que chama as funções do mygl.h DrawFunc = MyGlDraw; // Framebuffer scan loop. glutMainLoop(); return 0; }
HDC GameWindow::Init(HINSTANCE hinstance) { m_hinstance = hinstance; CreateGameWindow("IN3026 Template"); // If we never got a valid window handle, quit the program if(m_hwnd == NULL) { return NULL; } else { // INIT OpenGL InitOpenGL(); return m_hdc; } }
/* =============== RE_Init =============== */ void RE_Init( void ) { int err; ST_Printf( PRINT_R_VERBOSE, "----- R_Init -----\n" ); R_Register(); InitOpenGL(); err = glGetError(); if ( err != GL_NO_ERROR ) ST_Printf ( PRINT_R_VERBOSE, "glGetError() = 0x%x\n", err ); ST_Printf( PRINT_R_VERBOSE, "----- finished R_Init -----\n" ); }
SCSerror SCSapplication::Create (const SCSstring sTitle, const SCSstring sVersion, SCSappformat& rkAppFormat) { m_sTitle = sTitle; m_sVersion = sVersion; SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_AUDIO); if (SCSdisplay::Singleton()->Create(rkAppFormat.kScreenInfo.w, rkAppFormat.kScreenInfo.h, rkAppFormat.bEnableFullScreen)) return scsHandleError(SCS_ERROR_FRAMEWORK | SCS_ERROR_CREATE | SCS_ERROR_DISPLAY); SDL_WM_SetCaption(m_sTitle.c_str(), m_sTitle.c_str()); InitOpenGL(); SCSgraphics::Singleton()->Init(); SCSmixer::Singleton()->Init(32, rkAppFormat.iAudioQuality); m_iUseTargetFPS = rkAppFormat.bEnableTargetFPS; m_fTargetFPS = rkAppFormat.fTargetFPS; return SCS_ERROR_NONE; }
int CMFCTessView::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CView::OnCreate(lpCreateStruct) == -1) return -1; // Initialize OpenGL when window is created. if ( !InitOpenGL() ) { MessageBox( "Error setting up OpenGL!", "Init Error!", MB_OK | MB_ICONERROR ); return -1; } return 0; }
int COpenGLView::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CView::OnCreate(lpCreateStruct) == -1) return -1; // TODO: 在此添加您专用的创建代码 m_pDC = new CClientDC(this); // 程序创建时,生成RC [8/20/2010 foryond] SetupPixelFormat(m_pDC); this->m_hRC = wglCreateContext(m_pDC->GetSafeHdc()); wglMakeCurrent(m_pDC->GetSafeHdc(), m_hRC); InitOpenGL(); //初始化函数 return 0; }
/* ===================== main (let's go) ===================== */ int main (int argc, char **argv) { glutInit (&argc, argv); // glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB); glutCreateWindow ("Example1 -- OpenGL"); glutDisplayFunc (DrawScene); glutReshapeFunc (SizeOpenGL); InitOpenGL (); glutMainLoop (); return (0); }
int __stdcall WinMain(__in HINSTANCE hInstance, __in_opt HINSTANCE hPrevInstance, __in_opt LPSTR lpCmdLine, __in int nShowCmd) { BOOL bResult = FALSE; MSG msg = { 0 }; WNDCLASS wc = { 0 }; wc.lpfnWndProc = WndProc; wc.hInstance = hInstance; wc.hbrBackground = (HBRUSH)(COLOR_BACKGROUND); wc.lpszClassName = L"Opengl4TemplateWindowClass"; wc.style = CS_OWNDC; if (!RegisterClass(&wc)) return 1; HWND hWnd = CreateWindowW(wc.lpszClassName, L"Opengl 4 Template", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 0, 0, 640, 480, 0, 0, hInstance, 0); ShowWindow(hWnd, nShowCmd); UpdateWindow(hWnd); bResult = CreateOpenGLRenderContext(hWnd); if (bResult == FALSE) { OutputDebugStringA("CreateOpenGLRenderContext failed!\n"); return 1; } InitGLEW(); InitOpenGL(); while (true) { if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) != 0) { if (msg.message == WM_QUIT) { break; } TranslateMessage(&msg); DispatchMessage(&msg); } else { Update(hWnd); Render(hWnd); } } return 0; }
void Button::Init(GLuint program) { vertices = new Vector3[NUM_VERTS]; UVs = new Vector3[NUM_VERTS]; // This will be a square object of "radius" widht vertices[0] = Vector3( -width , width , depth ); vertices[1] = Vector3( width , width , depth ); vertices[2] = Vector3( width , -width , depth ); vertices[3] = Vector3( -width , -width , depth ); // UVs are hardcoded as this is a square object (aka doesn't need fancy texture mapping) UVs[0] = Vector3( 0.0f, 1.0f, 0.0f ); UVs[1] = Vector3( 1.0f, 1.0f, 0.0f ); UVs[2] = Vector3( 1.0f, 0.0f, 0.0f ); UVs[3] = Vector3( 0.0f, 0.0f, 0.0f ); InitOpenGL(program); }
void WindowManager::ProcessEvent(SDL_Event *event) { MainMenu *mainmenu = (MainMenu *)SM->GetSceneByName("Main Menu"); OptionsMenu *optionsmenu = (OptionsMenu *)SM->GetSceneByName("Options Menu"); switch(event->type) // See which event it is { // When window is resized or is toggled between window and fullscreen case SDL_VIDEORESIZE: //Cleanup(); InitOpenGL(); IsGLErrors("Video Resize"); if(!WM->IsFullscreen()) { SetWindowedMode(0, 0, event->resize.w, event->resize.h); } glViewport(0,0,event->resize.w,event->resize.h); // Resize OpenGL Viewport to fit the screen/window SM->InitAll(); break; // When user quits the game case SDL_VIDEOEXPOSE: if(Game->GetCurrentMode() != GM_PLAY) { mainmenu->Resize(); optionsmenu->Resize(); } break; case SDL_QUIT: _Running=false; break; case SDL_ACTIVEEVENT: if(event->active.state & SDL_APPACTIVE) { if(event->active.gain) _Active = true; else _Active = false; } break; default: break; } }
bool Graphics::InitGraphics(int scale, int row, int col) { mRow = row; mCol = col; mScale = scale; mScreenWidth = col * scale; mScreenHeight = row * scale; if(!InitSDL()) return false; if(!InitOpenGL()) return false; mShaderProgramId = LoadShaders("data/main.vs", "data/main.fs"); mMVPuniformLocation = glGetUniformLocation(mShaderProgramId, "MVP"); glGenBuffers(1, &mVertexBufferId); glGenBuffers(1, &mColorBufferId); return true; }
void RendererThread::ThreadProc() { util::dcout << "Renderer thread entry @ " << GetCurrentThreadId() << std::endl; { // HACK: Activate and deactivate the context one time before sleeping // to avoid a crash under Catalyst 14.4 and allow SFML to // create the internal context. If this is not done, when the // context is deactivated, a crash will occur when SFML creates // the internal context, specifically at wglMakeShared. ScopedOGLContext<sf::Window> soglc(m_oglWindow); } ScopedOGLContext<sf::Window> soglc(m_oglWindow); InitOpenGL(); Message msg; m_quitLoop = false; while(!m_quitLoop) { WaitForSingleObject(m_messageEvent, !m_fading ? INFINITE : 16); if(!m_commandQueue.empty()) { ProcessMessages(); } if(m_fading) { auto currentTime = util::GetTimeMilis(); auto delta = currentTime - m_lastFadeTime; m_currentFadeAmount += delta / 1000.0f; m_lastFadeTime = currentTime; if(m_currentFadeAmount > 1.0f) { m_fading = false; } DrawStep(); } } }
int main(int argc, char** argv) { InitYsClass(); PrepareSquare(p); PrepareSquare(q); RotatePolygon(q,YsDegToRad(90.0),0.0); PrepareSquare(r); RotatePolygon(r,0.0,YsDegToRad(90.0)); printf("Keys\n"); printf("A....Viewing Rotation Mode\n"); printf("B....Viewing Translation (Scroll) Mode\n"); printf("C....Rotate polygon 1(Target Polygon)\n"); printf("D....Rotate polygon 2(Slasher)\n"); printf("E....Rotate polygon 3(Slasher)\n"); printf("Z....Zoom\n"); printf("M....Mooz\n"); printf("----------\n"); mouseMode=3; eyeAtt.Set(0.0,0.0,0.0); eyeDistance=10.0; glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(500, 500); glutInitWindowPosition(100, 100); glutCreateWindow(argv[0]); InitOpenGL(); glutDisplayFunc(Display); glutReshapeFunc(Reshape); glutKeyboardFunc(Keyboard); glutMouseFunc(Mouse); glutMotionFunc(Motion); glutIdleFunc(Idle); glutMainLoop(); return 0; }
openni::Status SampleViewer::Init(int argc, char **argv) { m_pTexMap = NULL; openni::Status rc = openni::OpenNI::initialize(); if (rc != openni::STATUS_OK) { printf("Failed to initialize OpenNI\n%s\n", openni::OpenNI::getExtendedError()); return rc; } const char* deviceUri = openni::ANY_DEVICE; for (int i = 1; i < argc-1; ++i) { if (strcmp(argv[i], "-device") == 0) { deviceUri = argv[i+1]; break; } } rc = m_device.open(deviceUri); if (rc != openni::STATUS_OK) { printf("Failed to open device\n%s\n", openni::OpenNI::getExtendedError()); return rc; } nite::NiTE::initialize(); if (m_pUserTracker->create(&m_device) != nite::STATUS_OK) { return openni::STATUS_ERROR; } return InitOpenGL(argc, argv); }
int main(int argc, char** argv) { InitYsClass(); PrepareShell(sh1); PrepareShell(sh2); printf("Keys\n"); printf("A....Viewing Rotation Mode\n"); printf("B....Viewing Translation (Scroll) Mode\n"); printf("C....Rotate Shell 1\n"); printf("D....Move Shell 1\n"); printf("E....Rotate Shell 2\n"); printf("F....Move Shell 2\n"); printf("G....Polygon/Wireframe\n"); printf("O....Or(UNION)\n"); printf("I....And(INTERSECTION)\n"); printf("S....Minus(DIFFERENCE)\n"); printf("Z....Zoom\n"); printf("M....Mooz\n"); printf("----------\n"); eyeAtt.Set(0.0,0.0,0.0); eyeDistance=10.0; glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(500, 500); glutInitWindowPosition(100, 100); glutCreateWindow(argv[0]); InitOpenGL(); glutDisplayFunc(Display); glutReshapeFunc(Reshape); glutKeyboardFunc(Keyboard); glutMouseFunc(Mouse); glutMotionFunc(Motion); glutIdleFunc(Idle); glutMainLoop(); return 0; }
// // ‘”Ќ ÷»я: InitInstance(HINSTANCE, int) // // Ќј«Ќј„≈Ќ»≈: сохран¤ет обработку экземпл¤ра и создает главное окно. // // ќћћ≈Ќ“ј–»»: // // ¬ данной функции дескриптор экземпл¤ра сохран¤етс¤ в глобальной переменной, а также // создаетс¤ и выводитс¤ на экран главное окно программы. // BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) { //HWND hWnd; hInst = hInstance; // —охранить дескриптор экземпл¤ра в глобальной переменной hWnd = CreateWindow(szWindowClass, szTitle,WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, 1300/*CW_USEDEFAULT*/, 650, NULL, NULL, hInstance, NULL); //SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)-60, 0); if (!hWnd) { return FALSE; } InitOpenGL(); ShowWindow(hWnd, nCmdShow); UpdateWindow(hWnd); return TRUE; }
int main(int argc, char **argv) { glutInit(&argc, argv); glutInitWindowSize(512, 512); glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH | GLUT_RGB); glutCreateWindow("NURBS Geometry Shader Rendering"); InitOpenGL(); InitNurbs(); manipulator.setDollyActivate( GLUT_LEFT_BUTTON, GLUT_ACTIVE_CTRL); manipulator.setPanActivate( GLUT_LEFT_BUTTON, GLUT_ACTIVE_SHIFT); manipulator.setDollyPosition( -3.0f); glutDisplayFunc(Display); glutMouseFunc(MousePress); glutMotionFunc(MouseMove); glutPassiveMotionFunc(PassiveMouseMove); glutIdleFunc(Idle); glutKeyboardFunc(KeyPress); glutReshapeFunc(Resize); //Configure the options optionKeyMap['s'] = OPTION_DISPLAY_WIREFRAME; options[OPTION_DISPLAY_WIREFRAME] = false; optionKeyMap[' '] = OPTION_ANIMATE; options[OPTION_ANIMATE] = true; optionKeyMap['t'] = OPTION_TANGENT; options[OPTION_TANGENT] = false; optionKeyMap['i'] = OPTION_INVERSION; options[OPTION_INVERSION] = false; optionKeyMap['r'] = OPTION_REGENERATE; options[OPTION_REGENERATE] = true; //Execute GLUT main loop and exit glutMainLoop(); //Time to exit return 0; }
int main(int argc, char** argv) { InitYsClass(); axisOfOrbit.Set(1.0,1.0,1.0); axisOfOrbit.Normalize(); orbiter=axisOfOrbit.GetArbitraryParpendicularVector(); orbiter.Normalize(); rot.Set(axisOfOrbit,0.0); printf("Keys\n"); printf("A....Viewing Rotation Mode\n"); printf("B....Viewing Translation (Scroll) Mode\n"); printf("Z....Zoom\n"); printf("M....Mooz\n"); printf("----------\n"); eyeAtt.Set(YsPi/2.0,0.0,0.0); eyeDistance=10.0; glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(500, 500); glutInitWindowPosition(100, 100); glutCreateWindow(argv[0]); InitOpenGL(); glutDisplayFunc(Display); glutReshapeFunc(Reshape); glutKeyboardFunc(Keyboard); glutMouseFunc(Mouse); glutMotionFunc(Motion); glutIdleFunc(Idle); glutMainLoop(); return 0; }