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


C++ GLFrame::GetCameraMatrix方法代码示例

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


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

示例1: Display

void Display()
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
	
	static CStopWatch timer;
	GLfloat yRot = timer.GetElapsedSeconds()*20.0f;

	GLfloat vWhite[] = {1.0f,1.0f,1.0f,1.0f};
	GLfloat vLightPos[] = {0.0f,2.0f,2.0f};
	GLfloat vAmbient[] = {0.3f,0.3f,1.0f,1.0f};
	modelViewMatrix.PushMatrix();
		//move to camera view
		M3DMatrix44f mCamera;
		cameraFrame.GetCameraMatrix(mCamera);
		modelViewMatrix.MultMatrix(mCamera);

		modelViewMatrix.PushMatrix();
		modelViewMatrix.Rotate(yRot,1.0,1.0,1.0);
		glBindTexture(GL_TEXTURE_2D,fbxTexture);
		shaderManager.UseStockShader(GLT_SHADER_TEXTURE_POINT_LIGHT_DIFF, 
                                     transformPipeLine.GetModelViewMatrix(),
                                     transformPipeLine.GetProjectionMatrix(), 
                                     vLightPos, vWhite, 0);
		//*/shaderManager.UseStockShader(GLT_SHADER_FLAT, transformPipeLine.GetModelViewProjectionMatrix(),vWhite);
		modelViewMatrix.Scale(0.05,0.05,0.05);
		rTest.DrawReader();

		modelViewMatrix.PopMatrix();
	modelViewMatrix.PopMatrix();

	glutSwapBuffers();
	glutPostRedisplay();
}
开发者ID:Narsiss,项目名称:workspace,代码行数:33,代码来源:FbxReader.cpp

示例2: RenderScene

void RenderScene(void) {
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
	glEnable( GL_DEPTH_TEST ) ;
	glUseProgram(shader);
	glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);

	float angle = timer.GetElapsedSeconds();

	M3DVector3f eye = {cos(angle)*4.0f,sin(angle)*4.0,sin(angle)*4.0f}; 
	M3DVector3f at = {0,0,0}; 
	M3DVector3f up = {0.0f,0.0f,1.0f};

	GLFrame cameraFrame;
	LookAt(cameraFrame, eye, at, up);
	cameraFrame.GetCameraMatrix(cameraMatrix);
	
	m3dMatrixMultiply44(matrix, viewFrustum.GetProjectionMatrix(), cameraMatrix);

	M3DMatrix44f tMatrix;
	m3dTranslationMatrix44(tMatrix, 0, 0, 0);
	m3dMatrixMultiply44(matrix, tMatrix, matrix);

	if((sin(angle) < 0 && sin(angle-0.003) > 0) || (sin(angle) > 0 && sin(angle-0.003) < 0)) {
		debugMatrix44(matrix);
	}

	glUniformMatrix4fv(MVPMatrixLocation,1,GL_FALSE,matrix);

//	drawGrid(0.1);
	drawPyramid();

	glutSwapBuffers();
	glutPostRedisplay();
}
开发者ID:rodriger,项目名称:Procesory-graficzne,代码行数:34,代码来源:piramida1.cpp

示例3: RenderScene

void RenderScene(void)
{

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
	
	modelViewMatrix.PushMatrix();

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

	glUseProgram(myShader);
	//mWcgCube.Draw(locMVP, modelViewMatrix, transformPipeline);

	mWcgCube.DrawRotate(0, 30, locMVP, modelViewMatrix, transformPipeline);
	//glUniformMatrix4fv(locMVP, 1, GL_FALSE, transformPipeline.GetModelViewProjectionMatrix());

	
	
	
	//cubeBatch.Draw();
	//sphereBatch.Draw();
	//triangleBatch.Draw();

	modelViewMatrix.PopMatrix();

	glutSwapBuffers();

	glutPostRedisplay();
	
}
开发者ID:wdlove58,项目名称:WcgCube,代码行数:32,代码来源:main.cpp

示例4: render

