本文整理汇总了C++中Platform::destroyWindow方法的典型用法代码示例。如果您正苦于以下问题:C++ Platform::destroyWindow方法的具体用法?C++ Platform::destroyWindow怎么用?C++ Platform::destroyWindow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Platform
的用法示例。
在下文中一共展示了Platform::destroyWindow方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(void)
{
//Initialize platform subsystem and EGL
Platform* platform = Platform::getInstance();
platform->createWindow(WINDOW_WIDTH, WINDOW_HEIGHT);
EGLRuntime::initializeEGL(EGLRuntime::OPENGLES2);
eglMakeCurrent(EGLRuntime::display, EGLRuntime::surface, EGLRuntime::surface, EGLRuntime::context);
Scene *scene = new Scene(WINDOW_WIDTH, WINDOW_HEIGHT);
scene->Initialize();
//Timer variable to calculate FPS
Timer fpsTimer;
fpsTimer.reset();
DWORD wait = 0;
bool end = false;
while (!end)
{
//End when something happens to the window
if (platform->checkWindow() != Platform::WINDOW_IDLE)
end = true;
//This prints FPS every second
float fFPS = fpsTimer.getFPS();
if (fpsTimer.isTimePassed(1.0f)){
LOGI("FPS:\t%.1f\n", fFPS);
}
scene->Draw();
eglSwapBuffers(EGLRuntime::display, EGLRuntime::surface);
//Calculate how much we have to wait to achieve 30FPS,
//getInterval() tells us how much time have passed
//since the last call (seems to be in centi-seconds)
float interval = fpsTimer.getInterval() * 100;
wait = (DWORD)(1000 / (interval * 30));
Sleep(wait);
}
//Shutdown everything
EGLRuntime::terminateEGL();
platform->destroyWindow();
delete platform;
delete scene;
return 0;
}
示例2: main
//.........这里部分代码省略.........
GL_CHECK(glEnable(GL_BLEND));
GL_CHECK(glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA));
Text* text = new Text("assets/", window_width, window_height);
text->clear();
text->addString(0, 0, "Skybox Sample", 255, 255, 0, 255);
/* Rendering loop to draw the scene starts here. */
bool shouldContinueTheLoop = true;
while (shouldContinueTheLoop)
{
/* If something happened to the window, leave the loop. */
if (platform->checkWindow() != Platform::WINDOW_IDLE)
{
shouldContinueTheLoop = false;
}
WithRobot::EulerAngle euler_angle = sensor.get_data().euler_angle;
angle_X = -euler_angle.pitch; // y
angle_Y = euler_angle.yaw; // z
angle_Z = -euler_angle.roll; // x
/* Construct quaternions for X, Y and Z axes. */
Q_X = construct_quaternion(1.0f, 0.0f, 0.0f, angle_X);
Q_Y = construct_quaternion(0.0f, 1.0f, 0.0f, angle_Y);
Q_Z = construct_quaternion(0.0f, 0.0f, 1.0f, angle_Z);
// Y->X->Z
/* Obtain the resultant quaternion. */
Q_XZ = multiply_quaternions(Q_X, Q_Z);
Q_YXZ = multiply_quaternions(Q_Y, Q_XZ);
/* Compute a modelview matrix. Model matrix is a unit matrix. */
construct_modelview_matrix(Q_YXZ, model_view_matrix);
/* In this demo, we do not need to provide the vertex shader with any mesh data, because a predefined set
of 4 vertices is embedded within the shader. These vertices, expressed in Normalized Device Coordinates,
correspond to four corners of the visible screen space. By using this vertices to form a triangle strip,
we end up with a full-screen quad that is later used for rasterization stage. */
/* Restore the cubemap program object, because it has been changed by text rendering call. */
GL_CHECK(glUseProgram(program_id));
/* Upload the matrix to view matrix uniform so that it can be used for vertex shader stage. */
GL_CHECK(glUniformMatrix4fv(location_viewMat, 1, GL_FALSE, (const GLfloat*) model_view_matrix));
/* Render a full-screen quad, as described above.
Note that the actual content of the quad is drawn within the fragment shader. */
GL_CHECK(glDrawArrays(GL_TRIANGLE_STRIP, 0, 4));
char str_angle[256];
// sprintf(str_angle, "# myAHRS+ (www.withrobot.com) : roll %.1f, pitch %.1f, yaw %.1f\n", euler_angle.roll, euler_angle.pitch, euler_angle.yaw);
sprintf(str_angle, "[ LG V Task Demo ]\n");
text->clear();
// text->addString(0, 0, str_angle, 255, 255, 0, 255);
text->addString(0, 0, str_angle, 0, 255, 0, 255);
text->draw();
eglSwapBuffers(EGLRuntime::display, EGLRuntime::surface);
/* Limit to 100 fps. */
#ifdef _WIN32
Sleep(10);
#else
usleep(10000);
#endif
}
/*
* stop myAHRS+
*/
sensor.stop();
/* End of event loop.
The window has been closed.
The only thing we should do now is a clean up. */
/* Delete the cube map texture. */
GL_CHECK(glDeleteTextures(1, &cubemap_texture));
/* Release shaders. */
GL_CHECK(glUseProgram(0));
GL_CHECK(glDeleteShader(vert_shader_id));
GL_CHECK(glDeleteShader(frag_shader_id));
GL_CHECK(glDeleteProgram(program_id));
/* Shut down EGL. */
EGLRuntime::terminateEGL();
/* Shut down windowing system. */
platform->destroyWindow();
/* Shut down the Platform object. */
delete platform;
return 0;
}