本文整理汇总了C++中Display::get_window方法的典型用法代码示例。如果您正苦于以下问题:C++ Display::get_window方法的具体用法?C++ Display::get_window怎么用?C++ Display::get_window使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Display
的用法示例。
在下文中一共展示了Display::get_window方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
/*-------------------------------------
Render Context initialization
-------------------------------------*/
bool Context::init(const Display& disp, bool useVsync) {
terminate();
if (disp.is_running() == false) {
LS_LOG_ERR("\tAttempted to initialize a render context with no display.\n");
return false;
}
// Attach the OpenGL context to our window handle
LS_LOG_MSG("Initializing an OpenGL rendering context.");
pContext = SDL_GL_CreateContext(disp.get_window());
if (!pContext) {
LS_LOG_ERR(
"\tUnable to create a render context through SDL.",
"\n\t", SDL_GetError(),
'\n'
);
terminate();
return false;
}
LS_LOG_MSG("\tSuccessfully created a basic render context.");
// Quick setup in order to normalize OpenGL to the display coordinates.
this->make_current(disp);
const math::vec2i&& displayRes = disp.get_resolution();
glViewport(0, 0, displayRes[0], displayRes[1]);
LS_LOG_GL_ERR();
// Set the default back buffer color
const ls::draw::color::color& mgcPnk = ls::draw::color::magenta;
glClearColor(mgcPnk[0], mgcPnk[1], mgcPnk[2], mgcPnk[3]);
LS_LOG_GL_ERR();
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
LS_LOG_GL_ERR();
set_vsync(useVsync);
LS_LOG_MSG(
"\tSuccessfully initialized a OpenGL 3.3-compatible render context:"
"\n\tV-Sync: ", get_vsync()
);
LS_LOG_MSG("\tSuccessfully initialized the OpenGL 3.3 render context.\n");
return true;
}
示例2: flip
/*-------------------------------------
Swap the current display's front and back buffers.
-------------------------------------*/
void Context::flip(const Display& disp) const {
SDL_GL_SwapWindow(disp.get_window());
}
示例3: make_current
/*-------------------------------------
Activate the render context used in this window.
-------------------------------------*/
void Context::make_current(const Display& disp) const {
SDL_GL_MakeCurrent(disp.get_window(), pContext);
}