RE: [Plib-users] Newbie Question: Mixing SSG & OpenGL
Brought to you by:
sjbaker
From: Stanford N. <st...@th...> - 2002-05-15 12:59:05
|
Thanks for the pointers! After much digging under the hood of my program, I'm still encountering problems with mixing SSG & OpenGL. I've narrowed it down to the ssgCullAndDraw() call influencing the GL state somehow. When I comment out ssgCullAndDraw() in my redraw routine, the draw_water() works fine, drawing a blue rectangle. When I leave the call in there, the rectangle is still drawn, but it is very dark and blends right into the background. I'm trying to puzzle out what ssgCullAndDraw() is doing that would affect the standard OpenGL stuff... I'm still quite a novice when it comes to these things. If someone could explain things, I'd much appreciate it! Thanks in advance! -- stan << CODE SNIPPETS FOR REFERENCE >> void redraw() { update_game() ; glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); ssgCullAndDraw( scene ); draw_water(); draw_text(); glutPostRedisplay(); glutSwapBuffers(); } void draw_water() { glMatrixMode( GL_PROJECTION ); glPushMatrix(); glLoadIdentity(); glMatrixMode( GL_MODELVIEW ); glPushMatrix(); glLoadIdentity(); GLfloat lmodel_ambient[] = { 0.8, 0.8, 0.8, 1.0 }; glLightModelfv( GL_LIGHT_MODEL_AMBIENT, lmodel_ambient ); glColor3f( 0.0f, 0.0f, 1.0f ); glBegin( GL_QUADS ); glVertex3f( 0.3f, 0.3f, 0.0f ); glVertex3f( -0.3f, 0.3f, 0.0f ); glVertex3f( -0.3f, -0.3f, 0.0f ); glVertex3f( 0.3f, -0.3f, 0.0f ); glEnd(); glPopMatrix(); glMatrixMode( GL_PROJECTION ); glPopMatrix(); } -----Original Message----- From: steve [mailto:steve] On Behalf Of Steve Baker Sent: Friday, May 10, 2002 2:07 PM To: Stanford Ng Cc: pli...@li... Subject: Re: [Plib-users] Newbie Question: Mixing SSG & OpenGL Stanford Ng wrote: > > Hi everyone! I just got started with Plib and I like it a lot! Great > work, guys! > > I'm stuck with a rather embarrassing problem: I can't seem to mix SSG > & my OpenGL code together. My SSG code loads a model and displays it. > My OpenGL code draws some colored polys to the screen. They both work > individually, but I can't mix and match... > > It seems that the ssgInit() call will setup some GL state that causes > the GL calls in my custom code to not render... This is rather > perplexing as I have managed to work the 2-d font rendering via an 2-d > orthogonal projection into the code. Is this something obvious I'm > missing? > > If someone could point me to an example that has both SSG & OpenGL > code working together, I'm sure I can figure out what I'm doing wrong. Well, all of my games do - so check out TuxKart for example. ----------------------------- Steve Baker ------------------------------- Mail : <sjb...@ai...> WorkMail: <sj...@li...> URLs : http://www.sjbaker.org http://plib.sf.net http://tuxaqfh.sf.net http://tuxkart.sf.net http://prettypoly.sf.net http://freeglut.sf.net http://toobular.sf.net http://lodestone.sf.net |