本文整理汇总了C++中Platform::checkWindow方法的典型用法代码示例。如果您正苦于以下问题:C++ Platform::checkWindow方法的具体用法?C++ Platform::checkWindow怎么用?C++ Platform::checkWindow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Platform
的用法示例。
在下文中一共展示了Platform::checkWindow方法的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(glAttachShader(program_id, frag_shader_id));
/* Link the program object. */
GL_CHECK(glLinkProgram(program_id));
/* Indicates the link operation on program was successful. */
GL_CHECK(glGetProgramiv(program_id, GL_LINK_STATUS, &link_status));
if (link_status != GL_TRUE)
{
fprintf(stderr, "Linking a program object has failed.\n");
exit(-1);
}
/* The program object has been successfully linked. Let's use it. */
GL_CHECK(glUseProgram(program_id));
/* Retrieve uniform location for "viewMat" uniform defined in vertex shader. */
location_viewMat = GL_CHECK(glGetUniformLocation(program_id, "viewMat"));
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. */