本文整理汇总了C++中ndk_helper::GLContext::GetANativeWindow方法的典型用法代码示例。如果您正苦于以下问题:C++ GLContext::GetANativeWindow方法的具体用法?C++ GLContext::GetANativeWindow怎么用?C++ GLContext::GetANativeWindow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ndk_helper::GLContext
的用法示例。
在下文中一共展示了GLContext::GetANativeWindow方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitDisplay
/**
* Initialize an EGL context for the current display.
*/
int Engine::InitDisplay(android_app* app) {
if (!initialized_resources_) {
gl_context_->Init(app_->window);
LoadResources();
initialized_resources_ = true;
} else if(app->window != gl_context_->GetANativeWindow()) {
// Re-initialize ANativeWindow.
// On some devices, ANativeWindow is re-created when the app is resumed
assert(gl_context_->GetANativeWindow());
UnloadResources();
gl_context_->Invalidate();
app_ = app;
gl_context_->Init(app->window);
LoadResources();
initialized_resources_ = true;
} else {
// initialize OpenGL ES and EGL
if (EGL_SUCCESS == gl_context_->Resume(app_->window)) {
UnloadResources();
LoadResources();
} else {
assert(0);
}
}
ShowUI();
// Initialize GL state.
glEnable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
// Note that screen size might have been changed
glViewport(0, 0, gl_context_->GetScreenWidth(),
gl_context_->GetScreenHeight());
renderer_.UpdateViewport();
tap_camera_.SetFlip(1.f, -1.f, -1.f);
tap_camera_.SetPinchTransformFactor(2.f, 2.f, 8.f);
return 0;
}