[osg-users] Some Part of The 3D Model Disappeared!?

Wangzhu wangzhu at ict.ac.cn
Fri Sep 28 01:17:04 PDT 2007


Hi,

    In my OSG based application, I need to draw some openGL objects with texture. So I used glpush and glpop before and after the code to draw OSG objects. But the some of the OSG objects can’t display on the screen. Below is part of the code:

//-----------------------------------------------------------------
		glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
		glPushAttrib(GL_DEPTH_BUFFER_BIT|GL_TEXTURE_BIT);

	    glMatrixMode(GL_MODELVIEW);
	    glPushMatrix();
	    glMatrixMode(GL_PROJECTION);
	    glPushMatrix();

        //=====do SceneView::update and SceneView::cull here
        StageInterface::Update();
        //=====do SceneView::draw here
        StageInterface::Render();

		glMatrixMode(GL_PROJECTION);
	    glPopMatrix();
	    glMatrixMode(GL_MODELVIEW);
	    glPopMatrix();

		glPopAttrib();
		glPopClientAttrib();
//-----------------------------------------------------------------

  If using the code above, some of the OSG objects can’t display on the screen. It seems as some triangles of the OSG objects are lost. 
  If I don’t use “glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT)” and “glPopClientAttrib()”, all the OSG objects can be seen on the sceen, but the texture of the openGL objects is wrong at the beginning of the rendering.
  I didn’t find a way to solve the problem. Did OSG does some sets about vertex array itself? Or is there any other set must be done? 
  Thanks~



Wangzhu
MSN:wangzhuhhjj at gmail.com

2007-09-28


More information about the osg-users mailing list