void render()
{
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
  
  glUseProgram(shader);
  
  updateCamera();
  
  GLGeometryTransform geometryPipeline;
  GLMatrixStack modelViewStack;
  GLMatrixStack projectionStack;
  geometryPipeline.SetMatrixStacks(modelViewStack, projectionStack);
  projectionStack.LoadMatrix(frustum.GetProjectionMatrix());
  M3DMatrix44f cameraMatrix;
  frame.GetCameraMatrix(cameraMatrix);
  modelViewStack.PushMatrix(cameraMatrix);
  
  glUniformMatrix4fv(projectionMatrixLocation, 1, GL_FALSE, geometryPipeline.GetProjectionMatrix());
  glUniformMatrix4fv(modelViewMatrixLocation, 1, GL_FALSE, geometryPipeline.GetModelViewMatrix());
  glUniformMatrix4fv(normalMatrixLocation, 1, GL_FALSE, geometryPipeline.GetNormalMatrix());
  
  modelViewStack.PushMatrix();
  modelViewStack.Translate(0.0, 1.0, 0.0);
  glUniformMatrix4fv(projectionMatrixLocation, 1, GL_FALSE, geometryPipeline.GetProjectionMatrix());
  glUniformMatrix4fv(modelViewMatrixLocation, 1, GL_FALSE, geometryPipeline.GetModelViewMatrix());
  glUniformMatrix4fv(normalMatrixLocation, 1, GL_FALSE, geometryPipeline.GetNormalMatrix());
  glDrawElements(GL_TRIANGLES, 3 * n_faces, GL_UNSIGNED_INT, 0);
  modelViewStack.PopMatrix();
  
  glutSwapBuffers();
  glutPostRedisplay();
}
开发者ID:konradoo,项目名称:PPG,代码行数:32,代码来源:main.cpp

示例5: RenderScene

void RenderScene()
{
	static GLfloat vSunColor[] = { 1.0f, 0.0f, 0.0f, 1.0f };
	static GLfloat vEarthColor[] = { 0.0f, 0.0f, 1.0f, 1.0f };
	static GLfloat vMoonColor[] = { 1.0f, 1.0f, 0.0f, 1.0f };
	static GLfloat vFloorColor[] = { 0.0f, 1.0f, 0.0f, 1.0f};

	static CStopWatch rotTimer;
	float yRot = rotTimer.GetElapsedSeconds() * 60.0f;

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	modelViewMatrix.PushMatrix();	

	M3DMatrix44f mCamera;
	cameraFrame.GetCameraMatrix(mCamera);
	modelViewMatrix.PushMatrix(mCamera);

	M3DVector4f vLightPos = { 0.0f, 10.0f, 5.0f, 1.0f };
	M3DVector4f vLightEyePos;
	m3dTransformVector4(vLightEyePos, vLightPos, mCamera);

	shaderManager.UseStockShader(GLT_SHADER_FLAT,
		transformPipeline.GetModelViewProjectionMatrix(),
		vFloorColor);	
	floorBatch.Draw();    

	glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);

	modelViewMatrix.Translate(0.0f, 0.0f, -3.5f);

	modelViewMatrix.PushMatrix();

	modelViewMatrix.Rotate(yRot, 0.0f, 1.0f, 0.0f);
	shaderManager.UseStockShader(GLT_SHADER_FLAT, 
		transformPipeline.GetModelViewProjectionMatrix(), vSunColor);
	sunSphereBatch.Draw();
	modelViewMatrix.PopMatrix(); 

	modelViewMatrix.Rotate(yRot * -2.0f, 0.0f, 1.0f, 0.0f);
	modelViewMatrix.Translate(0.8f, 0.0f, 0.0f);
	shaderManager.UseStockShader(GLT_SHADER_FLAT, 
		transformPipeline.GetModelViewProjectionMatrix(), vEarthColor);
	earthSphereBatch.Draw();

	modelViewMatrix.Rotate(yRot * -4.0f, 0.0f, 1.0f, 0.0f);
	modelViewMatrix.Translate(0.4f, 0.0f, 0.0f);
	shaderManager.UseStockShader(GLT_SHADER_FLAT, 
		transformPipeline.GetModelViewProjectionMatrix(), vMoonColor);
	moonSphereBatch.Draw();

	modelViewMatrix.PopMatrix();
	modelViewMatrix.PopMatrix();    
	modelViewMatrix.PopMatrix();   


	glutSwapBuffers();

	glutPostRedisplay();
}
开发者ID:hxssgaa,项目名称:opengl2015,代码行数:60,代码来源:ConsoleApplication1.cpp

示例6: GetViewProjectionMatrix

void GetViewProjectionMatrix(float *viewProjectionMatrix)
{	
	M3DMatrix44f viewMatrix;
	cameraFrame.GetCameraMatrix(viewMatrix);

	m3dMatrixMultiply44(viewProjectionMatrix, viewFrustum.GetProjectionMatrix(), viewMatrix);
}
开发者ID:tbprojects,项目名称:pkg,代码行数:7,代码来源:excercise4.cpp

