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


C++ GLFrustum::GetProjectionMatrix方法代码示例

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


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

示例1: RenderScene

///////////////////////////////////////////////////
// Called to draw scene
void RenderScene(void)
    {		        
    // Clear the window
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
         
    // Everything is white
    GLfloat vWhite [] = { 1.0f, 1.0f, 1.0f, 1.0f };
#ifndef OPENGL_ES
    shaderManager.UseStockShader(GLT_SHADER_FLAT, viewFrustum.GetProjectionMatrix(), vWhite);
    
    // Draw small stars
    glPointSize(1.0f);
#else
	glUseProgram(pointSizeShader);
	GLint iTransform, iColor, iPointSize;
	iTransform = glGetUniformLocation(pointSizeShader, "mvpMatrix");
	glUniformMatrix4fv(iTransform, 1, GL_FALSE, viewFrustum.GetProjectionMatrix());

	iColor = glGetUniformLocation(pointSizeShader, "vColor");
	glUniform4fv(iColor, 1, vWhite);

	iPointSize = glGetUniformLocation(pointSizeShader, "fPointSize");
	glUniform1f(iPointSize, 1.0f);
#endif
    smallStarBatch.Draw();
            
    // Draw medium sized stars
#ifdef OPENGL_ES
	iPointSize = glGetUniformLocation(pointSizeShader, "fPointSize");
	glUniform1f(iPointSize, 4.0f);
#else
    glPointSize(4.0f);
#endif
	mediumStarBatch.Draw();
    
    // Draw largest stars
#ifdef OPENGL_ES
	iPointSize = glGetUniformLocation(pointSizeShader, "fPointSize");
	glUniform1f(iPointSize, 8.0f);
#else
    glPointSize(8.0f);
#endif
    largeStarBatch.Draw();
        
    // Draw the "moon"
    moonBatch.Draw();

    // Draw distant horizon
    glLineWidth(3.5);
    mountainRangeBatch.Draw();
    
    moonBatch.Draw();

    // Swap buffers
    glutSwapBuffers();
    }
开发者ID:CodeBees,项目名称:OpenGLSuperBible5ANGLE,代码行数:58,代码来源:Smoother.cpp

示例2: RenderScene

///////////////////////////////////////////////////
// Called to draw scene
void RenderScene(void)
    {		        
	static CStopWatch timer;

    // Clear the window
    glClear(GL_COLOR_BUFFER_BIT);
         
    // Everything is white
    GLfloat vWhite [] = { 1.0f, 1.0f, 1.0f, 1.0f };

	glBindTexture(GL_TEXTURE_2D, starTexture);
	glUseProgram(starFieldShader);
    glUniformMatrix4fv(locMVP, 1, GL_FALSE, viewFrustum.GetProjectionMatrix());
    glUniform1i(locStarTexture, 0);
    
	// Draw small stars
    glPointSize(4.0f);
    smallStarBatch.Draw();
            
    // Draw medium sized stars
    glPointSize(8.0f);
    mediumStarBatch.Draw();
    
    // Draw largest stars
    glPointSize(12.0f);
    largeStarBatch.Draw();
        
    // Draw distant horizon
	shaderManager.UseStockShader(GLT_SHADER_FLAT, viewFrustum.GetProjectionMatrix(), vWhite);
    glLineWidth(3.5);
    mountainRangeBatch.Draw();
    
	// Draw the "moon"
	glBindTexture(GL_TEXTURE_2D_ARRAY, moonTexture);
	glUseProgram(moonShader);
    glUniformMatrix4fv(locMoonMVP, 1, GL_FALSE, viewFrustum.GetProjectionMatrix());
    glUniform1i(locMoonTexture, 0);

	// fTime goes from 0.0 to 28.0 and recycles
	float fTime = timer.GetElapsedSeconds();
	fTime = fmod(fTime, 28.0f);
    glUniform1f(locTimeStamp, fTime);

    moonBatch.Draw();


    // Swap buffers
    glutSwapBuffers();

	glutPostRedisplay();
    }
开发者ID:hanwj,项目名称:myStudy,代码行数:53,代码来源:TextureArrays.cpp

