![]() |
|
[A5 + OpenGL] Drawing an overlay over 3-D |
Chris Katko
Member #1,881
January 2002
![]() |
I've got a bunch of 3-D routines now, and they work decent now. However, I can no longer directly draw to the screen. Whatever quad Allegro draws to is transformed off into oblivion somewhere. Do I figure I need to reset some matrices so that Allegro can draw to the correct place. However, I'm not sure what to set them to. Thanks in advance, [off-topic ordeals? A habit I guess!] -----sig: |
Trezker
Member #1,739
December 2001
![]() |
Here's how I do it. I push old projection matrix before going into 3D mode, then pop it to get back allegro's setup. 1void Init_perspective_view(float fov, float aspect, float near, float far)
2{
3 glMatrixMode(GL_PROJECTION);
4 glPushMatrix();
5 glLoadIdentity();
6 gluPerspective(fov, aspect, near, far);
7 glMatrixMode(GL_MODELVIEW);
8 glLoadIdentity();
9}
10
11void Pop_view()
12{
13 //Return to Allegros 2D world
14 glMatrixMode(GL_PROJECTION);
15 glPopMatrix();
16 glMatrixMode(GL_MODELVIEW);
17 glLoadIdentity();
18}
|
Thomas Fjellstrom
Member #476
June 2000
![]() |
You might want to use this stuff to switch back and forth. At least it'd be a bit easier. And then you know it should be saving and restoring all state that allegro may need. -- |
furinkan
Member #10,271
October 2008
![]() |
I've only the faintest idea what I'm talking about here, but I'm pretty sure there is a function to retrieve a matrix that is in use. You will have to find out how to store the matrix Allegro uses for projection, do your 3d stuff, then restore the matrix before drawing with allegro. You will probably have to (manually?) set any GL states you may have changed. [EDIT] |
|