当前位置: 首页>>代码示例>>C++>>正文


C++ Turtle::SetupRenderingContext方法代码示例

本文整理汇总了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);
	}
}
开发者ID:marksands,项目名称:Themepark,代码行数:86,代码来源:FerrisWheelTextured.cpp


注:本文中的Turtle::SetupRenderingContext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。