[osg-users] Insert custom Open GL code

Максим Гаммер maxgammer at gmail.com
Mon Mar 23 11:08:46 PDT 2009


see files...

2009/3/23 Tueller, Shayne R Civ USAF AFMC 519 SMXS/MXDEC <
Shayne.Tueller at hill.af.mil>

> If your OGL code is sharing the same render context as OSG, you need to
> wrapper the OGL code with a push and pop of the state. The push would be:
>
> glPushAttrib(GL_ALL_ATTRIB_BITS);
> glMatrixMode(GL_MODELVIEW);
> glPushMatrix();
> glMatrixMode(GL_PROJECTION);
> glPushMatrix();
> glMatrixMode(GL_TEXTURE);
> glPushMatrix();
>
> And the pop would be:
>
> glMatrixMode(GL_TEXTURE);
> glPopMatrix();
> glMatrixMode(GL_PROJECTION);
> glPopMatrix();
> glMatrixMode(GL_MODELVIEW);
> glPopMatrix();
> glPopAttrib();
>
> I do my OGL rendering in a PostDrawCallback for a symbology overlay.
>
> Hope this helps...
> -Shayne
>
>
>
> -----Original Message-----
> From: osg-users-bounces at lists.openscenegraph.org
> [mailto:osg-users-bounces at lists.openscenegraph.org] On Behalf Of Claudio
> Arduino
> Sent: Monday, March 23, 2009 4:18 AM
> To: osg-users at lists.openscenegraph.org
> Subject: [osg-users] Insert custom Open GL code
>
> Hi,
> i Need to insert custom OpenGl code like this:
>
>    glBegin(GL_TRIANGLE_STRIP);
>    glColor3f(1.0, 0.0, 1.0);
>    glVertex3i(0,0,0);
>    glColor3f(1.0, 0.0, 1.0);
>    glVertex3i(2000,2000,0);
>    glVertex3i(0, 2000,0);
>    glEnd();
>    glFlush();
>
> i have tried to insert this code in osgCallback code:
>
> struct DrawableUpdateCallback : public osg::Drawable::UpdateCallback {
>    virtual void update(osg::NodeVisitor*, osg::Drawable* drawable)
>    {
>        std::cout<<"Drawable update callback "<<drawable<<std::endl;
>  glBegin(GL_TRIANGLE_STRIP);
>
>  glColor3f(1.0, 0.0, 1.0);
>  glVertex3i(0,0,50);
> glColor3f(1.0, 0.0, 1.0);
>       glVertex3i(20000,20000,50);
>       glVertex3i(0, 20000,50);
>    glEnd();
>    glFlush();
>    }
> };
>
> the code is executed but the triangles don't appear to the screen...
> i am a newbie in OpenGl....
>
> please help me...:-)
>
> thanks
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>


-- 
Гаммер Максим Дмитриевич
Начальник отдела ИТ НИИ ЭОР
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20090323/23463e87/attachment-0003.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CustomGeometry.cpp
Type: application/octet-stream
Size: 1584 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20090323/23463e87/attachment-0006.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CustomGeometry.h
Type: application/octet-stream
Size: 1155 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20090323/23463e87/attachment-0007.obj>


More information about the osg-users mailing list