Hi Jorge,

Hello i'm looking for a little bit of Code that has been tested to be
working and draws on OpenGL ES 2.0  a simple vertex/fragment shader
loading and a little bit of geometry or a triangle. I'm testing the
Android port working and i'm a little bit paranoid to write one if I
write one and doesn't work i won't know if it's by using some
instruction that don't work on GLES 2 or if it is some kind of trouble
in the GLES2/Android building. I'm not ussed to test osg with GLES 2 in
emulators that's why i'm asking for help in this matter.

OK, two things:

1. The Android emulator doesn't support GLES 2.0 from what I've seen, unless it's been fixed recently. Apps using GLES 2.0 will just crash on initialization. You have to test on the device itself (which sucks, makes turnaround time longer, but what can we do...)

2. From what I've seen, OSG will automatically change your osg::Geometry to use vertex attributes (instead of the old vertex, normal, color, texcoord arrays), will automatically create uniforms that replicate the old built-in uniforms (gl_ModelViewMatrix becomes osg_ModelViewMatrix and is set to the right value, etc.) and will automatically modify your shaders to use those uniforms (so it will replace gl_ModelViewMatrix with osg_ModelViewMatrix in your shader code).

So (at least I think, I've never been able to test it) you should be able to make a scene graph with an osg::Geometry that displays a triangle, and a simple vertex+fragment shader pair that just transforms the vertex position by the gl_ModelViewProjectionMatrix in the vertex shader and then sets its color to red in the fragment shader, and it should work out of the box.

Note also that you can make a build of OSG that emulates what you would need to do on GLES 2.0, but which runs on a desktop with standard OpenGL. See this page:

http://www.openscenegraph.org/projects/osg/wiki/Community/OpenGL-ES

The section called: "Cmake settings for Emulating OpenGL ES 2.0 when you only have standard OpenGL available:"

I had debugged through the code paths when configuring an OSG build like this, and that's how I found out what I said above (in 2).

Thanks and apologies for the nuisanse.

It's no nuisance at all. Good luck, let us know how it goes! :-)

J-S
--
______________________________________________________
Jean-Sebastien Guay    [email protected]
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to