[osg-users] Insert custom Open GL code

Paul Martz pmartz at skew-matrix.com
Mon Mar 23 07:46:28 PDT 2009


There's no guarantee of a current context during update. You could use a
draw callback instead. Optionally, for the code you posted, I don't know why
you don't just use an osg::Geometry object.
 
Paul Martz
Skew Matrix Software LLC
http://www.skew-matrix.com <http://www.skew-matrix.com/> 
+1 303 859 9466
 

  _____  

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20090323/f2d14238/attachment-0003.htm>


More information about the osg-users mailing list