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


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

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


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

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

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

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

示例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);
    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

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

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

示例7: SetupRC

void SetupRC() {
	glEnable(GL_DEPTH_TEST);
	glClearColor(1.0f, 1.0f, 1.0f, 1.0f);

	shader = gltLoadShaderPairWithAttributes("pass_thru_shader.vp", "pass_thru_shader.fp", 
		2, GLT_ATTRIBUTE_VERTEX, "vVertex", GLT_ATTRIBUTE_NORMAL, "vNormal");
	fprintf(stdout, "GLT_ATTRIBUTE_VERTEX : %d\nGLT_ATTRIBUTE_NORMAL : %d \n",
            GLT_ATTRIBUTE_VERTEX, GLT_ATTRIBUTE_NORMAL);
	
	MVMatrixLocation = glGetUniformLocation(shader, "MVMatrix");
	if(MVMatrixLocation == -1) {
		fprintf(stdout, "Hej ho, hej ho, uniformy nie dzia³aj¹ MVMatrix\n");
	}

	PMatrixLocation = glGetUniformLocation(shader, "PMatrix");
	if(PMatrixLocation == -1) {
		fprintf(stdout, "Hej ho, hej ho, uniformy nie dzia³aj¹ PMatrix\n");
	}

	ambientLightLocation = glGetUniformLocation(shader, "ambientLight");

	light.positionLocation = glGetUniformLocation(shader, "light1.position");
	light.colorLocation = glGetUniformLocation(shader, "light1.color");
	light.angleLocation = glGetUniformLocation(shader, "light1.angle");
	light.attenuation0Location = glGetUniformLocation(shader, "light1.attenuation0");
	light.attenuation1Location = glGetUniformLocation(shader, "light1.attenuation1");
	light.attenuation2Location = glGetUniformLocation(shader, "light1.attenuation2");

	small_light.positionLocation = glGetUniformLocation(shader, "light2.position");
	small_light.colorLocation = glGetUniformLocation(shader, "light2.color");
	small_light.angleLocation = glGetUniformLocation(shader, "light2.angle");
	small_light.attenuation0Location = glGetUniformLocation(shader, "light2.attenuation0");
	small_light.attenuation1Location = glGetUniformLocation(shader, "light2.attenuation1");
	small_light.attenuation2Location = glGetUniformLocation(shader, "light2.attenuation2");

	material.ambientColorLocation = glGetUniformLocation(shader, "material.ambientColor");
	material.diffuseColorLocation = glGetUniformLocation(shader, "material.diffuseColor");
	material.specularColorLocation = glGetUniformLocation(shader, "material.specularColor");
	material.specularExponentLocation = glGetUniformLocation(shader, "material.specularExponent");

	viewFrustum.SetPerspective(15.0f,(float)800.0/(float)600.0,0,1000);

	glGenBuffers(1,&vertex_buffer);
	glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer);

	readVertices();
	glBufferData(GL_ARRAY_BUFFER,n_vertices*sizeof(float)*7,&ico_vertices[0],GL_STATIC_DRAW);
	glVertexAttribPointer(GLT_ATTRIBUTE_VERTEX,4,GL_FLOAT,GL_FALSE,sizeof(float)*7,(const GLvoid *)0);
	glVertexAttribPointer(GLT_ATTRIBUTE_NORMAL,3,GL_FLOAT,GL_FALSE,sizeof(float)*7,(const GLvoid *)(4*sizeof(float)) );

	glEnableVertexAttribArray(GLT_ATTRIBUTE_VERTEX);
	glEnableVertexAttribArray(GLT_ATTRIBUTE_NORMAL);

	glGenBuffers(1,&faces_buffer);
	glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,faces_buffer);
	readFaces();
	glBufferData(GL_ELEMENT_ARRAY_BUFFER,n_faces*sizeof(GLuint)*3,&ico_faces[0],GL_STATIC_DRAW);
	
}
开发者ID:Dehtre,项目名称:PPG,代码行数:59,代码来源:Shadery_05a.cpp

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

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

示例10: changeSize