示例7: RenderScene

///////////////////////////////////////////////////////////////////////////////
// Called to draw scene
void RenderScene(void)
	{    
    static GLfloat vLightPos [] = { 1.0f, 1.0f, 0.0f };
    static GLfloat vWhite [] = { 1.0f, 1.0f, 1.0f, 1.0f };
    
	// Clear the window with current clearing color
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);

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

        M3DMatrix44f mObjectFrame;
        objectFrame.GetMatrix(mObjectFrame);
        modelViewMatrix.MultMatrix(mObjectFrame);

        glBindTexture(GL_TEXTURE_2D, textureID);
        shaderManager.UseStockShader(GLT_SHADER_TEXTURE_POINT_LIGHT_DIFF, 
                                     transformPipeline.GetModelViewMatrix(),
                                     transformPipeline.GetProjectionMatrix(), 
                                     vLightPos, vWhite, 0);

        pyramidBatch.Draw();

		
	modelViewMatrix.PopMatrix();

	// Flush drawing commands
	glutSwapBuffers();
    }
开发者ID:1085075003,项目名称:oglsuperbible5,代码行数:33,代码来源:Pyramid.cpp

示例8: RenderScene

///////////////////////////////////////////////////////////////////////////////
// Called to draw scene
void RenderScene(void)
    {
    // Clear the window with current clearing color
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);

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

        M3DMatrix44f mObjectFrame;
        objectFrame.GetMatrix(mObjectFrame);
        modelViewMatrix.MultMatrix(mObjectFrame);

        shaderManager.UseStockShader(GLT_SHADER_FLAT, transformPipeline.GetModelViewProjectionMatrix(), vBlack);

        switch(nStep) {
            case 0:
                glPointSize(4.0f);
                pointBatch.Draw();
                glPointSize(1.0f);
                break;
            case 1:
                glLineWidth(2.0f);
                lineBatch.Draw();
                glLineWidth(1.0f);
                break;
            case 2:
                glLineWidth(2.0f);
                lineStripBatch.Draw();
                glLineWidth(1.0f);
                break;
            case 3:
                glLineWidth(2.0f);
                lineLoopBatch.Draw();
                glLineWidth(1.0f);
                break;
            case 4:
                DrawWireFramedBatch(&triangleBatch);
                break;
            case 5:
                DrawWireFramedBatch(&triangleStripBatch);
                break;
            case 6:
                DrawWireFramedBatch(&triangleFanBatch);
                break;
            }

    modelViewMatrix.PopMatrix();

    // Flush drawing commands
    glutSwapBuffers();
    }
开发者ID:Shedward,项目名称:zone51,代码行数:55,代码来源:main.cpp

示例9: RenderScene

// Called to draw scene
void RenderScene(void)
    {
    // Clear the window
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        
    M3DMatrix44f mCamera;
    M3DMatrix44f mCameraRotOnly;
	M3DMatrix44f mInverseCamera;
    
    viewFrame.GetCameraMatrix(mCamera, false);
    viewFrame.GetCameraMatrix(mCameraRotOnly, true);
	m3dInvertMatrix44(mInverseCamera, mCameraRotOnly);

    modelViewMatrix.PushMatrix();    
        // Draw the sphere
        modelViewMatrix.MultMatrix(mCamera);
        glUseProgram(reflectionShader);
        glUniformMatrix4fv(locMVPReflect, 1, GL_FALSE, transformPipeline.GetModelViewProjectionMatrix());
        glUniformMatrix4fv(locMVReflect, 1, GL_FALSE, transformPipeline.GetModelViewMatrix());
        glUniformMatrix3fv(locNormalReflect, 1, GL_FALSE, transformPipeline.GetNormalMatrix());
		glUniformMatrix4fv(locInvertedCamera, 1, GL_FALSE, mInverseCamera);
		glUniform1i(locCubeMap, 0);
		glUniform1i(locTarnishMap, 1);

		glEnable(GL_CULL_FACE);
        sphereBatch.Draw();
		glDisable(GL_CULL_FACE);
	modelViewMatrix.PopMatrix();

	modelViewMatrix.PushMatrix();
	    modelViewMatrix.MultMatrix(mCameraRotOnly);
		glUseProgram(skyBoxShader);
		glUniformMatrix4fv(locMVPSkyBox, 1, GL_FALSE, transformPipeline.GetModelViewProjectionMatrix());
		cubeBatch.Draw();       
    modelViewMatrix.PopMatrix();
        
    // Do the buffer Swap
    glutSwapBuffers();
    }
