本文整理汇总了C++中GLMatrixStack::Translatev方法的典型用法代码示例。如果您正苦于以下问题:C++ GLMatrixStack::Translatev方法的具体用法?C++ GLMatrixStack::Translatev怎么用?C++ GLMatrixStack::Translatev使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLMatrixStack
的用法示例。
在下文中一共展示了GLMatrixStack::Translatev方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawWorld
///////////////////////////////////////////////////////////////////////////////
// Draw the scene
//
void DrawWorld(GLfloat yRot)
{
M3DMatrix44f mCamera;
modelViewMatrix.GetMatrix(mCamera);
// Need light position relative to the Camera
M3DVector4f vLightTransformed;
m3dTransformVector4(vLightTransformed, vLightPos, mCamera);
// Draw the light source as a small white unshaded sphere
modelViewMatrix.PushMatrix();
modelViewMatrix.Translatev(vLightPos);
shaderManager.UseStockShader(GLT_SHADER_FLAT, transformPipeline.GetModelViewProjectionMatrix(), vWhite);
sphereBatch.Draw();
modelViewMatrix.PopMatrix();
// Draw stuff relative to the camera
modelViewMatrix.PushMatrix();
modelViewMatrix.Translate(0.0f, 0.2f, -2.5f);
modelViewMatrix.Rotate(yRot, 0.0f, 1.0f, 0.0f);
shaderManager.UseStockShader(GLT_SHADER_POINT_LIGHT_DIFF,
modelViewMatrix.GetMatrix(),
transformPipeline.GetProjectionMatrix(),
vLightTransformed, vGreen, 0);
torusBatch.Draw();
modelViewMatrix.PopMatrix();
}
示例2: drawSun
void drawSun()
{
//draw the sphere batch as a sun
modelViewMatrix.PushMatrix();
modelViewMatrix.Translatev(vLightPosition);
shaderManager.UseStockShader(GLT_SHADER_FLAT,
transformPipeline.GetModelViewProjectionMatrix(),vWhite);
sphereBatch.Draw();
modelViewMatrix.PopMatrix();
}
示例3: DrawWorld
///////////////////////////////////////////////////////////////////////////////
// Draw the scene
//
void DrawWorld(GLfloat yRot)
{
M3DMatrix44f mCamera;
modelViewMatrix.GetMatrix(mCamera);
// Need light position relative to the Camera
M3DVector4f vLightTransformed;
m3dTransformVector4(vLightTransformed, vLightPos, mCamera);
// Draw the light source as a small white unshaded sphere
modelViewMatrix.PushMatrix();
modelViewMatrix.Translatev(vLightPos);
if(bUseFBO)
UseProcessProgram(vLightPos, vWhite, -1);
else
shaderManager.UseStockShader(GLT_SHADER_FLAT, transformPipeline.GetModelViewProjectionMatrix(), vWhite);
sphereBatch.Draw();
modelViewMatrix.PopMatrix();
// Draw stuff relative to the camera
modelViewMatrix.PushMatrix();
modelViewMatrix.Translate(0.0f, 0.2f, -2.5f);
modelViewMatrix.PushMatrix();
modelViewMatrix.Rotate(yRot, 0.0f, 1.0f, 0.0f);
modelViewMatrix.Translate(0.0, (GLfloat)-0.60, 0.0);
modelViewMatrix.Scale((GLfloat)0.02, (GLfloat)0.006, (GLfloat)0.02);
glBindTexture(GL_TEXTURE_2D, ninjaTex[0]);
if(bUseFBO)
{
UseProcessProgram(vLightTransformed, vWhite, 0);
}
else
{
shaderManager.UseStockShader(GLT_SHADER_TEXTURE_REPLACE, transformPipeline.GetModelViewProjectionMatrix(), 0);
}
ninja.Render(0,0);
modelViewMatrix.PopMatrix();
modelViewMatrix.PopMatrix();
}
示例4: DrawSongAndDance
void DrawSongAndDance(GLfloat yRot) // Called to draw dancing objects
{
static GLfloat vWhite[] = { 1.0f, 1.0f, 1.0f, 1.0f };
static GLfloat vLightPos[] = { 0.0f, 3.0f, 0.0f, 1.0f };
// Get the light position in eye space
M3DVector4f vLightTransformed;
M3DMatrix44f mCamera;
modelViewMatrix.GetMatrix(mCamera);
m3dTransformVector4(vLightTransformed, vLightPos, mCamera);
// Draw the light source
modelViewMatrix.PushMatrix();
modelViewMatrix.Translatev(vLightPos);
shaderManager.UseStockShader(GLT_SHADER_FLAT,
transformPipeLine.GetModelViewProjectionMatrix(),
vWhite);
sphereBatch.Draw();
modelViewMatrix.PopMatrix();
glBindTexture(GL_TEXTURE_2D, uiTextures[2]);
for (int i = 0; i < NUM_SPHERES; i++) {
modelViewMatrix.PushMatrix();
modelViewMatrix.MultMatrix(spheres[i]);
shaderManager.UseStockShader(GLT_SHADER_TEXTURE_POINT_LIGHT_DIFF,
modelViewMatrix.GetMatrix(),
transformPipeLine.GetProjectionMatrix(),
vLightTransformed,
vWhite,
0);
sphereBatch.Draw();
modelViewMatrix.PopMatrix();
}
// Song and dance
modelViewMatrix.Translate(0.0f, 0.2f, -2.5f);
modelViewMatrix.PushMatrix(); // Saves the translated origin
modelViewMatrix.Rotate(yRot, 0.0f, 1.0f, 0.0f);
// Draw stuff relative to the camera
glBindTexture(GL_TEXTURE_2D, uiTextures[1]);
shaderManager.UseStockShader(GLT_SHADER_TEXTURE_POINT_LIGHT_DIFF,
modelViewMatrix.GetMatrix(),
transformPipeLine.GetProjectionMatrix(),
vLightTransformed,
vWhite,
0);
torusBatch.Draw();
modelViewMatrix.PopMatrix(); // Erased the rotate
modelViewMatrix.Rotate(yRot * -2.0f, 0.0f, 1.0f, 0.0f);
modelViewMatrix.Translate(0.8f, 0.0f, 0.0f);
glBindTexture(GL_TEXTURE_2D, uiTextures[2]);
shaderManager.UseStockShader(GLT_SHADER_TEXTURE_POINT_LIGHT_DIFF,
modelViewMatrix.GetMatrix(),
transformPipeLine.GetProjectionMatrix(),
vLightTransformed,
vWhite,
0);
sphereBatch.Draw();
}