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


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

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


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

示例1: ChangeSize

/**
 * Window has changed size, or has just been created. In either case, we need to use the window 
 * dimensions to set the viewport and the projection matrix.
 */
void ChangeSize(int w, int h)
{
	glViewport(0, 0, w, h);

	transformPipeline.setMatrixStacks(modelViewMatrix, projectionMatrix);

	viewFrustum.setPerspective(35.0f, float(w) / float(h), 1.0f, 100.0f);
	projectionMatrix.setMatrix(viewFrustum.GetProjectionMatrix());
	modelViewMatrix.identity();
}
开发者ID:zijuan0810,项目名称:supberbile5,代码行数:14,代码来源:07_TextureRect.cpp

示例2: RenderScene

/**
 * Called to draw scene
 */
void RenderScene(void)
{
	static CStopWatch animationTimer;
	float yRot = animationTimer.delta() * 60.0f;

	// first, draw to FBO at full FBO resolution

	// bind FBO with 8b attachment
	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fboName);
	glViewport(0, 0, hdrTexturesWidth[curHDRTex], hdrTexturesHeight[curHDRTex]);
	glClear(GL_COLOR_BUFFER_BIT);

	// bind texture with HDR image
	glBindTexture(GL_TEXTURE_2D, hdrTextures[curHDRTex]);

	// render pass, downsample to 8b using selected program
	projectionMatrix.setMatrix(fboOrthoMatrix);
	SetupHDRProg();
	fboQuad.draw();

	// then draw the resulting image to the screen, maintain image proporions
	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
	glViewport(0, 0, screenWidth, screenHeight);
	glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);

	// attach 8b texture with HDR image
	glBindTexture(GL_TEXTURE_2D, fboTextures[0]);

	// draw screen sized, proportional quad with 8b texture
	projectionMatrix.setMatrix(orthoMatrix);
	SetupStraightTexProg();
	screenQuad.draw();

	// Perform the buffer swap to display back buffer
	glutSwapBuffers();
	glutPostRedisplay();
}
开发者ID:zijuan0810,项目名称:supberbile5,代码行数:40,代码来源:09_hdr_imaging.cpp

示例3: ChangeSize

/**
 * Window has changed size, or has just been created. In either case, we need to use the window 
 * dimensions to set the viewport and the projection matrix.
 */
void ChangeSize(int w, int h)
{
	// Prevent a divide by zero
	if ( h == 0 ) {
		h = 1;
	}

	// Set viewport to window dimensions
	glViewport(0, 0, w, h);

	GLfloat fAspect = (GLfloat)w/(GLfloat)h;
	// Produce the perspective projection
	viewFrustum.setPerspective(80.0f, fAspect, 1.0f, 120.0f);
	projectionMatrix.setMatrix(viewFrustum.GetProjectionMatrix());
	transformPipeline.setMatrixStacks(modelViewMatrix, projectionMatrix);
}
开发者ID:zijuan0810,项目名称:supberbile5,代码行数:20,代码来源:05_Tunnel.cpp

示例4: ChangeSize

/**
 * Window has changed size, or has just been created. In either case, we need to use the window 
 * dimensions to set the viewport and the projection matrix.
 */
void ChangeSize(int w, int h)
{
	glViewport(0, 0, w, h);
	transformPipeline.setMatrixStacks(modelViewMatrix, projectionMatrix);

	viewFrustum.setPerspective(35.0f, float(w) / float(h), 1.0f, 100.0f);
	projectionMatrix.setMatrix(viewFrustum.GetProjectionMatrix());
	modelViewMatrix.identity();

	GenerateOrtho2DMat(w, h);

	screenWidth = w;
	screenHeight = h;

	// resize texture
	glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, depthTextureName);
	glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, 8, GL_DEPTH_COMPONENT24, w, h, GL_FALSE);

	glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, msTexture[0]);
	glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, 8, GL_RGBA8, w, h, GL_FALSE);
}
开发者ID:zijuan0810,项目名称:supberbile5,代码行数:25,代码来源:10_oit.cpp

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