void changeSize(int w, int h)
{
	glViewport(0, 0, w, h);

	if(h <= 0) {h = 1;}

	viewFrustum.SetPerspective(35.0f, float(w)/float(h), 1.0f, 100.0f);
	projectionStack.LoadMatrix(viewFrustum.GetProjectionMatrix());
	tPipeline.SetMatrixStacks(modelViewStack, projectionStack);
}
开发者ID:Errim,项目名称:Datorsalsplaneraren,代码行数:10,代码来源:main.cpp

示例11: ChangeSize

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);

    viewFrustum.SetPerspective(35.0f, float(w)/float(h), 1.0f, 1000.0f);
  }
开发者ID:greidy,项目名称:chernobylite,代码行数:11,代码来源:PointSprites.cpp

示例12: ResizeWindow

void ResizeWindow(int nWidth, int nHeight)
{
	glViewport(0, 0, nWidth, nHeight);

	// Create the projection matrix, and load it on the projection matrix stack
	viewFrustum.SetPerspective(FRUSTUM_FIELD_OF_VIEW, float(nWidth)/float(nHeight), FRUSTUM_NEAR_PLANE, FRUSTUM_FAR_PLANE);
	projectionMatrix.LoadMatrix(viewFrustum.GetProjectionMatrix());

	// Set the transformation pipeline to use the two matrix stacks 
	transformPipeline.SetMatrixStacks(modelViewMatrix, projectionMatrix);
}
开发者ID:marksands,项目名称:Themepark,代码行数:11,代码来源:FerrisWheelTextured.cpp

示例13: ChangeSize

///////////////////////////////////////////////////
// Screen changes size or is initialized
void ChangeSize(int nWidth, int nHeight)
    {
	glViewport(0, 0, nWidth, nHeight);
	
    // Create the projection matrix, and load it on the projection matrix stack
	viewFrustum.SetPerspective(35.0f, float(nWidth)/float(nHeight), 1.0f, 100.0f);
	projectionMatrix.LoadMatrix(viewFrustum.GetProjectionMatrix());
    
    // Set the transformation pipeline to use the two matrix stacks 
	transformPipeline.SetMatrixStacks(modelViewMatrix, projectionMatrix);
    }
开发者ID:CodeBees,项目名称:OpenGLSuperBible5ANGLE,代码行数:13,代码来源:SphereWorld3.cpp

示例14: ChangeSize

void ChangeSize(int w, int h) {

	GLfloat nRange = 500.0f;
	windowWidth = w;
	windowHeight = h;

	// Verhindere eine Division durch Null
	if (h == 0) {
		h = 1;
	}
	// Setze den Viewport gemaess der Window-Groesse
	glViewport(0, 0, w, h);
	// Ruecksetzung des Projection matrix stack
	projectionMatrix.LoadIdentity();

	if (bPerspectiveProj) {
		// Definiere das viewing volume (left, right, bottom, top, near, far)
		if (w <= h) {
			viewFrustum.SetPerspective(30.0f, h/w, 1, 3000);
		}
		else {
			viewFrustum.SetPerspective(30.0f, w / h, 1, 3000);
		}
	}

	else {
		// Definiere das viewing volume (left, right, bottom, top, near, far)
		if (w <= h) {
			viewFrustum.SetOrthographic(-nRange, nRange, -nRange*h / w, nRange*h / w, -nRange, nRange);
		}
		else {
			viewFrustum.SetOrthographic(-nRange*w / h, nRange*w / h, -nRange, nRange, -nRange, nRange);
		}
	}

	projectionMatrix.LoadMatrix(viewFrustum.GetProjectionMatrix());
	// Ruecksetzung des Model view matrix stack
	modelViewMatrix.LoadIdentity();

	TwWindowSize(w, h);
}
开发者ID:HibikiTaisuna,项目名称:CGBV,代码行数:41,代码来源:Versuch1c.cpp

示例15: ChangeSize

void ChangeSize(int w, int h)
{
	if (h <= 0)
	{
		h = 1;
	}

	glViewport(0, 0, w, h);
	viewFrustum.SetPerspective(80.0f, float(w) / float(h), 1.0f, 120.0f);
	projctionMatrix.LoadMatrix(viewFrustum.GetProjectionMatrix());
	transformPipeLine.SetMatrixStacks(modelViewMatrix, projctionMatrix);
}
开发者ID:wjingzhe,项目名称:OpenGL_SB5_static,代码行数:12,代码来源:Tunnel.cpp


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