Hi T.,
On Wed, 2004-03-03 at 04:12, Tensor G wrote:
> hello,
> i have an OpenSG prj, and i'd like to write a nice logo on the foreground.
> If I were in OpenGL i'd write something like:
>
> glPushMatrix();
> glViewport (0,0,g_w,g_h);
> glMatrixMode (GL_PROJECTION);
>
> glPushMatrix(); //apro la push della matrice di proiezione!!!
> glLoadIdentity();
> glOrtho(-5, 5, -5, 5, -2, 100);
> glMatrixMode (GL_MODELVIEW);
> //glViewport (0,0,640,480);
>
> //glDepthMask( GL_FALSE);
> glColor3f(1,1,1);
>
>
> glBegin (GL_QUADS);
> glVertex2f(0,0);
> glVertex2f(0,50);
> glVertex2f(50,50);
> glVertex2f(50,0);
> glEnd();
>
> glMatrixMode (GL_PROJECTION);
> glPopMatrix(); // se tutto va bene qui c'e la projection di OSG
> glMatrixMode (GL_MODELVIEW);
>
>
> glPopMatrix(); // e qui la model view
> // glDepthMask( GL_TRUE);
>
> at the end of my main loop, so that before drawing the next frame, my app
> just switches to ortho, and renders a GL_QUAD in the upper left screen
> corner. (so i am sure that is is always in the right position and facing).
> May I do something alike in OSG? How? I tried to put the very same code into
> the OpenSG display callback, but nothing happened...
There are many ways to do that. Andreas mentioned one, another is to
open another Viewport with a PassiveBackground and just create the
totally independent scene for your logo. Or you could replace the
ssm->redraw(); and the win->render(); that it is with thte actual code
and insert your drawing before the swap() (which is why you're not
seeing anything when just doing it after ssm->redraw();). You can get
the same effect by using a PassiveWindow, which ignore all context
binding and swapping commands (which also means you have to do them
yourself, which geenrally is not a problem).
So, there are many ways to do this, you just have to pick one. :)
Dirk
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users