Jump to content
  • Advertisement
Sign in to follow this  
igala net

OpenGL A view that displays my entire model?

This topic is 3779 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have seen this FAQs: How can I automatically calculate a view that displays my entire model? http://www.opengl.org/resources/faq/technical/viewing.htm But this code does not run (for me), does any one know where is error on my code? I cannot see any thing on the screen with this code.
void Viewer::initGLES(){
	glClearColor(0.f ,1.0f, 1.0f, 1.f);
	float diam = 1500;
	float zNear = 1.3f;
	float zFar = zNear + diam;
	int cx = 0, cy = 0, cz = 0;
	float left = cx - diam;
	float right = cx + diam;
	float bottom = cy - diam;
	float top = cy + diam;
	float aspect = iScreenWidth / iScreenHeight; // 240 x 320
	if ( aspect < 1.0 ) { // window taller than wide
		bottom /= aspect;
		top /= aspect;
	} else {
		left *= aspect;
		right *= aspect;
	//glOrtho(left, right, bottom, top, zNear, zFar);
	glOrthof(left, right, bottom, top, zNear, zFar);
	//gluLookAt(0., 0., 2.*diam, cx, cy, cz, 0.0, 1.0, 0.0);
void Viewer::drawFP(){
	//glTranslatef            (0,0,-5.f);
	static const GLfloat vertices[3 * 3] =
	     -1000,    1000,    0,
	      1000,   -1000,    0,
	      1000,    1000,    0
	glVertexPointer( 3, GL_FLOAT, 0, vertices );
	glDrawArrays( GL_LINES, 0, 3);
Thanks all,

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!