本文整理汇总了C++中Debug::init方法的典型用法代码示例。如果您正苦于以下问题:C++ Debug::init方法的具体用法?C++ Debug::init怎么用?C++ Debug::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Debug
的用法示例。
在下文中一共展示了Debug::init方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MainLoop
// return true to retry later (e.g. after display lost)
static bool MainLoop(bool retryCreate)
{
TextureBuffer * eyeRenderTexture[2] = { nullptr, nullptr };
DepthBuffer * eyeDepthBuffer[2] = { nullptr, nullptr };
ovrGLTexture * mirrorTexture = nullptr;
GLuint mirrorFBO = 0;
ovrHmd HMD;
ovrGraphicsLuid luid;
ovrResult result = ovr_Create(&HMD, &luid);
if (!OVR_SUCCESS(result))
return retryCreate;
ovrHmdDesc hmdDesc = ovr_GetHmdDesc(HMD);
// Setup Window and Graphics
// Note: the mirror window can be any size, for this sample we use 1/2 the HMD resolution
ovrSizei windowSize = { hmdDesc.Resolution.w / 2, hmdDesc.Resolution.h / 2 };
if (!Platform.InitDevice(windowSize.w, windowSize.h, reinterpret_cast<LUID*>(&luid)))
goto Done;
debug.init(debug.VERBOSE);
opengl.init(1600, 700);
GameObject *box = new GameObject(vec3(0, 2, 0), vec3(0, 0, 0), vec3(1, 1, 1));
Model *box_model = new Model();
box_model->autoRotate = true;
//box_model->init_from_obj_file(L"box_red_4d.obj");
box_model->init_from_obj_file(L"hypercube.obj");
box->add_game_component((GameComponent *)box_model);
opengl.init_buffer(box_model->vertexBuffer, box_model->verts4D, GL_ARRAY_BUFFER, GL_DYNAMIC_DRAW);
opengl.init_buffer(box_model->indiciesBuffer, box_model->indices, GL_ELEMENT_ARRAY_BUFFER, GL_STATIC_DRAW);
opengl.bind_vertex_indices(box_model);
scene.add_game_object(box);
GameObject *box1 = new GameObject(vec3(5, 5, 0), vec3(0, 0, 0), vec3(1, 1, 1));
Model *box_model1 = new Model();
box_model1->autoRotate = false;
box_model1->init_from_obj_file(L"hypercube.obj");
//box_model->init_from_obj_file(L"hypercube.obj");
box1->add_game_component((GameComponent *)box_model1);
opengl.init_buffer(box_model1->vertexBuffer, box_model1->verts4D, GL_ARRAY_BUFFER, GL_DYNAMIC_DRAW);
opengl.init_buffer(box_model1->indiciesBuffer, box_model1->indices, GL_ELEMENT_ARRAY_BUFFER, GL_STATIC_DRAW);
opengl.bind_vertex_indices(box_model1);
scene.add_game_object(box1);
// Make eye render buffers
for (int eye = 0; eye < 2; ++eye)
{
ovrSizei idealTextureSize = ovr_GetFovTextureSize(HMD, ovrEyeType(eye), hmdDesc.DefaultEyeFov[eye], 1);
eyeRenderTexture[eye] = new TextureBuffer(HMD, true, true, idealTextureSize, 1, NULL, 1);
eyeDepthBuffer[eye] = new DepthBuffer(eyeRenderTexture[eye]->GetSize(), 0);
if (!eyeRenderTexture[eye]->TextureSet)
{
if (retryCreate) goto Done;
VALIDATE(false, "Failed to create texture.");
}
}
// Create mirror texture and an FBO used to copy mirror texture to back buffer
result = ovr_CreateMirrorTextureGL(HMD, GL_SRGB8_ALPHA8, windowSize.w, windowSize.h, reinterpret_cast<ovrTexture**>(&mirrorTexture));
if (!OVR_SUCCESS(result))
{
if (retryCreate) goto Done;
VALIDATE(false, "Failed to create mirror texture.");
}
// Configure the mirror read buffer
glGenFramebuffers(1, &mirrorFBO);
glBindFramebuffer(GL_READ_FRAMEBUFFER, mirrorFBO);
glFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mirrorTexture->OGL.TexId, 0);
glFramebufferRenderbuffer(GL_READ_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, 0);
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
ovrEyeRenderDesc EyeRenderDesc[2];
EyeRenderDesc[0] = ovr_GetRenderDesc(HMD, ovrEye_Left, hmdDesc.DefaultEyeFov[0]);
EyeRenderDesc[1] = ovr_GetRenderDesc(HMD, ovrEye_Right, hmdDesc.DefaultEyeFov[1]);
// Turn off vsync to let the compositor do its magic
wglSwapIntervalEXT(0);
bool isVisible = true;
// Main loop
while (Platform.HandleMessages())
{
// Keyboard inputs to adjust player orientation
static float Yaw(3.141592f);
if (Platform.Key[VK_LEFT]) Yaw += 0.02f;
if (Platform.Key[VK_RIGHT]) Yaw -= 0.02f;
// Keyboard inputs to adjust player position
static Vector3f Pos2(4.0f,0.0f,-10.0f);
if (Platform.Key['W']||Platform.Key[VK_UP]) Pos2+=Matrix4f::RotationY(Yaw).Transform(Vector3f(0,0,-0.05f));
//.........这里部分代码省略.........