Re: OpenGL overwrite example?

New Message Reply Date view Thread view Subject view Author view

Hansong Zhang (zhangh++at++cs.unc.edu)
Wed, 19 Jun 1996 09:30:52 -0400 (EDT)


>
> I'm trying to simulate a HUD by using OpenGL commands in a post_draw
> function. Problem is, I've found a few GL ways of doing this, but it doesn't
> seem to work with OpenGL at all. Here's my code:
>
> ---
> /* Open GL commands. */
> gluOrtho2D(-640.0, 640.0, -512.0, 512.0);

Note that glOrtho (and thus gluOrtho2D) multiplies the current
matrix instead of replacing it as with ortho2 etc in GL. Also
different from ortho2, it operates on the current matrix but not
automatically on the projection matrix. So try adding

glMatrixMode(GL_PROJECTION);
glLoadIdentity();

before calling gluOrtho2D()...

Hansong

> glMatrixMode(GL_MODELVIEW);
> pfPushIdentMatrix();
> pfPushState();
> pfBasicState();
> pfDisable(PFEN_TEXTURE);
> pfDisable(PFEN_LIGHTING);
> pfDisable(PFEN_FOG);
>
> /* This works. */
> /*
> glClearColor(0.0, 0.0, 0.0, 0.0);
> glClear(GL_COLOR_BUFFER_BIT);
> */
>
> /* Draw a red box in the middle of the screen. */
> glColor3f(1.0, 0.0, 0.0);
> glBegin(GL_POLYGON);
> glVertex2f(-10.0, 10.0);
> glVertex2f(10.0, 10.0);
> glVertex2f(10.0, -10.0);
> glVertex2f(-10.0, -10.0);
> glEnd();
> glFlush();
>
> /* Return original state. */
> pfPopState();
> pfPopMatrix();
> ---
>
> Any pointers or (correct) code examples would be appreciated! Also, any way
> to display text in OpenGL? My OpenGL book has no examples of this :-(
>
> Thank you,
>
> jan

- -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- -
Hansong Zhang zhangh++at++cs.unc.edu
Walkthrough Group http://www.cs.unc.edu/~zhangh
Department of Computer Science (919)962-1835 (O)
UNC-Chapel Hill (919)914-3973 (H)

"I create abstract systems from pure information, Albert. I'm
a *programmer*... Quantum nonlocality is a bug." -- God
= == = == = == = == = == = == = == = == = == = == = == = == =

=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer.html
            Submissions: info-performer++at++sgi.com
        Admin. requests: info-performer-request++at++sgi.com


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:53:02 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.