开发者ID:marblep,项目名称:OpenGL,代码行数:40,代码来源:MultiTexture.cpp

示例10: DrawScene

void DrawScene()
{
	modelViewMatrix.PushMatrix();	
		M3DMatrix44f mCamera;
		cameraFrame.GetCameraMatrix(mCamera);

		// Transform the light position into eye coordinates
		M3DVector4f vLightPos = { LIGHT_POSITION[0], LIGHT_POSITION[1], LIGHT_POSITION[2], LIGHT_POSITION[3] };
		M3DVector4f vLightEyePos;
		m3dTransformVector4(vLightEyePos, vLightPos, mCamera);

    /* ------------ */
    /* FERRIS WHEEL */

    modelViewMatrix.PushMatrix();
        /* Position the ferris wheel appropriately. */
      modelViewMatrix.Translate(FERRIS_WHEEL_POSITION[0], FERRIS_WHEEL_POSITION[1], FERRIS_WHEEL_POSITION[2]);

      /* Apply the Translation to this entire block of objects */
      modelViewMatrix.PushMatrix();
        //theWheel.Draw(modelViewMatrix, shaderManager, transformPipeline, vLightEyePos, capTexture, wheelTexture, wallTexture, carTexture, currentTextureIndex);
      modelViewMatrix.PopMatrix();

    modelViewMatrix.PopMatrix();

    /* -------------- */
    /* ROLLER COASTER */

    modelViewMatrix.PushMatrix();
      modelViewMatrix.Translate(0.0, 0.0, -10.0);
      //track.Draw(modelViewMatrix, shaderManager, transformPipeline, vLightEyePos);
    modelViewMatrix.PopMatrix();

    /* -------- */
    /* CAROUSEL */  

    modelViewMatrix.PushMatrix();
      //modelViewMatrix.Translate(3.0f, 0.0f, -3.0f);
      modelViewMatrix.Translate(0.0f, 0.0f, -3.0f);
      //carousel.Draw(modelViewMatrix, shaderManager, transformPipeline, vLightEyePos);
    modelViewMatrix.PopMatrix();

    modelViewMatrix.PushMatrix();
      modelViewMatrix.Translate(0.0f, 0.0f, -2.0f);
      //unicorn.Draw(modelViewMatrix, shaderManager, transformPipeline, vLightEyePos);
      //ostrich.Draw(modelViewMatrix, shaderManager, transformPipeline, vLightEyePos);
      turtle.Draw(modelViewMatrix, shaderManager, transformPipeline, vLightEyePos);
    modelViewMatrix.PopMatrix();

	modelViewMatrix.PopMatrix();
}
开发者ID:marksands,项目名称:Themepark,代码行数:51,代码来源:FerrisWheelTextured.cpp

示例11: render_scene

void render_scene(void) {
    float angle = timer.GetElapsedSeconds() * 3.14f / 10.0f;
    location[0] = -8.0f * cos(angle / 2.0f);
    location[1] = -8.0f * sin(angle / 2.0f);
    location[2] = 5.0f;
    light_0.position[0] = 10.0f * cos(-angle);
    light_0.position[1] = 10.0f * sin(-angle);
    light_0.position[2] = 3.0f;
    look_at(camera_frame, location, target, up_dir);
    camera_frame.GetCameraMatrix(camera_matrix);
    p_stack.LoadMatrix(view_frustum.GetProjectionMatrix());
    mv_stack.LoadMatrix(camera_matrix);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
    //--
    glUseProgram(shader_color);
    mv_stack.PushMatrix();
    mv_stack.Translate(light_0.position[0], light_0.position[1], light_0.position[2]);
    mv_stack.Scale(0.25f, 0.25f, 0.25f);
    glUniformMatrix4fv(mvp_matrix_location_shader_color, 1, GL_FALSE, geometry_pipeline.GetModelViewProjectionMatrix());
    draw_light();
    mv_stack.PopMatrix();
    //--
    glUseProgram(shader_light);
    glUniformMatrix3fv(normal_matrix_location, 1, GL_FALSE, geometry_pipeline.GetNormalMatrix());
    glUniformMatrix4fv(v_matrix_location, 1, GL_FALSE, camera_matrix);
    glUniform3fv(intensity_ambient_component_location, 1, intensity_ambient_component);
    glUniform3fv(light_0_position_location, 1, light_0.position);
    glUniform3fv(light_0_intensity_diffuse_location, 1, light_0.intensity_diffuse);
    glUniform3fv(light_0_intensity_specular_location, 1, light_0.intensity_specular);
    glUniform3fv(light_0_attenuation_location, 1, light_0.attenuation);
    glUniform1f(material_0_ka_location, material_0.ka);
    glUniform1f(material_0_kd_location, material_0.kd);
    glUniform1f(material_0_ks_location, material_0.ks);
    glUniform1f(material_0_alpha_location, material_0.alpha);
    //--
    for(int i = -10; i <= 10; i += 3)
        for(int j = -10; j <= 10; j += 3) {
            mv_stack.PushMatrix();
            mv_stack.Translate(i, j, 0.0f);
            glUniformMatrix4fv(mvp_matrix_location, 1, GL_FALSE, geometry_pipeline.GetModelViewProjectionMatrix());
            glUniformMatrix4fv(mv_matrix_location, 1, GL_FALSE, geometry_pipeline.GetModelViewMatrix());
            glDrawElements(GL_TRIANGLES, faces.size(), GL_UNSIGNED_INT, 0);
            mv_stack.PopMatrix();
        }
    //--
    glUseProgram(0);
    glutSwapBuffers();
    glutPostRedisplay();
}
开发者ID:diunao,项目名称:procesory,代码行数:49,代码来源:main.cpp

