Hi Fred,
Am 24.03.2011 15:37, schrieb Fred Smith:
> Hi,
>
> I can't get vertex attributes to work in my application.
>
> Right now my aim is to display geometry with just any color, meaning I can
> have very simple shaders, to start with.
>
> I call setUseModelViewAndProjectionUniforms(true) on application startup to
> make sure I can get the MVP matrix as a uniform. I am not calling
> setUseVertexAttributeAliasing as I *think* I do not need it (I am not 100%
> sure what this feature does, either).
>
> My geometry creation code looks like the following:
>
>
> Code:
> int verticesLoc = 6;
> geom.setUseDisplayList(false);
>
> vertices.setName("in_vertex");
>
> geom.setVertexAttribArray(verticesLoc, vertices);
> geom.setVertexAttribNormalize(verticesLoc, false);
> geom.setVertexAttribBinding(verticesLoc, BIND_PER_VERTEX);
>
> Program *program = new Program();
> program.addBindAttribLocation("in_vertex", verticesLoc);
> geom.getOrCreateStateSet()->setAttributeAndModes(program, StateSet::ON);
>
Do you set the initial Bounding Box?
I think with generic Vertex Attributes
OpenSceneGraph has no chance calculate
the Bounding Box by itself.
Cheers,
Peter
>
> My shaders are:
>
>
> Code:
> // vertex shader
> #version 150
>
> uniform mat4 osg_ModelViewProjectionMatrix;
> in vec3 in_vertex;
> in vec4 osg_Vertex;
>
> void main(void)
> {
> gl_Position = osg_ModelViewProjectionMatrix * vec4(in_vertex, 1.0);
> }
>
> // fragment shader
>
> #version 150
>
> out vec4 out_fragcolor;
>
> void main(void)
> {
> out_fragcolor = vec4(1.0, 0.0, 0.0, 1.0);
> }
>
>
>
>
> My window just remains blank. I was wondering whether the automatic setup of
> the camera in the viewer would still work when vertices reside in vertex
> attribute buffers.
>
> Cheers,
> Fred
>
> NB: to refer to the previous, GL3-related topic I opened I am still using a
> regular GL 1.x/2.x context here, but would like to transition to GL3
> afterwards.
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=37864#37864
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
--
Vorstand/Board of Management:
Dr. Bernd Finkbeiner, Dr. Roland Niemeier,
Dr. Arno Steitz, Dr. Ingrid Zech
Vorsitzender des Aufsichtsrats/
Chairman of the Supervisory Board:
Michel Lepert
Sitz/Registered Office: Tuebingen
Registergericht/Registration Court: Stuttgart
Registernummer/Commercial Register No.: HRB 382196
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org