Before you draw the FPS you'll need to reset the projection matrix. Use
glOrtho to do this.
For example:
glViewport(0, 0, width, height)
glMatrixMode(gl.GL_PROJECTION)
glLoadIdentity()
glOrtho(0, width, 0, height, -1, 1)
glMatrixMode(gl.GL_MODELVIEW)
--- Rod
On Feb 8, 2008 6:44 AM, Mark Melvin <[EMAIL PROTECTED]> wrote:
>
> OK, my first problem, but it is probably because I am an OpenGL noob.
> ;) I thought it would be neat to display the FPS on my samples but no
> matter what I do I can't seem to get it to appear. It seems that if I
> do not wire up my "on_resize" function that sets up my OpenGL viewport
> and perspective, the FPS display shows up (but my geometry - a simple
> spinning triangle - doesn't appear). But if I hook up my on_resize
> function to my window so I can see my geometry, the FPS display is
> never rendered.
>
> Here is my on_resize() function:
>
> def on_resize(width, height):
> if height == 0:
> height = 1
>
> glViewport(0, 0, width, height) # reset the viewport to new
> dimensions
> glMatrixMode(GL_PROJECTION) # set projection matrix current
> matrix
> glLoadIdentity() # reset projection matrix
>
> # calculate aspect ratio of window
> gluPerspective(52.0, width/height, 1.0, 1000.0)
>
> glMatrixMode(GL_MODELVIEW) # set modelview matrix
> glLoadIdentity() # reset modelview matrix
>
>
> Sorry if this is obvious to everyone else and I just need to go and
> learn more about perspective and projection matrices. If you can't
> tell, I'm an OpenGL noob...
>
> Thanks,
> M.
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---