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


C++ GLMatrixStack::rotateTo方法代码示例

本文整理汇总了C++中GLMatrixStack::rotateTo方法的典型用法代码示例。如果您正苦于以下问题:C++ GLMatrixStack::rotateTo方法的具体用法?C++ GLMatrixStack::rotateTo怎么用?C++ GLMatrixStack::rotateTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GLMatrixStack的用法示例。


在下文中一共展示了GLMatrixStack::rotateTo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DrawWorld

///////////////////////////////////////////////////////////////////////////////
// Draw the scene 
// 
void DrawWorld()
{
	modelViewMatrix.moveTo(0.0f, 0.8f, 0.0f);
	modelViewMatrix.push();
	modelViewMatrix.moveTo(-0.3f, 0.f, 0.0f);
	modelViewMatrix.scaleTo(0.40, 0.8, 0.40);
	modelViewMatrix.rotateTo(50.0, 0.0, 10.0, 0.0);
	glSampleMaski(0, 0x02);
	shaderManager.useStockShader(GLT_SHADER_FLAT, transformPipeline.GetMVPMatrix(), vLtYellow);
	glass1Batch.draw();
	modelViewMatrix.pop();

	modelViewMatrix.push();
	modelViewMatrix.moveTo(0.4f, 0.0f, 0.0f);
	modelViewMatrix.scaleTo(0.5, 0.8, 1.0);
	modelViewMatrix.rotateTo(-20.0, 0.0, 1.0, 0.0);
	glSampleMaski(0, 0x04);
	shaderManager.useStockShader(GLT_SHADER_FLAT, transformPipeline.GetMVPMatrix(), vLtGreen);
	glass2Batch.draw();
	modelViewMatrix.pop();

	modelViewMatrix.push();
	modelViewMatrix.moveTo(1.0f, 0.0f, -0.6f);
	modelViewMatrix.scaleTo(0.3, 0.9, 1.0);
	modelViewMatrix.rotateTo(-40.0, 0.0, 1.0, 0.0);
	glSampleMaski(0, 0x08);
	shaderManager.useStockShader(GLT_SHADER_FLAT, transformPipeline.GetMVPMatrix(), vLtMagenta);
	glass3Batch.draw();
	modelViewMatrix.pop();

	modelViewMatrix.push();
	modelViewMatrix.moveTo(-0.8f, 0.0f, -0.60f);
	modelViewMatrix.scaleTo(0.6, 0.9, 0.40);
	modelViewMatrix.rotateTo(60.0, 0.0, 1.0, 0.0);
	glSampleMaski(0, 0x10);
	shaderManager.useStockShader(GLT_SHADER_FLAT, transformPipeline.GetMVPMatrix(), vLtBlue);
	glass4Batch.draw();
	modelViewMatrix.pop();

	modelViewMatrix.push();
	modelViewMatrix.moveTo(0.1f, 0.0f, 0.50f);
	modelViewMatrix.scaleTo(0.4, 0.9, 0.4);
	modelViewMatrix.rotateTo(205.0, 0.0, 1.0, 0.0);
	glSampleMaski(0, 0x20);
	shaderManager.useStockShader(GLT_SHADER_FLAT, transformPipeline.GetMVPMatrix(), vLtPink);
	glass4Batch.draw();
	modelViewMatrix.pop();
}
开发者ID:zijuan0810,项目名称:supberbile5,代码行数:51,代码来源:10_oit.cpp

示例2: DrawSongAndDance