示例3: ChangeSize

  void ChangeSize(int w, int h){
    if(h == 0)  { h = 1; }
    glViewport(0, 0, w, h);      
    viewFrustum.SetPerspective(35.0f, float(w)/float(h), 1.0f, 1000.0f);
    projection.LoadMatrix(viewFrustum.GetProjectionMatrix());
	geometryPipeline.SetMatrixStacks(modelView, projection);
   }
开发者ID:openglJK,项目名称:opengl,代码行数:7,代码来源:Buffors.cpp

示例4: RenderScene

// Called to draw scene
void RenderScene(void)
  {
  static CStopWatch timer;

  // Clear the window and the depth buffer
  glClear(GL_COLOR_BUFFER_BIT);

    // Turn on additive blending
  glEnable(GL_BLEND);
  glBlendFunc(GL_ONE, GL_ONE);

    // Let the vertex program determine the point size
  glEnable(GL_PROGRAM_POINT_SIZE);

    // Bind to our shader, set uniforms
    glUseProgram(starFieldShader);
    glUniformMatrix4fv(locMVP, 1, GL_FALSE, viewFrustum.GetProjectionMatrix());
    glUniform1i(locTexture, 0);

  // fTime goes from 0.0 to 999.0 and recycles
  float fTime = timer.GetElapsedSeconds() * 10.0f;
  fTime = fmod(fTime, 999.0f);
    glUniform1f(locTimeStamp, fTime);

    // Draw the stars
    starsBatch.Draw();

    glutSwapBuffers();
  glutPostRedisplay();
  }
开发者ID:greidy,项目名称:chernobylite,代码行数:31,代码来源:PointSprites.cpp

示例5: 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);
    viewFrustum.SetPerspective(35.0f, float(w) / float(h), 1.0f, 500.0f);
    projectionMatrix.LoadMatrix(viewFrustum.GetProjectionMatrix());
    modelViewMatrix.LoadIdentity();
}
开发者ID:1085075003,项目名称:oglsuperbible5,代码行数:10,代码来源:Block_redux.cpp

示例6: GetViewProjectionMatrix

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

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

示例7: ChangeSize

///////////////////////////////////////////////////////////////////////////////
// This is called at least once and before any rendering occurs. If the screen
// is a resizeable window, then this will also get called whenever the window
// is resized.
void ChangeSize(int nWidth, int nHeight)
{
	glViewport(0, 0, nWidth, nHeight);
	transformPipeline.SetMatrixStacks(modelViewMatrix, projectionMatrix);
 
	viewFrustum.SetPerspective(35.0f, float(nWidth)/float(nHeight), 1.0f, 100.0f);
	projectionMatrix.LoadMatrix(viewFrustum.GetProjectionMatrix());
	modelViewMatrix.LoadIdentity();

	// update screen sizes
	screenWidth = nWidth;
	screenHeight = nHeight;

	glBindRenderbuffer(GL_RENDERBUFFER, depthBufferName);
#ifndef ANGLE
	glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT32, screenWidth, screenHeight);
#else
	glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, screenWidth, screenHeight);
#endif
	glBindRenderbuffer(GL_RENDERBUFFER, renderBufferNames[0]);
	glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, screenWidth, screenHeight);
	glBindRenderbuffer(GL_RENDERBUFFER, renderBufferNames[1]);
	glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, screenWidth, screenHeight);
	glBindRenderbuffer(GL_RENDERBUFFER, renderBufferNames[2]);
	glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, screenWidth, screenHeight);
}
开发者ID:CodeBees,项目名称:OpenGLSuperBible5ANGLE,代码行数:30,代码来源:fbo_drawbuffers.cpp

示例8: ChangeSize

