这篇教程C++ CreateGLWindow函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CreateGLWindow函数的典型用法代码示例。如果您正苦于以下问题:C++ CreateGLWindow函数的具体用法?C++ CreateGLWindow怎么用?C++ CreateGLWindow使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CreateGLWindow函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: assertvoid ccContourExtractorDlg::init(){ if (m_glWindow) { //already initialized assert(false); return; } connect(nextPushButton, SIGNAL(clicked()), &m_loop, SLOT(quit())); //connect(nextPushButton, SIGNAL(clicked()), this, SLOT(accept())); connect(skipPushButton, SIGNAL(clicked()), this, SLOT(onSkipButtonClicked())); nextPushButton->setFocus(); //create 3D window { QWidget* glWidget = 0; CreateGLWindow(m_glWindow, glWidget, false, true); assert(m_glWindow && glWidget); ccGui::ParamStruct params = m_glWindow->getDisplayParameters(); //black (text) & white (background) display by default params.backgroundCol = ccColor::white; params.textDefaultCol = ccColor::black; params.pointsDefaultCol = ccColor::black; params.drawBackgroundGradient = false; params.decimateMeshOnMove = false; params.displayCross = false; params.colorScaleUseShader = false; m_glWindow->setDisplayParameters(params,true); m_glWindow->setPerspectiveState(false,true); m_glWindow->setInteractionMode(ccGLWindow::INTERACT_PAN | ccGLWindow::INTERACT_ZOOM_CAMERA | ccGLWindow::INTERACT_CLICKABLE_ITEMS); m_glWindow->setPickingMode(ccGLWindow::NO_PICKING); m_glWindow->displayOverlayEntities(true); viewFrame->setLayout(new QHBoxLayout); viewFrame->layout()->addWidget(glWidget); }}
开发者ID:coolshahabaz,项目名称:trunk,代码行数:38,
示例2: WinMainint WINAPI WinMain( HINSTANCE hInstance, // Instance HINSTANCE hPrevInstance, // Previous Instance LPSTR lpCmdLine, // Command Line Parameters int nCmdShow) // Window Show State{ MSG msg; // Windows Message Structure BOOL done=FALSE; // Bool Variable To Exit Loop double deltaTime; { long long CountsPerSecond=0; QueryPerformanceCounter((LARGE_INTEGER*)&previousTime); QueryPerformanceFrequency((LARGE_INTEGER*)&CountsPerSecond); secondsPerCount = 1.0 / (double)CountsPerSecond; } // Ask The User Which Screen Mode They Prefer bFullScreen = !(MessageBox(NULL,"Would You Like To Run In Fullscreen Mode?", "Start FullScreen?",MB_YESNO|MB_ICONQUESTION)==IDNO); // Windowed Mode // Create Our OpenGL Window if (!CreateGLWindow("Engine Programming",x_res,y_res,32,bFullScreen)) return 0; // Quit If Window Was Not Created while(!done) // Loop That Runs While done=FALSE { QueryPerformanceCounter((LARGE_INTEGER*)¤tTime); deltaTime=(double)(currentTime-previousTime)*secondsPerCount; if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) // Is There A Message Waiting? { if (msg.message==WM_QUIT) // Have We Received A Quit Message? { done=TRUE; // If So done=TRUE } else // If Not, Deal With Window Messages { TranslateMessage(&msg); // Translate The Message DispatchMessage(&msg); // Dispatch The Message } } else // If There Are No Messages { // Draw The Scene. Watch For ESC Key And Quit Messages From DrawGLScene() if ((active && !DrawGLScene()) || keys[VK_ESCAPE]) // Active? Was There A Quit Received? { done=TRUE; // ESC or DrawGLScene Signalled A Quit } else // Not Time To Quit, Update Screen { SwapBuffers(hDC); // Swap Buffers (Double Buffering) } UpdateGLScene(deltaTime); g.rotate_x(-g_Landscape->TotalRot); g.rotate_y((float)xDelta/4); g_newRot=g_Landscape->TotalRot+(float)yDelta/4; g.rotate_x(g_Landscape->TotalRot+(float)yDelta/4); xDelta=0; yDelta=0; if(!keys[VK_SHIFT]) g_MaxVelocity=vector(0.01,0.01,0.01); else g_MaxVelocity=vector(0.05,0.05,0.05); g_Acceleration=vector(0,0,0); if(keys[VK_UP]||keys['W']) g_Acceleration.wz=0.01; if(keys[VK_DOWN]||keys['S']) g_Acceleration.wz=-0.01; if(keys[VK_RIGHT]||keys['D']) g_Acceleration.wx=-0.01; if(keys[VK_LEFT]||keys['A']) g_Acceleration.wx=0.01; if(keys[VK_UP]||keys['U']) g_DominantDirectionalLight->rotate_z(1); if(keys[VK_DOWN]||keys['J']) g_DominantDirectionalLight->rotate_z(-1); if(keys[VK_RIGHT]||keys['K']) g_DominantDirectionalLight->rotate_x(-1); if(keys[VK_LEFT]||keys['H']) g_DominantDirectionalLight->rotate_x(1); if(g_Acceleration.wz==0.0) g_Velocity.wz=0.0f; if(g_Acceleration.wx==0.0f) g_Velocity.wx=0.0f; g_Velocity+=g_Acceleration*static_cast<float>(deltaTime); if(g_Velocity.wx>g_MaxVelocity.wx) g_Velocity.wx=g_MaxVelocity.wx; if(g_Velocity.wy>g_MaxVelocity.wy) g_Velocity.wy=g_MaxVelocity.wy; if(g_Velocity.wz>g_MaxVelocity.wz) g_Velocity.wz=g_MaxVelocity.wz; if(g_Velocity.wx<-g_MaxVelocity.wx) g_Velocity.wx=-g_MaxVelocity.wx; if(g_Velocity.wy<-g_MaxVelocity.wy) g_Velocity.wy=-g_MaxVelocity.wy; if(g_Velocity.wz<-g_MaxVelocity.wz) g_Velocity.wz=-g_MaxVelocity.wz; g.translate(g_Velocity.wx*deltaTime,g_Velocity.wy*deltaTime,g_Velocity.wz*deltaTime);//.........这里部分代码省略.........
开发者ID:marczaku,项目名称:zaku-glworld,代码行数:101,
示例3: WinMainint WINAPI WinMain( HINSTANCE hInstance, // Instance HINSTANCE hPrevInstance, // Previous Instance LPSTR lpCmdLine, // Command Line Parameters int nCmdShow) // Window Show State{ MSG msg; // Windows Message Structure BOOL done=FALSE; // Bool Variable To Exit Loop OPENFILENAMEA ofn; char szFileName[MAX_PATH] = ""; char *fn; fn = GetCommandLineA(); char *realfn = strrchr(fn, ' ')+1; if (!CreateGLWindow("MGSView",640,480,16,fullscreen)) { return 0; // Quit If Window Was Not Created } ZeroMemory(&ofn, sizeof(ofn)); ofn.lStructSize = sizeof(ofn); // SEE NOTE BELOW ofn.hwndOwner = hWnd; ofn.lpstrFilter = "Konami Model (*.KMD)/0*.kmd/0All Files (*.*)/0*.*/0"; ofn.lpstrFile = szFileName; ofn.nMaxFile = MAX_PATH; ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; ofn.lpstrDefExt = "kmd"; if(GetOpenFileNameA(&ofn)){ KMD_Load(ofn.lpstrFile); //KMD_Load(realfn); dl = KMD_DrawPoints(); //return 0; } else return -1; ofn.lpstrFilter = "Konami Archive (*.DAR)/0*.dar/0All Files (*.*)/0*.*/0"; ofn.lpstrDefExt = "dar"; /* if(GetOpenFileNameA(&ofn)) DAR_LoadTextures(ofn.lpstrFile); else return -1; GetOpenFileNameA(&ofn); DAR_LoadTextures(ofn.lpstrFile); GetOpenFileNameA(&ofn); DAR_LoadTextures(ofn.lpstrFile); GetOpenFileNameA(&ofn); DAR_LoadTextures(ofn.lpstrFile);*/ //VRAM_Save(); //return 0; //KMD_Export(); //return 0; while(!done) // Loop That Runs While done=FALSE { if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) // Is There A Message Waiting? { if (msg.message==WM_QUIT) // Have We Received A Quit Message? { done=TRUE; // If So done=TRUE } else // If Not, Deal With Window Messages { TranslateMessage(&msg); // Translate The Message DispatchMessage(&msg); // Dispatch The Message } } else // If There Are No Messages { if (active) // Program Active? { if(dl){ DrawGLScene(); // Draw The Scene SwapBuffers(hDC); // Swap Buffers (Double Buffering) } } } } DrawGLScene(); // Draw The Scene OBJExport(); KillGLWindow(); // Kill The Window return (msg.wParam); // Exit The Program}
开发者ID:neko68k,项目名称:mgsview,代码行数:88,
示例4: WinMainint WINAPI WinMain( HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow) { MSG msg; BOOL done=FALSE; fullscreen=FALSE; if (!CreateGLWindow("NeHe's OpenGL Framework",640,480,16,fullscreen)) { return 0; } while(!done) { if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) { if (msg.message==WM_QUIT) { done=TRUE; } else { TranslateMessage(&msg); DispatchMessage(&msg); } } else { if (active) { if (keys[VK_ESCAPE]) { done=TRUE; } else { DrawGLScene(); SwapBuffers(hDC); if(keys[VK_RIGHT]) { scena.addHangle(-0.7); } if(keys[VK_LEFT]) { scena.addHangle(0.7); } if(keys[VK_UP]) { scena.step(1); } if(keys[VK_DOWN]) { scena.step(-1); } } } if (keys[VK_F1]) { keys[VK_F1]=FALSE; KillGLWindow(); fullscreen=!fullscreen; if (!CreateGLWindow("NeHe's OpenGL Framework",640,480,16,fullscreen)) { return 0; } } } } KillGLWindow(); return (msg.wParam); }
开发者ID:szsoppa,项目名称:Game,代码行数:74,
示例5: WinMainint WINAPI WinMain(HINSTANCE hInstance, // Дескриптор приложения HINSTANCE hPrevInstance, // Дескриптор родительского приложения LPSTR lpCmdLine, // Параметры командной строки int nCmdShow) // Состояние отображения окна{ MSG msg; // Структура для хранения сообщения Windows //BOOL done=false; // Логическая переменная для выхода из цикла if (MYPRGOGLMAINWINDOWSTART==MYPRGOGLMAINWINDOWSTARTFULLSRCASC) { // Спрашивает пользователя, какой режим экрана он предпочитает if (MessageBox(NULL,TEXT("Хотите ли Вы запустить приложение в полноэкранном режиме?"),TEXT("Запустить в полноэкранном режиме?"),MB_YESNO | MB_ICONQUESTION)==IDNO) { fullscreen = false; // Оконный режим } } else { fullscreen=MYPRGOGLMAINWINDOWSTART; } // Создать наше OpenGL окно if(!CreateGLWindow(MYPRGOGLMAINWINDOWNAME,MYPRGOGLMAINWINDOWWIDTH,MYPRGOGLMAINWINDOWHEIGHT,32,fullscreen)) { return 0; // Выйти, если окно не может быть создано } while(!gHalt) // Цикл продолжается, пока done не равно true { if(PeekMessage(&msg,NULL,0,0,PM_REMOVE)) // Есть ли в очереди какое-нибудь сообщение? { if( msg.message==WM_QUIT ) // Мы поучили сообщение о выходе? { gHalt=true; // Если так, done=true } else // Если нет, обрабатывает сообщения { TranslateMessage(&msg); // Переводим сообщение DispatchMessage(&msg); // Отсылаем сообщение } } else // Если нет сообщений { // Прорисовываем сцену. if(active) // Активна ли программа? { if(keys[VK_ESCAPE]) // Было ли нажата клавиша ESC? { gHalt=true; // ESC говорит об останове выполнения программы } else // Не время для выхода, обновим экран. { my_keyboardTest(keys); DrawGLScene(); // Рисуем сцену SwapBuffers(hDC); // Меняем буфер (двойная буферизация) } } if(keys[VK_F1]) // Была ли нажата F1? { keys[VK_F1]=false; // Если так, меняем значение ячейки массива на false KillGLWindow(); // Разрушаем текущее окно fullscreen=!fullscreen; // Переключаем режим // Пересоздаём наше OpenGL окно if(!CreateGLWindow(MYPRGOGLMAINWINDOWNAME,MYPRGOGLMAINWINDOWWIDTH,MYPRGOGLMAINWINDOWHEIGHT,32,fullscreen)) { gHalt=true; // Выходим, если это невозможно } } } } // Shutdown my_beforeExit(); KillGLWindow(); // Разрушаем окно return((int)msg.wParam); // Выходим из программы}
开发者ID:apany15,项目名称:Pull-Pusher,代码行数:78,
示例6: WinMainint WINAPI WinMain( HINSTANCE hInstance, // Instance HINSTANCE hPrevInstance, // Previous Instance LPSTR lpCmdLine, // Command Line Parameters int nShowCmd ) // Window Show State{ MSG msg; // Windows Message Structure BOOL done=FALSE; // Bool Variable To Exit Loop createAILogger(); logInfo("App fired!"); // load scene if (!Import3DFromFile(basepath+modelname)) return 0; logInfo("=============== Post Import ===================="); // Ask The User Which Screen Mode They Prefer if (MessageBox(NULL, "Would You Like To Run In Fullscreen Mode?", "Start Fullscreen?", MB_YESNO|MB_ICONEXCLAMATION)==IDNO) { fullscreen=FALSE; // Windowed Mode } // Create Our OpenGL Window (also calls GLinit und LoadGLTextures) if (!CreateGLWindow(windowTitle, 640, 480, 16, fullscreen)) { return 0; } while(!done) // Game Loop { if (PeekMessage(&msg, NULL, 0,0, PM_REMOVE)) // Is There A Message Waiting { if (msg.message==WM_QUIT) // Have we received A Quit Message? { done=TRUE; // If So done=TRUE } else { TranslateMessage(&msg); // Translate The Message DispatchMessage(&msg); // Dispatch The Message } } else { // Draw The Scene. Watch For ESC Key And Quit Messaged From DrawGLScene() if (active) { if (keys[VK_ESCAPE]) // Was ESC pressed? { done=TRUE; // ESC signalled A quit } else { DrawGLScene(); // Draw The Scene SwapBuffers(hDC); // Swap Buffers (Double Buffering) } } if (keys[VK_F1]) // Is F1 Being Pressed? { keys[VK_F1]=FALSE; // If so make Key FALSE KillGLWindow(); // Kill Our Current Window fullscreen=!fullscreen; // Toggle Fullscreen //recreate Our OpenGL Window if (!CreateGLWindow(windowTitle, 640, 480, 16, fullscreen)) { return 0; // Quit if Window Was Not Created } } } } // *** cleanup *** // clear map textureIdMap.clear(); //no need to delete pointers in it manually here. (Pointers point to textureIds deleted in next step) // clear texture ids if (textureIds) { delete[] textureIds; textureIds = NULL; } // *** cleanup end *** // Shutdown destroyAILogger(); KillGLWindow(); return (msg.wParam); // Exit The Program}
开发者ID:EeroHeikkinen,项目名称:cinderworkshop,代码行数:96,
示例7: WinMainint WINAPI WinMain( HINSTANCE hInstance, // Instance HINSTANCE hPrevInstance, // Previous Instance LPSTR lpCmdLine, // Command Line Parameters int nCmdShow) // Window Show State{ MSG msg; // Windows Message Structure BOOL done=FALSE; // Bool Variable To Exit Loop // Ask The User Which Screen Mode They Prefer if (MessageBox(NULL,L"Would You Like To Run In Fullscreen Mode?", L"Start FullScreen?",MB_YESNO|MB_ICONQUESTION)==IDNO) { fullscreen=FALSE; // Windowed Mode } // Create Our OpenGL Window if (!CreateGLWindow(L"NeHe's Rotation Tutorial",640,480,16,fullscreen)) { return 0; // Quit If Window Was Not Created } while(!done) // Loop That Runs While done=FALSE { if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) // Is There A Message Waiting? { if (msg.message==WM_QUIT) // Have We Received A Quit Message? { done=TRUE; // If So done=TRUE } else // If Not, Deal With Window Messages { TranslateMessage(&msg); // Translate The Message DispatchMessage(&msg); // Dispatch The Message } } else // If There Are No Messages { // Draw The Scene. Watch For ESC Key And Quit Messages From DrawGLScene() if ((active && !DrawGLScene()) || keys[VK_ESCAPE]) // Active? Was There A Quit Received? { done=TRUE; // ESC or DrawGLScene Signalled A Quit } else // Not Time To Quit, Update Screen { SwapBuffers(hDC); // Swap Buffers (Double Buffering) if (keys['L'] && !lp) { lp=TRUE; light=!light; if (!light) { glDisable(GL_LIGHTING); } else { glEnable(GL_LIGHTING); } } if (!keys['L']) { lp=FALSE; } if (keys['F'] && !fp) { fp=TRUE; filter+=1; if (filter>2) { filter=0; } } if (!keys['F']) { fp=FALSE; } if (keys[VK_PRIOR]) { z-=0.02f; } if (keys[VK_NEXT]) { z+=0.02f; } if (keys[VK_UP]) { xspeed-=0.1f; } if (keys[VK_DOWN]) { xspeed+=0.1f; } if (keys[VK_RIGHT]) { yspeed+=0.1f; } if (keys[VK_LEFT]) { yspeed-=0.1f; } if (keys[VK_F1]) // Is F1 Being Pressed?//.........这里部分代码省略.........
开发者ID:ShadowBrother,项目名称:Flyby,代码行数:101,
示例8: CreateGLWindowBOOL CreateGLWindow(char *title, int width, int height, int bits, bool fullscreenflag){ GLuint PixelFormat; // holds the results after searching for a match HINSTANCE hInstance; // holds the instance of the application WNDCLASS wc; // windows class structure DWORD dwExStyle; // window extended style DWORD dwStyle; // window style RECT WindowRect; // grabs rectangle upper left / lower right values WindowRect.left = (long)0; // set left value to 0 WindowRect.right = (long)width; // set right value to requested width WindowRect.top = (long)0; // set top value to 0 WindowRect.bottom = (long)height; // set bottom value to requested height fullscreen = fullscreenflag; // set the global fullscreen flag hInstance = GetModuleHandle(NULL); // grab an instance for our window wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; // redraw on size, and own DC for window. wc.lpfnWndProc = (WNDPROC)WndProc; // wndproc handles messages wc.cbClsExtra = 0; // no extra window data wc.cbWndExtra = 0; // no extra window data wc.hInstance = hInstance; // set the instance wc.hIcon = LoadIcon(NULL, IDI_WINLOGO); // load the default icon wc.hCursor = LoadCursor(NULL, IDC_ARROW); // load the arrow pointer wc.hbrBackground = NULL; // no background required for GL wc.lpszMenuName = NULL; // we don't want a menu wc.lpszClassName = "EU07"; // nazwa okna do komunikacji zdalnej // // Set The Class Name if (!arbMultisampleSupported) // tylko dla pierwszego okna if (!RegisterClass(&wc)) // Attempt To Register The Window Class { ErrorLog("Fail: window class registeration"); MessageBox(NULL, "Failed to register the window class.", "ERROR", MB_OK | MB_ICONEXCLAMATION); return FALSE; // Return FALSE } if (fullscreen) // Attempt Fullscreen Mode? { DEVMODE dmScreenSettings; // device mode memset(&dmScreenSettings, 0, sizeof(dmScreenSettings)); // makes sure memory's cleared dmScreenSettings.dmSize = sizeof(dmScreenSettings); // size of the devmode structure // tolaris-240403: poprawka na odswiezanie monitora // locate primary monitor... if (Global::bAdjustScreenFreq) { POINT point; point.x = 0; point.y = 0; MONITORINFOEX monitorinfo; monitorinfo.cbSize = sizeof(MONITORINFOEX); ::GetMonitorInfo(::MonitorFromPoint(point, MONITOR_DEFAULTTOPRIMARY), &monitorinfo); // ..and query for highest supported refresh rate unsigned int refreshrate = 0; int i = 0; while (::EnumDisplaySettings(monitorinfo.szDevice, i, &dmScreenSettings)) { if (i > 0) if (dmScreenSettings.dmPelsWidth == (unsigned int)width) if (dmScreenSettings.dmPelsHeight == (unsigned int)height) if (dmScreenSettings.dmBitsPerPel == (unsigned int)bits) if (dmScreenSettings.dmDisplayFrequency > refreshrate) refreshrate = dmScreenSettings.dmDisplayFrequency; ++i; } // fill refresh rate info for screen mode change dmScreenSettings.dmDisplayFrequency = refreshrate; dmScreenSettings.dmFields = DM_DISPLAYFREQUENCY; } dmScreenSettings.dmPelsWidth = width; // selected screen width dmScreenSettings.dmPelsHeight = height; // selected screen height dmScreenSettings.dmBitsPerPel = bits; // selected bits per pixel dmScreenSettings.dmFields = dmScreenSettings.dmFields | DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT; // Try to set selected mode and get results. NOTE: CDS_FULLSCREEN gets rid of start bar. if (ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL) { // If the mode fails, offer two options. Quit or use windowed mode. ErrorLog("Fail: full screen"); if (MessageBox(NULL, "The requested fullscreen mode is not supported by/nyour video " "card. Use windowed mode instead?", "EU07", MB_YESNO | MB_ICONEXCLAMATION) == IDYES) { fullscreen = FALSE; // Windowed Mode Selected. Fullscreen = FALSE } else { // Pop Up A Message Box Letting User Know The Program Is Closing. Error("Program will now close."); return FALSE; // Return FALSE } } } if (fullscreen) // Are We Still In Fullscreen Mode? { dwExStyle = WS_EX_APPWINDOW; // Window Extended Style dwStyle = WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN; // Windows Style//.........这里部分代码省略.........
开发者ID:enbik,项目名称:maszyna,代码行数:101,
示例9: WinMainint WINAPI WinMain(HINSTANCE hInstance, // 当前窗口实例 HINSTANCE hPrevInstance, // 前一个窗口实例 LPSTR lpCmdLine, // 命令行参数 int nCmdShow) // 窗口显示状态{ MSG msg; // Windowsx消息结构 BOOL done = FALSE; // 用来退出循环的Bool 变量 fullscreen = false; // 提示用户选择运行模式 //if (MessageBox(NULL, TEXT("你想在全屏模式下运行么?"), TEXT("设置全屏模式"), MB_YESNO | MB_ICONQUESTION) == IDNO) // fullscreen = FALSE; // FALSE为窗口模式 // 创建OpenGL窗口 if (!CreateGLWindow(TEXT("OpenGL程序框架"), 800, 600, 16, fullscreen)) return 0; // 失败退出 while (!done) // 保持循环直到 done=TRUE { if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) // 有消息在等待吗? { if (msg.message == WM_QUIT) // 收到退出消息? { done = TRUE; // 是,则done=TRUE } else // 不是,处理窗口消息 { TranslateMessage(&msg); // 翻译消息 DispatchMessage(&msg); // 发送消息 } } else // 如果没有消息 { // 绘制场景。监视ESC键和来自DrawGLScene()的退出消息 if (active) // 程序激活的么? { if (keys[VK_ESCAPE]) // ESC 是否按下 { done = TRUE; // ESC 发出退出信号 } else // 不是退出的时候,刷新屏幕 { DrawGLScene(); // 绘制场景 SwapBuffers(hDC); // 交换缓存 (双缓存) } } if (keys[VK_F1]) // F1键按下了么 { keys[VK_F1] = FALSE; // 若是,使对应的Key数组中的值为 FALSE KillGLWindow(); // 销毁当前的窗口 fullscreen = !fullscreen; // 切换 全屏 / 窗口 模式 // 重建 OpenGL 窗口 if (!CreateGLWindow(TEXT("OpenGL 程序框架"), 800, 600, 16, fullscreen)) return 0; // 如果窗口未能创建,程序退出 } } } // 关闭程序 KillGLWindow(); // 销毁窗口 return (msg.wParam); // 退出程序}
开发者ID:xianyun2014,项目名称:Opengl-road,代码行数:66,
示例10: WinMainint WINAPI WinMain( HINSTANCE hInstance, // Instance HINSTANCE hPrevInstance, // Previous Instance LPSTR lpCmdLine, // Command Line Parameters int nCmdShow) // Window Show State{ MSG msg; // Windows Message Structure BOOL done=FALSE; // Bool Variable To Exit Loop // Ask The User Which Screen Mode They Prefer if (MessageBox(NULL,"Would You Like To Run In Fullscreen Mode?", "Start FullScreen?",MB_YESNO|MB_ICONQUESTION)==IDNO) { fullscreen=FALSE; // Windowed Mode } // Create Our OpenGL Window if (!CreateGLWindow("JelloPhysic Test",800,600,16,fullscreen)) { return 0; // Quit If Window Was Not Created } while(!done) // Loop That Runs While done=FALSE { if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) // Is There A Message Waiting? { if (msg.message==WM_QUIT) // Have We Received A Quit Message? { done=TRUE; // If So done=TRUE } else // If Not, Deal With Window Messages { TranslateMessage(&msg); // Translate The Message DispatchMessage(&msg); // Dispatch The Message } } else // If There Are No Messages { // Draw The Scene. Watch For ESC Key And Quit Messages From DrawGLScene() if ((active && !DrawGLScene()) || keys[VK_ESCAPE]) // Active? Was There A Quit Received? { done=TRUE; // ESC or DrawGLScene Signalled A Quit } else // Not Time To Quit, Update Screen { SwapBuffers(hDC); // Swap Buffers (Double Buffering) } if(keys[VK_F2]) { if(springy == true) { //add pressure body SpringBody *sBody = new SpringBody(springI, 1.0f, 150.0f, 5.0f, 300.0f, 15.0f, Vector2(-5.0f, -5.0f), 0.0f, Vector2::One,false); sBody->addInternalSpring(0, 14, 300.0f, 10.0f); sBody->addInternalSpring(1, 14, 300.0f, 10.0f); sBody->addInternalSpring(1, 15, 300.0f, 10.0f); sBody->addInternalSpring(1, 5, 300.0f, 10.0f); sBody->addInternalSpring(2, 14, 300.0f, 10.0f); sBody->addInternalSpring(2, 5, 300.0f, 10.0f); sBody->addInternalSpring(1, 5, 300.0f, 10.0f); sBody->addInternalSpring(14, 5, 300.0f, 10.0f); sBody->addInternalSpring(2, 4, 300.0f, 10.0f); sBody->addInternalSpring(3, 5, 300.0f, 10.0f); sBody->addInternalSpring(14, 6, 300.0f, 10.0f); sBody->addInternalSpring(5, 13, 300.0f, 10.0f); sBody->addInternalSpring(13, 6, 300.0f, 10.0f); sBody->addInternalSpring(12, 10, 300.0f, 10.0f); sBody->addInternalSpring(13, 11, 300.0f, 10.0f); sBody->addInternalSpring(13, 10, 300.0f, 10.0f); sBody->addInternalSpring(13, 9, 300.0f, 10.0f); sBody->addInternalSpring(6, 10, 300.0f, 10.0f); sBody->addInternalSpring(6, 9, 300.0f, 10.0f); sBody->addInternalSpring(6, 8, 300.0f, 10.0f); sBody->addInternalSpring(7, 9, 300.0f, 10.0f); // polygons! sBody->addTriangle(0, 15, 1); sBody->addTriangle(1, 15, 14); sBody->addTriangle(1, 14, 5); sBody->addTriangle(1, 5, 2); sBody->addTriangle(2, 5, 4); sBody->addTriangle(2, 4, 3); sBody->addTriangle(14, 13, 6); sBody->addTriangle(14, 6, 5); sBody->addTriangle(12, 11, 10); sBody->addTriangle(12, 10, 13); sBody->addTriangle(13, 10, 9); sBody->addTriangle(13, 9, 6); sBody->addTriangle(6, 9, 8); sBody->addTriangle(6, 8, 7); sBody->finalizeTriangles(); mWorld->addBody(sBody); springBodies.push_back(sBody); springy = false; } }//.........这里部分代码省略.........
开发者ID:2youyou2,项目名称:jphysicmod,代码行数:101,
示例11: WinMainint WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { MSG msg; BOOL done = FALSE; if (MessageBox(NULL,"Would You Like To Run In Fullscreen Mode?", "Start FullScreen?",MB_YESNO|MB_ICONQUESTION)==IDNO) fullscreen = FALSE; InitVars(); // Create Our OpenGL Window if (!CreateGLWindow("Arkanoid",640,480,16,fullscreen)) { return 0; } srand(time(NULL)); while(!done) { if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) { if (msg.message == WM_QUIT) { done = TRUE; } else { TranslateMessage(&msg); DispatchMessage(&msg); } } else if (active) { if (keys[VK_ESCAPE]) done = TRUE; if (keys[78] && (gof)) { done = TRUE; gof = false; } // 78 -- n, 89 -- y if (keys[89] && (gof)) { gameOver = TRUE; flag = 0;/*TogglePause();*/ idle(); DrawGLScene(); SwapBuffers(hDC); gof = false; } else { if ( keys[VK_SPACE] ) { bflag = true;} if(bflag){ if (keys[VK_PAUSE]){ TogglePause(); } if(pause) { DrawGLScene(); SwapBuffers(hDC); } else{ idle(); DrawGLScene(); SwapBuffers(hDC); } } else { DrawLoadScreen (); SwapBuffers(hDC); } } if (!ProcessKeys()) return 0; } } // Shutdown KillGLWindow(); glDeleteTextures(4,texture); return (msg.wParam); }
开发者ID:demonh1,项目名称:tarkanoid,代码行数:76,
示例12: WinMain//----------------------------------------------------------------------------------------------------// Standard windows mainline, this is the program entry point//CrtInt32 WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, CrtInt32 nCmdShow) { (void)hPrevInstance; // Avoid warnings (void)nCmdShow; // Avoid warnings (void)hInstance; // Avoid warnings#ifndef NO_DEVIL ilInit();#endif MSG msg; BOOL done=FALSE; // Avoid warnings later msg.wParam = 0; // Turns on windows heap debugging#if HEAP_DEBUG _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_CHECK_CRT_DF /*| _CRTDBG_DELAY_FREE_MEM_DF*/);#endif // Ask The User Which Screen Mode They Prefer // if (MessageBox(NULL,"Would You Like To Run In Fullscreen Mode?", "Start FullScreen?",MB_YESNO|MB_ICONQUESTION)==IDNO) { fullscreen=FALSE; } // Set the default screen size _CrtRender.SetScreenWidth( 640); _CrtRender.SetScreenHeight( 480); // Create an OpenGL Window if (!CreateGLWindow("Collada Viewer for PC", _CrtRender.GetScreenWidth(), _CrtRender.GetScreenHeight(),32,fullscreen)) { return 0; } // Turn data dumping (debug) off //CrtBool dumpData = CrtFalse; // Initialize the renderer // !!!GAC for compatibility with the new COLLADA_FX code, Init now forces UsingCg and UsingVBOs to // !!!GAC false. It also calls CrtInitCg, creating the CG context and calling cgGLRegisterStates. // !!!GAC All these things are currently required for the cfx rendering path to work, changing them // !!!GAC may cause problems. This is work in progress and will be much cleaner when the refactor is done. _CrtRender.Init(); //_CrtRender.SetRenderDebug( CrtTrue ); // !!!GAC kept for reference, changing these may cause problems with the cfx include path //_CrtRender.SetUsingCg( CrtFalse ); // Turn off VBOs (the GL skinning path doesn't work with VBOs yet) _CrtRender.SetUsingVBOs( CrtTrue ); _CrtRender.SetUsingNormalMaps( CrtTrue ); //_CrtRender.SetRenderDebug( CrtTrue ); //_CrtRender.SetUsingShadowMaps(CrtTrue); // We might get a windows-style path on the command line, this can mess up the DOM which expects // all paths to be URI's. This block of code does some conversion to try and make the input // compliant without breaking the ability to accept a properly formatted URI. Right now this only // displays the first filename char file[512], *in = lpCmdLine, *out = file; *out = NULL; // If the first character is a ", skip it (filenames with spaces in them are quoted) if(*in == '/"') { in++; } if(*(in+1) == ':') { // Second character is a :, assume we have a path with a drive letter and add a slash at the beginning *(out++) = '/'; } int i; for(i =0; i<512; i++) { // If we hit a null or a quote, stop copying. This will get just the first filename. if(*in == NULL || *in == '/"') break; // Copy while swapping backslashes for forward ones if(*in == '//') { *out = '/'; } else { *out = *in; } in++; out++; }//.........这里部分代码省略.........
开发者ID:mDibyo,项目名称:docker-files,代码行数:101,
示例13: ProcessInput// Call ProcessInput once per frame to process input keysvoid ProcessInput( bool keys[] ){ // These keys we don't want to auto-repeat, so we clear them in "keys" after handling them once if (keys['E'] && amplitudeGlobalParameter) { float value; cgGetParameterValuefc(amplitudeGlobalParameter, 1, &value); value += 0.1f; cgSetParameter1f(amplitudeGlobalParameter, value); keys['E'] = false; } if (keys['R'] && amplitudeGlobalParameter) { float value; cgGetParameterValuefc(amplitudeGlobalParameter,1, &value); value -= 0.1f; cgSetParameter1f(amplitudeGlobalParameter, value); keys['R'] = false; } if (keys[VK_TAB] ) { // When 'C' is pressed, change cameras _CrtRender.SetNextCamera(); keys[VK_TAB] = false; } if ( keys['M'] ) { // Speed up UI by 25% AdjustUISpeed(1.25f); keys['M'] = false; } if ( keys['N'] ) { // Slow down UI by 25% AdjustUISpeed(0.75f); // Go 25% slower keys['N'] = false; } if (keys['Q']) { if (togglewireframe) { glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); togglewireframe = FALSE; } else { glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); togglewireframe = TRUE; } keys['Q'] = false; } if (keys['K']) { if (togglehiearchy) { _CrtRender.SetShowHiearchy(CrtTrue); togglehiearchy = FALSE; } else { _CrtRender.SetShowHiearchy(CrtFalse); togglehiearchy = TRUE; } keys['K'] = false; } if (keys['L']) { if (togglelighting) { glDisable(GL_LIGHTING); togglelighting = FALSE; } else { glEnable(GL_LIGHTING); togglelighting = TRUE; } keys['L'] = false; } if (keys['P'] ) { if (sAnimationEnable) { _CrtRender.SetAnimationPaused( CrtTrue ); sAnimationEnable = false; } else { _CrtRender.SetAnimationPaused( CrtFalse ); sAnimationEnable = true; } keys['P'] = false; } if (keys[VK_F1]) { keys[VK_F1]=FALSE; _CrtRender.Destroy(); DestroyGLWindow(); fullscreen=!fullscreen; // Recreate Our OpenGL Window if (!CreateGLWindow("Collada Viewer for PC", _CrtRender.GetScreenWidth(), _CrtRender.GetScreenHeight(),32,fullscreen)) { exit(1); } if ( !_CrtRender.Load( cleaned_file_name )) { exit(0);//.........这里部分代码省略.........
开发者ID:mDibyo,项目名称:docker-files,代码行数:101,
示例14: WinMainint WINAPI WinMain( HINSTANCE hInstance, // Instance HINSTANCE hPrevInstance, // Previous Instance LPSTR lpCmdLine, // Command Line Parameters int nShowCmd ) // Window Show State{ MSG msg; BOOL done=FALSE; createAILogger(); logInfo("App fired!"); // Check the command line for an override file path. int argc; LPWSTR* argv = CommandLineToArgvW(GetCommandLineW(), &argc); if (argv != NULL && argc > 1) { std::wstring modelpathW(argv[1]); modelpath = std::string(modelpathW.begin(), modelpathW.end()); } if (!Import3DFromFile(modelpath)) return 0; logInfo("=============== Post Import ===================="); if (MessageBox(NULL, "Would You Like To Run In Fullscreen Mode?", "Start Fullscreen?", MB_YESNO|MB_ICONEXCLAMATION)==IDNO) { fullscreen=FALSE; } if (!CreateGLWindow(windowTitle, 640, 480, 16, fullscreen)) { return 0; } while(!done) // Game Loop { if (PeekMessage(&msg, NULL, 0,0, PM_REMOVE)) { if (msg.message==WM_QUIT) { done=TRUE; } else { TranslateMessage(&msg); DispatchMessage(&msg); } } else { // Draw The Scene. Watch For ESC Key And Quit Messaged From DrawGLScene() if (active) { if (keys[VK_ESCAPE]) { done=TRUE; } else { DrawGLScene(); SwapBuffers(hDC); } } if (keys[VK_F1]) { keys[VK_F1]=FALSE; KillGLWindow(); fullscreen=!fullscreen; if (!CreateGLWindow(windowTitle, 640, 480, 16, fullscreen)) { return 0; } } } } // *** cleanup *** textureIdMap.clear(); //no need to delete pointers in it manually here. (Pointers point to textureIds deleted in next step) if (textureIds) { delete[] textureIds; textureIds = NULL; } // *** cleanup end *** destroyAILogger(); KillGLWindow(); return (msg.wParam);}
开发者ID:3dcgarts,项目名称:assimp,代码行数:93,
示例15: WinMainint WINAPI WinMain( HINSTANCE hInstance, // Instance HINSTANCE hPrevInstance, // Previous Instance LPSTR lpCmdLine, // Command Line Parameters int nCmdShow) // Window Show State{ MSG msg; // Windows Message Structure BOOL done=FALSE; // Bool Variable To Exit Loop // Ask The User Which Screen Mode They Prefer if (MessageBox(NULL,"Would You Like To Run In Fullscreen Mode?", "Start FullScreen?",MB_YESNO|MB_ICONQUESTION)==IDNO) { fullscreen=FALSE; // Windowed Mode } // Create Our OpenGL Window if (!CreateGLWindow("NeHe's Token, Extensions, Scissoring & TGA Loading Tutorial",640,480,16,fullscreen)) { return 0; // Quit If Window Was Not Created } while(!done) // Loop That Runs While done=FALSE { if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) // Is There A Message Waiting? { if (msg.message==WM_QUIT) // Have We Received A Quit Message? { done=TRUE; // If So done=TRUE } else // If Not, Deal With Window Messages { DispatchMessage(&msg); // Dispatch The Message } } else // If There Are No Messages { // Draw The Scene. Watch For ESC Key And Quit Messages From DrawGLScene() if ((active && !DrawGLScene()) || keys[VK_ESCAPE]) // Active? Was There A Quit Received? { done=TRUE; // ESC or DrawGLScene Signalled A Quit } else // Not Time To Quit, Update Screen { SwapBuffers(hDC); // Swap Buffers (Double Buffering) if (keys[VK_F1]) // Is F1 Being Pressed? { keys[VK_F1]=FALSE; // If So Make Key FALSE KillGLWindow(); // Kill Our Current Window fullscreen=!fullscreen; // Toggle Fullscreen / Windowed Mode // Recreate Our OpenGL Window if (!CreateGLWindow("NeHe's Token, Extensions, Scissoring & TGA Loading Tutorial",640,480,16,fullscreen)) { return 0; // Quit If Window Was Not Created } } if (keys[VK_UP] && (scroll>0)) // Is Up Arrow Being Pressed? { scroll-=2; // If So, Decrease 'scroll' Moving Screen Down } if (keys[VK_DOWN] && (scroll<32*(maxtokens-9))) // Is Down Arrow Being Pressed? { scroll+=2; // If So, Increase 'scroll' Moving Screen Up } } } } // Shutdown KillGLWindow(); // Kill The Window return (msg.wParam); // Exit The Program}
开发者ID:aalbertini,项目名称:opengl-win32-nehe,代码行数:73,
示例16: WinMainint WINAPI WinMain( HINSTANCE hInstance, // Instance HINSTANCE hPrevInstance, // Previous Instance LPSTR lpCmdLine, // Command Line Parameters int nCmdShow) // Window Show State{ MSG msg; // Windows Message Structure BOOL done=FALSE; // Bool Variable To Exit Loop // Ask The User Which Screen Mode They Prefer if (MessageBox(NULL,"Would You Like To Run In Fullscreen Mode?", "Start FullScreen?",MB_YESNO|MB_ICONQUESTION)==IDNO) { fullscreen=FALSE; // Windowed Mode } // Create Our OpenGL Window if (!CreateGLWindow("NeHe's Particle Tutorial",640,480,16,fullscreen)) { return 0; // Quit If Window Was Not Created } if (fullscreen) // Are We In Fullscreen Mode { slowdown=1.0f; // If So, Speed Up The Particles (3dfx Issue) } while(!done) // Loop That Runs While done=FALSE { if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) // Is There A Message Waiting? { if (msg.message==WM_QUIT) // Have We Received A Quit Message? { done=TRUE; // If So done=TRUE } else // If Not, Deal With Window Messages { TranslateMessage(&msg); // Translate The Message DispatchMessage(&msg); // Dispatch The Message } } else // If There Are No Messages { // Draw The Scene. Watch For ESC Key And Quit Messages From DrawGLScene() if ((active && !DrawGLScene()) || keys[VK_ESCAPE]) // Active? Was There A Quit Received? { done=TRUE; // ESC or DrawGLScene Signalled A Quit } else // Not Time To Quit, Update Screen { SwapBuffers(hDC); // Swap Buffers (Double Buffering) if (keys[VK_ADD] && (slowdown>1.0f)) slowdown-=0.01f; // Speed Up Particles if (keys[VK_SUBTRACT] && (slowdown<4.0f)) slowdown+=0.01f; // Slow Down Particles if (keys[VK_PRIOR]) zoom+=0.1f; // Zoom In if (keys[VK_NEXT]) zoom-=0.1f; // Zoom Out if (keys[VK_RETURN] && !rp) // Return Key Pressed { rp=true; // Set Flag Telling Us It's Pressed rainbow=!rainbow; // Toggle Rainbow Mode On / Off } if (!keys[VK_RETURN]) rp=false; // If Return Is Released Clear Flag if ((keys[' '] && !sp) || (rainbow && (delay>25))) // Space Or Rainbow Mode { if (keys[' ']) rainbow=false; // If Spacebar Is Pressed Disable Rainbow Mode sp=true; // Set Flag Telling Us Space Is Pressed delay=0; // Reset The Rainbow Color Cycling Delay col++; // Change The Particle Color if (col>11) col=0; // If Color Is To High Reset It } if (!keys[' ']) sp=false; // If Spacebar Is Released Clear Flag // If Up Arrow And Y Speed Is Less Than 200 Increase Upward Speed if (keys[VK_UP] && (yspeed<200)) yspeed+=1.0f; // If Down Arrow And Y Speed Is Greater Than -200 Increase Downward Speed if (keys[VK_DOWN] && (yspeed>-200)) yspeed-=1.0f; // If Right Arrow And X Speed Is Less Than 200 Increase Speed To The Right if (keys[VK_RIGHT] && (xspeed<200)) xspeed+=1.0f; // If Left Arrow And X Speed Is Greater Than -200 Increase Speed To The Left if (keys[VK_LEFT] && (xspeed>-200)) xspeed-=1.0f; delay++; // Increase Rainbow Mode Color Cycling Delay Counter if (keys[VK_F1]) // Is F1 Being Pressed? { keys[VK_F1]=FALSE; // If So Make Key FALSE KillGLWindow(); // Kill Our Current Window fullscreen=!fullscreen; // Toggle Fullscreen / Windowed Mode // Recreate Our OpenGL Window if (!CreateGLWindow("NeHe's Particle Tutorial",640,480,16,fullscreen)) { return 0; // Quit If Window Was Not Created } } } }//.........这里部分代码省略.........
开发者ID:arch-jslin,项目名称:mysandbox,代码行数:101,
示例17: WinMainint WINAPI WinMain( HINSTANCE hInstance, // Instance HINSTANCE hPrevInstance, // Previous Instance LPSTR lpCmdLine, // Command Line Parameters int nCmdShow) // Window Show State{ MSG msg; // Windows Message Structure BOOL done=FALSE; // Bool Variable To Exit Loop // Ask The User Which Screen Mode They Prefer if (MessageBox(NULL,"Would You Like To Run In Fullscreen Mode?", "Start FullScreen?",MB_YESNO|MB_ICONQUESTION)==IDNO) { fullscreen=FALSE; // Windowed Mode } // Create Our OpenGL Window if (!CreateGLWindow("Slider",1600,1200,16,fullscreen)) { return 0; // Quit If Window Was Not Created } while(!done) // Loop That Runs While done=FALSE { if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) // Is There A Message Waiting? { if (msg.message==WM_QUIT) // Have We Received A Quit Message? { done=TRUE; // If So done=TRUE } else // If Not, Deal With Window Messages { TranslateMessage(&msg); // Translate The Message DispatchMessage(&msg); // Dispatch The Message } } else // If There Are No Messages { // Draw The Scene. Watch For ESC Key And Quit Messages From DrawGLScene() if (active) // Program Active? { if (keys[VK_ESCAPE]) // Was ESC Pressed? { done=TRUE; // ESC Signalled A Quit } else // Not Time To Quit, Update Screen { DrawGLScene(); // Draw The Scene SwapBuffers(hDC); // Swap Buffers (Double Buffering) } if (keys['L'] && !lp) // L Key Being Pressed Not Held? { lp=TRUE; // lp Becomes TRUE light=!light; // Toggle Light TRUE/FALSE if (!light) // If Not Light { glDisable(GL_LIGHTING); // Disable Lighting } else // Otherwise { glEnable(GL_LIGHTING); // Enable Lighting } } if (!keys['L']) // Has L Key Been Released? { lp=FALSE; // If So, lp Becomes FALSE } if (keys['F'] && !fp) // Is F Key Being Pressed? { fp=TRUE; // fp Becomes TRUE filter+=1; // filter Value Increases By One if (filter>2) // Is Value Greater Than 2? { filter=0; // If So, Set filter To 0 } } if (!keys['F']) // Has F Key Been Released? { fp=FALSE; // If So, fp Becomes FALSE } if (keys[VK_PRIOR]) // Is Page Up Being Pressed? { z-=0.02f; // If So, Move Into The Screen } if (keys[VK_NEXT]) // Is Page Down Being Pressed? { z+=0.02f; // If So, Move Towards The Viewer } if (keys[VK_UP]) // Is Up Arrow Being Pressed? { xspeed-=0.01f; // If So, Decrease xspeed } if (keys[VK_DOWN]) // Is Down Arrow Being Pressed?//.........这里部分代码省略.........
开发者ID:austinmiller,项目名称:samples,代码行数:101,
示例18: SubclassWindowBOOL CGLLogoView::SubclassWindow (HWND hWnd){ CWindowImpl <CGLLogoView, CStatic>::SubclassWindow (hWnd); if (!CreateGLWindow()) KillGLWindow(); return TRUE;}
开发者ID:evpobr,项目名称:fictionbookeditor,代码行数:6,
示例19: WinMainint WINAPI WinMain(HINSTANCE hInstance, // instance HINSTANCE hPrevInstance, // previous instance LPSTR lpCmdLine, // command line parameters int nCmdShow) // window show state{ MSG msg; // windows message structure BOOL done = FALSE; // bool variable to exit loop fullscreen = true; DecimalSeparator = '.'; /* //Ra: tutaj to nie dzia C++ CreateGUIControls函数代码示例 C++ CreateFontIndirectW函数代码示例
|