本文整理汇总了C++中Turtle::SetupRenderingContext方法的典型用法代码示例。如果您正苦于以下问题:C++ Turtle::SetupRenderingContext方法的具体用法?C++ Turtle::SetupRenderingContext怎么用?C++ Turtle::SetupRenderingContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Turtle
的用法示例。
在下文中一共展示了Turtle::SetupRenderingContext方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetupRenderingContext
void SetupRenderingContext()
{
int i, j;
// Initialze Shader Manager
shaderManager.InitializeStockShaders();
glEnable(GL_DEPTH_TEST);
//glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClearColor(0.94f, 0.94f, 1.0f, 1.0f); // Blue Sky
/* ------------- */
/* Scene objects */
track.SetupRenderingContext();
theWheel.SetupRenderingContext();
carousel.SetupRenderingContext();
unicorn.SetupRenderingContext();
ostrich.SetupRenderingContext();
turtle.SetupRenderingContext();
/* --------------- */
/* Make the ground */
GLfloat texSize = 50.0f;
groundBatch.Begin(GL_TRIANGLE_FAN, 4, 1);
groundBatch.MultiTexCoord2f(0, 0.0f, 0.0f);
groundBatch.Vertex3f(-0.5f * FLOOR_GRID_WIDTH, FLOOR_HEIGHT, 0.5f * FLOOR_GRID_WIDTH);
groundBatch.MultiTexCoord2f(0, texSize, 0.0f);
groundBatch.Vertex3f(0.5f * FLOOR_GRID_WIDTH, FLOOR_HEIGHT, 0.5f * FLOOR_GRID_WIDTH);
groundBatch.MultiTexCoord2f(0, texSize, texSize);
groundBatch.Vertex3f(0.5f * FLOOR_GRID_WIDTH, FLOOR_HEIGHT, -0.5f * FLOOR_GRID_WIDTH);
groundBatch.MultiTexCoord2f(0, 0.0f, texSize);
groundBatch.Vertex3f(-0.5f * FLOOR_GRID_WIDTH, FLOOR_HEIGHT, -0.5f * FLOOR_GRID_WIDTH);
groundBatch.End();
/* ------------------------------- */
/* Make texture object for ground. */
glGenTextures(1, &groundTexture);
glBindTexture(GL_TEXTURE_2D, groundTexture);
LoadBMPTexture(GROUND_TEXTURE_FILENAME, GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR, GL_REPEAT);
/* ----------------------------- */
/* Make texture objects for cap. */
glGenTextures(NBR_TEXTURE_SETS, capTexture);
for ( i = 0; i < NBR_TEXTURE_SETS; i++ )
{
glBindTexture(GL_TEXTURE_2D, capTexture[i]);
LoadBMPTexture(CAP_TEXTURE_FILENAME[i], GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR, GL_CLAMP_TO_EDGE);
}
/* ------------------------------------------ */
/* Make texture objects for wheel components. */
glGenTextures(NBR_WHEEL_TEXTURES, wheelTexture);
for ( i = 0; i < NBR_WHEEL_TEXTURES; i++ )
{
glBindTexture(GL_TEXTURE_2D, wheelTexture[i]);
LoadBMPTexture(WHEEL_TEXTURE_FILENAME[i], GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR, GL_CLAMP_TO_EDGE);
}
/* ------------------------------------------------ */
/* Make texture objects for Ferris wheel car walls. */
for ( i = 0; i < NBR_TEXTURE_SETS; i++ )
{
glGenTextures(NBR_WALL_TEXTURES, wallTexture[i]);
for ( j = 0; j < NBR_WALL_TEXTURES; j++ )
{
glBindTexture(GL_TEXTURE_2D, wallTexture[i][j]);
LoadBMPTexture(WALL_TEXTURE_FILENAME[i][j], GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR, GL_CLAMP_TO_EDGE);
}
}
/* ---------------------------------------- */
/* Make texture objects for car components. */
glGenTextures(NBR_CAR_TEXTURES, carTexture);
for ( i = 0; i < NBR_CAR_TEXTURES; i++ )
{
glBindTexture(GL_TEXTURE_2D, carTexture[i]);
LoadBMPTexture(CAR_TEXTURE_FILENAME[i], GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR, GL_CLAMP_TO_EDGE);
}
}