///////////////////////////////////////////////////////////////////////////////
// This is called at least once and before any rendering occurs. If the screen
// is a resizeable window, then this will also get called whenever the window
// is resized.
void ChangeSize(int nWidth, int nHeight)
{
	glViewport(0, 0, nWidth, nHeight);
	transformPipeline.SetMatrixStacks(modelViewMatrix, projectionMatrix);
 	viewFrustum.SetPerspective(35.0f, float(nWidth)/float(nHeight), 1.0f, 100.0f);
	projectionMatrix.LoadMatrix(viewFrustum.GetProjectionMatrix());
	modelViewMatrix.LoadIdentity();

	// update screen sizes
	screenWidth = nWidth;
	screenHeight = nHeight;

	// reset screen aligned quad
	gltGenerateOrtho2DMat(screenWidth, screenHeight, orthoMatrix, screenQuad);

	free(pixelData);
	pixelDataSize = screenWidth*screenHeight*3*sizeof(unsigned int);
	pixelData = (void*)malloc(pixelDataSize);

	//  Resize PBOs
#ifndef OPENGL_ES
	glBindBuffer(GL_PIXEL_PACK_BUFFER, pixBuffObjs[0]);
	glBufferData(GL_PIXEL_PACK_BUFFER, pixelDataSize, pixelData, GL_DYNAMIC_COPY);
	glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
#endif

	gltCheckErrors();
}
开发者ID:CodeBees,项目名称:OpenGLSuperBible5ANGLE,代码行数:32,代码来源:pix_buffs.cpp

示例9: 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

示例10: changeSize

void changeSize(int w, int h)
{
    if (h == 0) h = 1;
    glViewport(0, 0, w, h);
    frustum.SetPerspective(35, (float)w/h, 1, 100);
    projectionM.LoadMatrix(frustum.GetProjectionMatrix());
}
开发者ID:tailnode,项目名称:chaos,代码行数:7,代码来源:main.cpp

示例11: 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

示例12: RenderScene

///////////////////////////////////////////////////
// Called to draw scene
void RenderScene(void)
    {		        
    // Clear the window
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
         
    // Everything is white
    GLfloat vWhite [] = { 1.0f, 1.0f, 1.0f, 1.0f };
    shaderManager.UseStockShader(GLT_SHADER_FLAT, viewFrustum.GetProjectionMatrix(), vWhite);
    
    // Draw small stars
    glPointSize(1.0f);
    smallStarBatch.Draw();
            
    // Draw medium sized stars
    glPointSize(4.0f);
    mediumStarBatch.Draw();
    
    // Draw largest stars
    glPointSize(8.0f);
    largeStarBatch.Draw();
        
    // Draw the "moon"
    moonBatch.Draw();

    // Draw distant horizon
    glLineWidth(3.5);
    mountainRangeBatch.Draw();
    
    moonBatch.Draw();

    // Swap buffers
    glutSwapBuffers();
    }
开发者ID:coolsee,项目名称:opengl,代码行数:35,代码来源:Smoother.cpp

示例13: 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);
	viewFrustum.SetPerspective(35.0f, float(w) / float(h), 1.0f, 500.0f);
	projectionMatrix.LoadMatrix(viewFrustum.GetProjectionMatrix());
    transformPipeline.SetMatrixStacks(modelViewMatrix, projectionMatrix);
	}
开发者ID:1085075003,项目名称:oglsuperbible5,代码行数:10,代码来源:Pyramid.cpp

示例14: ChangeSize

void ChangeSize(int nWidth, int nHeight)
    {
	glViewport(0, 0, nWidth, nHeight);
	transformPipeline.SetMatrixStacks(modelViewMatrix, projectionMatrix);
	
	viewFrustum.SetPerspective(35.0f, float(nWidth)/float(nHeight), 1.0f, 100.0f);
	projectionMatrix.LoadMatrix(viewFrustum.GetProjectionMatrix());
	modelViewMatrix.LoadIdentity();
	}
开发者ID:1085075003,项目名称:oglsuperbible5,代码行数:9,代码来源:SphereWorld.cpp

示例15: Reshape

void Reshape(int w,int h)
{
	if(h == 0) h = 1;
	glViewport(0,0,w,h);

	viewFrustum.SetPerspective(35.0,(float) w /(float) h,1.0,2000.0);
	projectionMatrix.LoadMatrix(viewFrustum.GetProjectionMatrix());
	transformPipeLine.SetMatrixStacks(modelViewMatrix,projectionMatrix);
}
开发者ID:Narsiss,项目名称:workspace,代码行数:9,代码来源:FbxReader.cpp


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