Hm. Is it possible that texture mapping or lighting is enabled? If so, then
you don't specify texcoords/normals, so you could be getting one texel
spread across the whole primitive, or the last normal could've been facing
away from the light. Either would explain the black primitive.
 
Best way to manipulate State in a custom Drawable would be to create your
own State object for that Drawable, and the ultimate reference material for
that is to take a look at osgText::Text::drawImplementation(). The Text
object derives from Drawable and manipulates State in this manner.
   -Paul
 


  _____  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Brian
Sent: Monday, July 02, 2007 1:39 PM
To: osg users
Subject: [osg-users] Proper usage of Drawable::drawImplementation


Hi,
 
I am trying to learn how to create my own custom drawable objects, and I
have run into a snag.  I create a class derived from the Drawable class and
provide the necessary functions.  Currently, I'm drawing a single quad in my
drawImplementation function.  The quad renders, however if I try to
associate a red color with the quad, the quad only renders as black.
 
When setting up the scene, I create a geode and add my drawable to it.  By
itself, it renders as mentioned above, but if I also add a geometry object
to the geode (also a quad), then my custom drawable renders properly as a
solid red quad.
 
The code for the drawImplementation is very simple.  I'm wondering if I need
to manipulate the osg::State object somehow, but I'm unclear as to how.
 
code...
 
void drawImplementation(osg::State &state) const
{
   glColor3f(1, 0, 0);
 
   glBegin(GL_QUAD);
   glVertex3f(150, 150, 0);
   glVertex3f(150, 150, 150);
   glVertex3f(0, 150, 150);
   glVertex3f(0, 150, 0);
   glEnd();    
}
 
Incidentally, I'm still using OSG 1.2.
 
Thanks for any help you might be able to give me.
 
Brian
 
 
 

_______________________________________________
osg-users mailing list
osg-users@openscenegraph.net
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to