// called to draw dancing objects
static void DrawSongAndDance(GLfloat yRot)
{
	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
	M3DMatrix44f mCamera;
	modelViewMatrix.GetMatrix(mCamera);
	M3DVector4f vLightTransformed;
	m3dTransformVector4(vLightTransformed, vLightPos, mCamera);

	// draw the light source
	modelViewMatrix.push();
	modelViewMatrix.moveTo(vLightPos);
	shaderManager.useStockShader(GLT_SHADER_FLAT, transformPipeline.GetMVPMatrix(),
								vWhite);
	sphereBatch.draw();

	modelViewMatrix.pop();

	glBindTexture(GL_TEXTURE_2D, uiTextures[2]);
	for (int i = 0; i < NUM_SPHERES; ++i) {
		modelViewMatrix.push();

		modelViewMatrix.MultMatrix(spheres[i]);
		shaderManager.useStockShader(GLT_SHADER_TEXTURE_POINT_LIGHT_DIFF,
									modelViewMatrix.GetMatrix(),
									transformPipeline.GetProjectionMatrix(),
									vLightTransformed,
									vWhite,
									0);
		sphereBatch.draw();

		modelViewMatrix.pop();
	}

	// song and dance
	modelViewMatrix.moveTo(0.0f, 0.2f, -2.5f);
	modelViewMatrix.push();	// save the translated origin
	modelViewMatrix.rotateTo(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.pop();	// erased the rotate

	modelViewMatrix.rotateTo(yRot * -2.0f, 0.0f, 1.0f, 0.0f);
	modelViewMatrix.moveTo(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();
}
开发者ID:zijuan0810,项目名称:supberbile5,代码行数:65,代码来源:07_TextureRect.cpp

示例3: RenderScene

/**
 * Called to draw scene
 */
void RenderScene(void)
{
	// Bind the FBO with multisample buffers
	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, msFBO);
	glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	// User selected order independant transparency
	if (mode == USER_OIT)
	{
		// Use OIT, setup sample masks
		glSampleMaski(0, 0x01);
		glEnable(GL_SAMPLE_MASK);

		// Prevent depth test from culling covered surfaces
		glDepthFunc(GL_ALWAYS);
	}

	modelViewMatrix.push();
	M3DMatrix44f mCamera;
	cameraFrame.GetCameraMatrix(mCamera);
	modelViewMatrix.MultMatrix(mCamera);

	modelViewMatrix.push();
	modelViewMatrix.moveTo(0.0f, -0.4f, -4.0f);
	modelViewMatrix.rotateTo(worldAngle, 0.0, 1.0, 0.0);

	// Draw the background and disk to the first sample
	modelViewMatrix.push();
	modelViewMatrix.moveTo(0.0f, 3.0f, 0.0f);
	modelViewMatrix.rotateTo(90.0, 1.0, 0.0, 0.0);
	modelViewMatrix.rotateTo(90.0, 0.0, 0.0, 1.0);
	glBindTexture(GL_TEXTURE_2D, textures[1]);
	shaderManager.useStockShader(GLT_SHADER_TEXTURE_REPLACE, transformPipeline.GetMVPMatrix(), 0);
	bckgrndCylBatch.draw();
	modelViewMatrix.pop();

	modelViewMatrix.moveTo(0.0f, -0.3f, 0.0f);
	modelViewMatrix.push();
	modelViewMatrix.rotateTo(90.0, 1.0, 0.0, 0.0);
	shaderManager.useStockShader(GLT_SHADER_FLAT, transformPipeline.GetMVPMatrix(), vGrey);
	diskBatch.draw();
	modelViewMatrix.pop();
	modelViewMatrix.moveTo(0.0f, 0.1f, 0.0f);

	// User selected blending
	if (mode == USER_BLEND)
	{
		// Setup blend state
		glDisable(GL_DEPTH_TEST);
		glEnable(GL_BLEND);
		switch (blendMode)
		{
		case 1:
			glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
			break;
		case 2:
			glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_DST_ALPHA);
			break;
		case 3:
			glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
			break;
		case 4:
			glBlendFunc(GL_SRC_ALPHA, GL_ONE);
			break;
		case 5:
			glBlendFunc(GL_SRC_ALPHA, GL_DST_COLOR);
			break;
		case 6:
			glBlendFuncSeparate(GL_SRC_ALPHA, GL_DST_ALPHA, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
			break;
		case 7:
			glBlendFuncSeparate(GL_SRC_COLOR, GL_DST_COLOR, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
			break;
		default:
			glDisable(GL_BLEND);
		}
	}

	// Now draw the glass pieces
	DrawWorld();

	modelViewMatrix.pop();
	modelViewMatrix.pop();

	// Clean up all state 
	glDepthFunc(GL_LEQUAL);
	glDisable(GL_BLEND);
	glDisable(GL_SAMPLE_MASK);
	glSampleMaski(0, 0xffffffff);

	// Resolve multisample buffer
	projectionMatrix.push();
	projectionMatrix.setMatrix(orthoMatrix);
	modelViewMatrix.push();
	modelViewMatrix.identity();
	// Setup and Clear the default framebuffer
//.........这里部分代码省略.........
开发者ID:zijuan0810,项目名称:supberbile5,代码行数:101,代码来源:10_oit.cpp


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