示例12: RenderScene

// Called to draw scene
void RenderScene(void)
{
    static CStopWatch	rotTimer;
    float yRot = rotTimer.GetElapsedSeconds() * 60.0f;
    
    
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    
    modelViewMatrix.PushMatrix();
    M3DMatrix44f mCamera;
    cameraFrame.GetCameraMatrix(mCamera);
    modelViewMatrix.MultMatrix(mCamera);
    
    // Draw the world upside down
    modelViewMatrix.PushMatrix();
    modelViewMatrix.Scale(1.0f, -1.0f, 1.0f); // Flips the Y Axis
    modelViewMatrix.Translate(0.0f, 0.8f, 0.0f); // Scootch the world down a bit...
    glFrontFace(GL_CW);
    DrawSongAndDance(yRot);
    glFrontFace(GL_CCW);
    modelViewMatrix.PopMatrix();
    
    // Draw the solid ground
    glEnable(GL_BLEND);
    glBindTexture(GL_TEXTURE_2D, uiTextures[0]);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    static GLfloat vFloorColor[] = { 1.0f, 1.0f, 1.0f, 0.75f};
    shaderManager.UseStockShader(GLT_SHADER_TEXTURE_MODULATE,
                                 transformPipeline.GetModelViewProjectionMatrix(),
                                 vFloorColor,
                                 0);
    
    floorBatch.Draw();
    glDisable(GL_BLEND);
    
    
    DrawSongAndDance(yRot);
    
    modelViewMatrix.PopMatrix();
    
    
    // Do the buffer Swap
    glutSwapBuffers();
    
    // Do it again
    glutPostRedisplay();
}
开发者ID:1019459067,项目名称:iOS9_OC_Learning,代码行数:48,代码来源:main.cpp

示例13: RenderScene

void RenderScene(void) {
	M3DMatrix44f CameraMatrix;
    M3DMatrix44f ViewProjectionMatrix;
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
   
	glUseProgram(shader);

	cameraFrame.GetCameraMatrix(CameraMatrix);
	frame.GetMatrix(ProjectionMatrix);
	m3dMatrixMultiply44(ViewProjectionMatrix,ProjectionMatrix,CameraMatrix);
	glUniformMatrix4fv(MVPMatrixLocation,1,GL_FALSE,ViewProjectionMatrix);

	glBegin(GL_QUADS);
		glVertexAttrib3f(GLT_ATTRIBUTE_COLOR, 0.5, 0.5, 0.5);
		glVertex3f(-1.0f, 1.0f, 0.0f);
		glVertex3f(-1.0f,-1.0f, 0.0f);
		glVertex3f( 1.0f,-1.0f, 0.0f);
		glVertex3f( 1.0f, 1.0f, 0.0f);
	glEnd();

	glBegin(GL_TRIANGLES);
		glVertexAttrib3f(GLT_ATTRIBUTE_COLOR, 1.0, 1.0, 0.0);
		glVertex3f(0.0, 0.0, 2.0);
		glVertex3f(-1.0, 1.0, 0.0);
		glVertex3f(-1.0, -1.0, 0.0);
		glVertexAttrib3f(GLT_ATTRIBUTE_COLOR, 1.0, 0.0, 0.0);
		glVertex3f(0.0, 0.0, 2.0);
		glVertex3f(-1.0, -1.0, 0.0);
		glVertex3f(1.0, -1.0, 0.0);

		glVertexAttrib3f(GLT_ATTRIBUTE_COLOR, 0.0, 1.0, 0.0);
		glVertex3f(0.0, 0.0, 2.0);
		glVertex3f(1.0, -1.0, 0.0);
		glVertex3f(1.0, 1.0, 0.0);

		glVertexAttrib3f(GLT_ATTRIBUTE_COLOR, 0.0, 0.0, 1.0);
		glVertex3f(0.0, 0.0, 2.0);
		glVertex3f(1.0, 1.0, 0.0);
		glVertex3f(-1.0, 1.0, 0.0);
    glEnd();
	
	glutSwapBuffers();
	//cameraFrame.RotateLocalZ(0.01);  //Obrót kamery
	glutPostRedisplay();

}
开发者ID:Jerzu,项目名称:piramida,代码行数:46,代码来源:piramida.cpp

