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


C++ Matrix4d::getPointer方法代码示例

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


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

示例1: RenderGrid

void GraphicsManager::RenderGrid(){
	// Clear errors upon entering.
	GLuint error = glGetError();
	// Draw awesome grid for debugging, yo.
	if (true){
		glEnable(GL_DEPTH_TEST);
		ShadeMan.SetActiveShader(0);
		glMatrixMode(GL_PROJECTION);
		glLoadMatrixd(graphicsState->projectionMatrixD.getPointer());
		glMatrixMode(GL_MODELVIEW);
		graphicsState->modelMatrix.LoadIdentity(); // Don't inherit model from entities....
		Matrix4d modelView = graphicsState->viewMatrixD * graphicsState->modelMatrixD;
		glLoadMatrixd(modelView.getPointer());
		// Enable blending
		glEnable(GL_BLEND);	
		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
		float z = -4;
		glDisable(GL_TEXTURE_2D);
		glBindTexture(GL_TEXTURE_2D, 0);
		graphicsState->currentTexture = NULL;
		// Disable lighting
		glDisable(GL_LIGHTING);
		error = glGetError();
		if (error != GL_NO_ERROR){
			PRINT_ERROR
		}
		glDisable(GL_COLOR_MATERIAL);
		// Specifies how the red, green, blue and alpha source blending factors are computed
		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
		error = glGetError();
		if (error != GL_NO_ERROR){
			PRINT_ERROR
		}
		glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
	//	glEnable(GL_LINE_STIPPLE);
		glLineStipple(1, 0x0101);
		glLineWidth(1.0f);
		// Do grid, yo.
		float spacing = graphicsState->gridSpacing; // 10.0f;
		int gridSize = graphicsState->gridSize; // 20;
		float start = -gridSize / 2 * spacing;
		for (int i = 0; i < gridSize; ++i){
			float x = i * spacing + start, x2 = (i+1) * spacing + start;
			for (int j = 0; j < gridSize; ++j){
				float z = j * spacing + start, z2 = (j+1) * spacing + start;
				glBegin(GL_QUADS);
					glColor4f(0.6f,0.4f,0.5f, 1);
					glVertex3f(x,	0,	z);
					glVertex3f(x2,	0,	z);
					glVertex3f(x2,	0,	z2);
					glVertex3f(x,	0,	z2);
				glEnd();
			}
		}
	
		
		glBegin(GL_TRIANGLES);
		glColor3f(1,0,0);
		glVertex3f(10, 0, 0);
		glColor3f(0,1,0);	
		glVertex3f(0, 10, 0);
		glColor3f(0,0,1);	
		glVertex3f(0, 0, 10);
		glEnd();

		error = glGetError();
		if (error != GL_NO_ERROR){
			PRINT_ERROR
		}
	}
开发者ID:erenik,项目名称:engine,代码行数:70,代码来源:RenderGrid.cpp


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