本文整理汇总了C++中Renderable::Render方法的典型用法代码示例。如果您正苦于以下问题:C++ Renderable::Render方法的具体用法?C++ Renderable::Render怎么用?C++ Renderable::Render使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Renderable
的用法示例。
在下文中一共展示了Renderable::Render方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Render
void OGLWindow::Render()
{
m_skyBox->SetPosition(*m_camera->GetCameraPosition());
m_rotation += 1.0f;
glm::mat4 inv;
float modelview[16];
Renderable* prenderable = static_cast<Renderable*>(m_mesh);
Renderable* plane = static_cast<Renderable*>(m_plane);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
m_skyBoxShader->ActivateShaderProgram();
glGetFloatv(GL_MODELVIEW_MATRIX, modelview);
glUniformMatrix4fv(0, 1, GL_FALSE, modelview);
glUniformMatrix4fv(1, 1, GL_FALSE, &m_camera->GetProjectionMatrix()[0][0]);
glUniformMatrix4fv(3, 1, GL_FALSE, &m_camera->GetViewMatrix()[0][0]);
//Camera position to vertex shader
glm::vec3 camPosition = *m_camera->GetCameraPosition();
glUniform4f(4, camPosition[0], camPosition[1], camPosition[2], 1.0f);
glDisable(GL_DEPTH_TEST);
m_skyBox->Render();
glEnable(GL_DEPTH_TEST);
m_shader->ActivateShaderProgram();
glTranslatef( -148.0f, 8.0f, -10.0f );
glRotatef(0.20f, 0.0f, 1.0f, 0.0f);
/*glRotatef( m_euler[1], 0.0, 1.0, 0.0 );
glRotatef( m_euler[2], 0.0, 0.0, 1.0 );*/
glGetFloatv( GL_MODELVIEW_MATRIX, modelview );
glUniformMatrix4fv(0, 1, GL_FALSE, modelview);
glUniformMatrix4fv(1, 1, GL_FALSE, &m_camera->GetProjectionMatrix()[0][0]);
glUniformMatrix4fv(3, 1, GL_FALSE, &m_camera->GetViewMatrix()[0][0]);
inv = glm::inverseTranspose(glm::mat4(modelview[0]));
glUniformMatrix4fv(10, 1, GL_FALSE, &inv[0][0]);
camPosition = *m_camera->GetCameraPosition();
glUniform4f(4, camPosition[0], camPosition[1], camPosition[2], 1.0f);
prenderable->Render();
//load terrain
glLoadIdentity();
glTranslatef(0.0f, -300.0f, 0.0f);
glGetFloatv(GL_MODELVIEW_MATRIX, modelview);
glUniformMatrix4fv(0, 1, GL_FALSE, modelview);
inv = glm::inverseTranspose(glm::mat4(modelview[0]));
glUniformMatrix4fv(10, 1, GL_FALSE, &inv[0][0]);
m_terrain->Render();
//load plane
glLoadIdentity();
glTranslatef(20.0f, 200.0f, 100.0f);
glRotatef(m_rotation, 0.5f, 1.0f, 0.0f);
glTranslatef(0.5f, -100.0f, -200.0f);
glGetFloatv(GL_MODELVIEW_MATRIX, modelview);
glUniformMatrix4fv(0, 1, GL_FALSE, modelview);
inv = glm::inverseTranspose(glm::mat4(modelview[0]));
glUniformMatrix4fv(10, 1, GL_FALSE, &inv[0][0]);
plane->Render();
KeyPress();
POINT mouse;
GetCursorPos(&mouse);
int xPos = mouse.x;
int yPos = mouse.y;
int xAxis = (m_width / 2) - xPos;
int yAxis = (m_height / 2) - yPos;
//smoothes the look sensitivity
float i = 0.05f;
//.........这里部分代码省略.........