示例14: RenderScene

///////////////////////////////////////////////////////////////////////////////
// Called to draw scene
void RenderScene(void)
	{
	// Clear the window with current clearing color
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);

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

		// Reflection step... draw cube upside down, the floor
		// blended on top of it
		if(nStep == 5) {
			glDisable(GL_CULL_FACE);
			modelViewMatrix.PushMatrix();
			modelViewMatrix.Scale(1.0f, -1.0f, 1.0f);
			modelViewMatrix.Translate(0.0f, 2.0f, 0.0f);
			modelViewMatrix.Rotate(35.0f, 0.0f, 1.0f, 0.0f);
			RenderBlock();
			modelViewMatrix.PopMatrix();
			glEnable(GL_BLEND);
			glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
			RenderFloor();
			glDisable(GL_BLEND);			
			}


		modelViewMatrix.PushMatrix();

			// Draw normally
			modelViewMatrix.Rotate(35.0f, 0.0f, 1.0f, 0.0f);
			RenderBlock();
		modelViewMatrix.PopMatrix();
		
		
	// If not the reflection pass, draw floor last
	if(nStep != 5)
		RenderFloor();

		
	modelViewMatrix.PopMatrix();


	// Flush drawing commands
	glutSwapBuffers();
	}
开发者ID:codingabc,项目名称:sb5code,代码行数:48,代码来源:Block.cpp

示例15: RenderScene

void RenderScene(void) {
    // Clear the window with current clearing color
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);

    glUseProgram(shader);
	glEnable(GL_CULL_FACE);
	glFrontFace(GL_CW);

	CStopWatch timer;
	float angle = timer.GetElapsedSeconds()*3.14f;

	M3DVector3f mAt={0,0,0};
	M3DVector3f mUp={0,0,1};
	M3DVector3f mEye;

	mEye[0]=6.8f*cos(angle);
	mEye[1]=6.0f*sin(angle);
	mEye[2]=5.0f; 
	LookAt(mFrame,mEye,mAt,mUp);
	mFrame.GetCameraMatrix(mCameraMatrix);

	matrixStack.LoadMatrix(mFrustrum.GetProjectionMatrix());
	matrixStack.MultMatrix(mCameraMatrix);

	glUniformMatrix4fv(MVPMatrixLocation, 1, GL_FALSE, matrixStack.GetMatrix());

	drawGrid();

	matrixStack.Translate(1.0f,7.0f,0.0f);
	matrixStack.Rotate(30.0f,0.0,0.0,1.0);
	glUniformMatrix4fv(MVPMatrixLocation,1,GL_FALSE,matrixStack.GetMatrix());
	drawPyramid();

	matrixStack.PopMatrix();
	matrixStack.Translate(-7.0f,0.0f,0.0f);
	matrixStack.Scale(2.0f, 2.0f, 2.0f);
	glUniformMatrix4fv(MVPMatrixLocation,1,GL_FALSE,matrixStack.GetMatrix());
	drawPyramid();

	matrixStack.PopMatrix();

	// Perform the buffer swap to display back buffer
    glutSwapBuffers();
	glutPostRedisplay();
}
开发者ID:mateuszbartczak,项目名称:PPG1,代码行数:45,代码来源:triangle.cpp


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