本文整理汇总了C++中GLWindow::create方法的典型用法代码示例。如果您正苦于以下问题:C++ GLWindow::create方法的具体用法?C++ GLWindow::create怎么用?C++ GLWindow::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLWindow
的用法示例。
在下文中一共展示了GLWindow::create方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runBrainzDemo
void runBrainzDemo() {
Brain* b = new Brain(48, 32, 16384, 1, 8, 0.4);
b->printSummary();
GLWindow* g = new GLWindow();
g->create("Brain", 800, 600);
g->start(new BrainVis(b));
}
示例2: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
#if defined(Q_WS_X11)
XInitThreads();
#endif
GLWindow *glwindow = new GLWindow();
glwindow->create();
glwindow->setWindowState(Qt::WindowNoState);
glwindow->showFullScreen();
glwindow->resume();
int result = a.exec();
glwindow->destroy();
delete glwindow;
//QCoreApplication::setAttribute(Qt::AA_NativeWindows, true);
//QCoreApplication::setAttribute(Qt::AA_ImmediateWidgetCreation, true);
//return a.exec();
return result;
}
示例3: main
int main(int argc, char** argv) {
auto glversion = gl::getAvailableVersion();
auto major = GL_GET_MAJOR_VERSION(glversion);
auto minor = GL_GET_MINOR_VERSION(glversion);
if (glversion < GL_MAKE_VERSION(4, 1)) {
MessageBoxA(nullptr, "Interface requires OpenGL 4.1 or higher", "Unsupported", MB_OK);
return 0;
}
QGuiApplication app(argc, argv);
bool quitting = false;
// FIXME need to handle window closing message so that we can stop the timer
GLWindow* window = new GLWindow();
window->create();
window->show();
window->setSurfaceType(QSurface::OpenGLSurface);
window->setFormat(getDefaultOpenGLSurfaceFormat());
bool contextCreated = false;
QTimer* timer = new QTimer();
QObject::connect(timer, &QTimer::timeout, [&] {
if (quitting) {
return;
}
if (!contextCreated) {
window->createContext();
contextCreated = true;
}
if (!window->makeCurrent()) {
throw std::runtime_error("Failed");
}
glClearColor(1.0f, 0.0f, 1.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
window->swapBuffers();
window->doneCurrent();
});
// FIXME need to handle window closing message so that we can stop the timer
QObject::connect(&app, &QCoreApplication::aboutToQuit, [&] {
quitting = true;
QObject::disconnect(timer, &QTimer::timeout, nullptr, nullptr);
timer->stop();
timer->deleteLater();
});
timer->setInterval(15);
timer->setSingleShot(false);
timer->start();
app.exec();
return 0;
}
示例4: triggerStereo
// workaround for issue seen on Windows 7 with NVIDIA
void triggerStereo()
{
// attributes for an OpenGL stereo window
GLWindow::Attributes attributes;
attributes[WGL_STEREO_ARB] = GL_TRUE;
// create and destroy a small stereo window: this is here to work around
// an issue with windows failing to switch to quad-buffer mode (although
// the window is successfully created and reports a stereo pixel format)
// note: the window is invisible (not shown) but typically causes the
// windows desktop to flash briefly (first run only) as stereo activates
GLWindow window;
window.create( 0, "", 0, 0, 0, 8, 8, 0, 0, DefWindowProc, 0, attributes );
window.destroy();
}
示例5: main
int main(int argc, char* argv[])
{
Settings *settings = Settings::Instance();
settings->doCommandLineOptions(argc,argv);
if ( settings->getCVar("headless") )
{
Headless headless;
headless.create();
Evolution* mainscene = new Evolution();
headless.runGLScene(mainscene);
delete mainscene;
}
else
{
GLWindow glwindow;
glwindow.create("Critterding beta12", 800, 600);
Evolution* mainscene = new Evolution();
glwindow.runGLScene(mainscene);
delete mainscene;
}
}
示例6: _T
DWORD CDOPPEngineDlg::threadLoop()
{
bool bCapture = false;
bCapture = (m_pShowWinCheckBox->GetCheck() == BST_CHECKED);
// Create window with ogl context to load extensions
WNDCLASSEX wndclass;
const LPCWSTR cClassName = _T("OGL");
const LPCWSTR cWindowName = _T("DOPP Capture");
// Register WindowClass for GL window
wndclass.cbSize = sizeof(WNDCLASSEX);
wndclass.style = CS_OWNDC;
wndclass.lpfnWndProc = WndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = (HINSTANCE)GetModuleHandle(NULL);
wndclass.hIcon = (HICON)LoadImage((HINSTANCE)AfxGetInstanceHandle(), MAKEINTRESOURCE(IDR_MAINFRAME), IMAGE_ICON, LR_DEFAULTSIZE, LR_DEFAULTSIZE, NULL);
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.hbrBackground = NULL;
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = cClassName;
wndclass.hIconSm = (HICON)LoadImage((HINSTANCE)AfxGetInstanceHandle(), MAKEINTRESOURCE(IDR_MAINFRAME), IMAGE_ICON, LR_DEFAULTSIZE, LR_DEFAULTSIZE, NULL);
if (!RegisterClassEx(&wndclass))
return FALSE;
GLWindow* pWin = new GLWindow("DOPP Capture", "OGL");
pWin->create(g_uiWindowWidth, g_uiWindowHeight, false, false, false, true);
// GLWindow::create context will destroy the initial window and create a new one. To avoid that
// WndProc emits a PostQuitMessage a pointer to the initial window is passed. If this pointer is
// valid we know that it is the temporary window and should not emit PostQuitMessage.
SetWindowLongPtr(pWin->getWnd(), GWLP_USERDATA, reinterpret_cast<LONG_PTR>(pWin));
pWin->createContext(0);
GLDOPPEngine* pEngine = NULL;
switch (m_uiEffectSelection)
{
case COLOR_INVERT:
pEngine = new GLDOPPColorInvert;
break;
case EDGE_FILTER:
pEngine = new GLDOPPEdgeFilter;
break;
case DISTORT_EFFECT:
pEngine = new GLDOPPDistort;
break;
case ROTATE_DESKTOP:
pEngine = new GLDOPPRotate;
break;
default:
pEngine = new GLDOPPEngine;
break;
}
// m_uiDesktopSelection is the id of the selected element in the Combo Box
// Need to add 1 to get the desktop id as shown in CCC
if (!pEngine->initDOPP(m_uiDesktopSelection + 1))
{
// prevent thread loop to start due to error
m_bEngineRunning = false;
}
if (!pEngine->initEffect())
{
// prevent thread loop to start due to error
m_bEngineRunning = false;
}
if (m_bEngineRunning && m_uiEffectSelection == ROTATE_DESKTOP)
{
GLDOPPRotate* pRot = dynamic_cast<GLDOPPRotate*>(pEngine);
pRot->setRotation((float)m_uiRotationAngle);
}
if (bCapture && m_bEngineRunning)
{
// Open window only if this option was checked in the GUI
pWin->open();
}
// Enable SW mouse
SystemParametersInfo(SPI_SETMOUSETRAILS, 2, 0, 0);
MSG mMsg;
//.........这里部分代码省略.........