Hi,

In the implementation of a Drawable subclass, I am trying to use regular GL 
functions to render primitives through vertex buffer objects. Like so:

Init:

Code:

Drawable::Extensions* ext = getExtensions(state.getContextID(), true);

GLfloat v[] = {
0.0f, 0.0f, 0.0f, 1.0f,
2.0f, 0.0f, 0.0f, 1.0f,
2.0f, 2.0f, 0.0f, 1.0f
};

ext->glGenBuffers(1, & b);
ext->glBindBuffer(GL_ARRAY_BUFFER_ARB, b);
ext->glBufferData(GL_ARRAY_BUFFER_ARB, sizeof(v), v, GL_STATIC_DRAW);




drawImplementation(..)

Code:

osg::State& state = *renderInfo.getState();
Drawable::Extensions* ext = getExtensions(state.getContextID(), true);

ext->glBindBuffer(GL_ARRAY_BUFFER_ARB, b);
glEnableClientState(GL_VERTEX_ARRAY);

glVertexPointer(4, GL_FLOAT, 0, 0);

glDrawArrays(GL_POINTS, 0, 3);

glDisableClientState(GL_VERTEX_ARRAY);
ext->glBindBuffer(GL_ARRAY_BUFFER_ARB, 0);




But, nothing shows up on the screen. There are no GL errors reported. Changing 
the code to use regular vertex arrays (without binding the vbo and changing the 
glVertexPointer call to take an array), things shows up fine. Ofcourse, this is 
not what I want.

I even created a stand-alone skeleton GL application with this kind of 
implementation, and as expected, it works fine.

So, it must be the case that OSG does some trickery of its own. The question 
is, what could that be? :?

Thank you!

Cheers,
Mattias

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=23125#23125





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to