本文整理汇总了C++中ndk_helper::GLContext类的典型用法代码示例。如果您正苦于以下问题:C++ GLContext类的具体用法?C++ GLContext怎么用?C++ GLContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GLContext类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: InitDisplay
/**
* Initialize an EGL context for the current display.
*/
int Engine::InitDisplay()
{
if( !initialized_resources_ )
{
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();
}
}
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( 10.f, 10.f, 8.f );
return 0;
}
开发者ID:ChronicTheOne,项目名称:platform_development,代码行数:37,代码来源:MoreTeapotsNativeActivity.cpp
示例2: InitDisplay
// Initialize an EGL context for the current display.
int Engine::InitDisplay(const int32_t cmd) {
if (!initialized_resources_) {
gl_context_->Init(app_->window);
InitUI();
gl_context_->SetSwapInterval(0); // Set interval of 0 for a benchmark
LoadResources();
initialized_resources_ = true;
} else {
// initialize OpenGL ES and EGL
if (EGL_SUCCESS != gl_context_->Resume(app_->window)) {
UnloadResources();
LoadResources();
}
jui_helper::JUIWindow::GetInstance()->Resume(app_->activity, cmd);
}
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;
}
开发者ID:Virako,项目名称:cpp-android-basic-samples,代码行数:34,代码来源:NativeGameActivity.cpp
示例3: DrawFrame
/**
* Just the current frame in the display.
*/
void Engine::DrawFrame()
{
renderer_.Update( monitor_.GetCurrentTime() );
// Just fill the screen with a color.
glClearColor( 0.0f, 0.0f, 0.0f, 0.0f );
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
renderer_.Render();
// Swap
if( EGL_SUCCESS != gl_context_->Swap() )
{
UnloadResources();
LoadResources();
}
}
开发者ID:2015winter,项目名称:facetrackerapp,代码行数:20,代码来源:native.cpp
示例4: 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;
}
开发者ID:huyu0415,项目名称:android-ndk,代码行数:45,代码来源:TeapotNativeActivity.cpp
示例5: DrawFrame
/**
* Just the current frame in the display.
*/
void Engine::DrawFrame() {
float fps;
if (monitor_.Update(fps)) {
UpdateFPS(fps);
}
double dTime = monitor_.GetCurrentTime();
renderer_.Update(dTime);
// Just fill the screen with a color.
glClearColor(0.5f, 0.5f, 0.5f, 1.f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
renderer_.Render();
// Swap
if (EGL_SUCCESS != gl_context_->Swap()) {
UnloadResources();
LoadResources();
}
}
开发者ID:feder1989,项目名称:android-ndk,代码行数:22,代码来源:MoreTeapotsNativeActivity.cpp
示例6: TransformPosition
void Engine::TransformPosition(ndk_helper::Vec2& vec) {
vec = ndk_helper::Vec2(2.0f, 2.0f) * vec /
ndk_helper::Vec2(gl_context_->GetScreenWidth(),
gl_context_->GetScreenHeight()) -
ndk_helper::Vec2(1.f, 1.f);
}
开发者ID:huyu0415,项目名称:android-ndk,代码行数:6,代码来源:TeapotNativeActivity.cpp
示例7: TrimMemory
void Engine::TrimMemory() {
LOGI("Trimming memory");
gl_context_->Invalidate();
}
开发者ID:huyu0415,项目名称:android-ndk,代码行数:4,代码来源:TeapotNativeActivity.cpp
示例8: TermDisplay
/**
* Tear down the EGL context currently associated with the display.
*/
void Engine::TermDisplay() { gl_context_->Suspend(); }
开发者ID:huyu0415,项目名称:android-ndk,代码行数:4,代码来源:TeapotNativeActivity.cpp
注:本文中的ndk_helper::GLContext类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论