• Advertisement


This topic is now archived and is closed to further replies.

Help me settup up a ortho screen

This topic is 5137 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

Please help me settup a ortho screen Here is important code: GLvoid ReSizeGLScene(GLsizei width, GLsizei height) // Resize And Initialize The GL Window { if (height==0) // Prevent A Divide By Zero By { height=1; // Making Height Equal One } glViewport(0, 0, width, height); // Reset The Current Viewport glMatrixMode(GL_PROJECTION); // Select The Projection Matrix glLoadIdentity(); // Reset The Projection Matrix // Calculate The Aspect Ratio Of The Window gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f); glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix glLoadIdentity(); // Reset The Modelview Matrix } int InitGL(GLvoid) // All Setup For OpenGL Goes Here { bool status=true; LoadGLTexture(); glEnable(GL_TEXTURE_2D); glShadeModel(GL_SMOOTH); // Enables Smooth Shading = Anti-allias glClearColor(0.0f, 0.0f, 0.0f, 0.5f); // Black Background glClearDepth(1.0f); // Depth Buffer Setup glEnable(GL_DEPTH_TEST); // Enables Depth Testing glDepthFunc(GL_LEQUAL); // The Type Of Depth Test To Do glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Really Nice Perspective Calculations glColor4f(1.0f,1.0f,1.0f,0.5f); glBlendFunc(GL_SRC_ALPHA,GL_ONE); glDisable(GL_BLEND); return status; } int DrawGLScene(GLvoid) // Here''s Where We Do All The Drawing { bool status=true; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer glLoadIdentity(); // Reset The Current Modelview Matrix // Camera Translations glTranslatef(x,y,z); // Translate our scene // Camera Rotation glRotatef(rotx,1.0f,0.0f,0.0f); glRotatef(roty,0.0f,1.0f,0.0f); glRotatef(rotz,0.0f,0.0f,1.0f); glColor3f(1,1,1); glBegin(GL_QUADS); glVertex3f(-1,-1,0.0f); glVertex3f(1,-1,1.0f); glVertex3f(1,1,0.0f); glVertex3f(-1,1.0f,0.0f); glEnd; DrawSprite(-3,-3,3,3,8,8,fr); // DrawSprite(-1,-1,1,1,16,16,fr); //rotz+=1.0f; fr++; if (fr == 18) fr = 0; return status; }

Share this post

Link to post
Share on other sites

  • Advertisement