Re: [osg-users] Does OSG support ES2.0?

2013-01-17 Thread Paul Heraty
Hi Preet,

that worked a treat! I now have the statistics text workong on ES2 for my app!

Thank you!

Cheers,
Paul

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Does OSG support ES2.0?

2013-01-09 Thread Preet
Hi Paul,

On Tue, Jan 8, 2013 at 8:20 AM, Paul Heraty heratyp...@eircom.net wrote:

 Hi Preet,

 Do you have a copy of the shaders in that code that you can share please:


 shaders/NoShading_vert.glsl
 shaders/NoShading_frag.glsl


They are in the same repo:
https://github.com/preet/scratch/tree/master/openscenegraph/osg_text_geometry/shaders


Preet
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Does OSG support ES2.0?

2013-01-08 Thread Paul Heraty
Hi Preet,

Do you have a copy of the shaders in that code that you can share please:


shaders/NoShading_vert.glsl
shaders/NoShading_frag.glsl


Thank you!

Cheers,
Paul

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Does OSG support ES2.0?

2013-01-04 Thread Paul Heraty
Hi,

According to the 3.0 release notes, OSG introduces support for OpenGL ES 1.1, 
OpenGL ES 2.0. 

I'm using OSG 3.1.1, and I have built an application which works fine when I 
compile OSG to use OpenGL. It's a pretty simple app that reads in a textured 
3DS model and displays it.

However, when I recompile OSG to use OpenGL ES2.0, the same application doesn't 
work so well. For example, the statistics text that appears from the 
osgViewer::StatsHandler does not appear at all, and I get lots of messages such 
as:

Warning: detected OpenGL error 'invalid enumerant' after applying GLMode 0x4000
Warning: Light::apply(State) - not supported
Warning: Material::apply(State) - not supported
Warning: TexEnvCombine::apply(State) - not supported
Warning: TexGen::apply(State) - not supported
Warning: TexMat::apply(State) - not supported

I've tried using the default OSG shaders and my own custom ones, but I get the 
same issues.

For reference, my (simple) shaders are:


Code:
varying mediump vec4 col;
varying mediump vec2 texcoord;
uniform mat4 osg_ModelViewProjectionMatrix;
attribute vec4 osg_MultiTexCoord0;
attribute vec4 osg_Color;
attribute vec4 osg_Vertex;
void main() {
  gl_Position = osg_ModelViewProjectionMatrix * osg_Vertex;
  texcoord = osg_MultiTexCoord0.st;
  col = osg_Color;
}



and


Code:
varying mediump vec4 col;
varying mediump vec2 texcoord;
uniform sampler2D diffuseMap;
void main()
{
  vec4 base = texture2D(diffuseMap, texcoord);
  vec4 color = base;
  color *= col;
  gl_FragColor = color;
}



When I search the forums, I see lots of posts where people faced similar 
problems. But it's unclear how many of these problems have been 'fixed' in the 
main OSG code now.

So my question is: does the latest OSG (3.1.1) work with GLES2.0 or not? 

If it doesn't work 'out of the box', is there a document or example anywhere 
that shows how to display a 3ds model in ES2.0?

Thank you!

Cheers,
Paul

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Does OSG support ES2.0?

2013-01-04 Thread Jorge Izquierdo Ciges
OSG core works from the box what doesn't work from the box is osgText and
other things that require the user to include his own shader to make work
things. I have code that replaces the estandard stats handler with one 100%
compatible with GLES 2.0 BUT it's not something that we can include in OSG
because a more general solution is needed. If you want to use those
features simply include a shader that complies with GLSL/gles2 standard.

3ds can be rendered en GLES 1.0 and 2.0. Either you haven't included the
plugin and used the static initializer (if you are in Iphone or Android) of
the plugin or you have a model that uses some caracteristics not presented
in gles 2.0 like DXT compressed textures (something that we can't do a
thing)

So... first check if the model is even loaded and if OSG complains about it.

2013/1/4 Paul Heraty heratyp...@eircom.net

 en I search the forums, I see lots of posts where people faced similar
 problems. But it's unclear how many of these problems have been 'fixed' in
 the main OSG code now.

 So my question is: does the latest OSG (3.1.1) work with GLES2.0 or not?

 If it doesn't work 'out of the box', is there a document or example
 anywhere that shows how to display a 3ds model in ES2.0?

 Thank you!

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Does OSG support ES2.0?

2013-01-04 Thread Paul Heraty
Hi Jorge,

first off, thanks for the quick reply!

My model is being read in correctly. In fact, I can display it using the 
shaders I've attached above. What I'm concerned about are two things:

1/ Why all the warnings appear that I posted above? I attached the shader 
program to the root node, so I would not expect any other shaders to be used 
other than what I provide. Looking through the LogFileHandler text, I can see 
the model being read, my shaders being compiled etc. So where are all the other 
Light/Material/Tex*::apply(State) coming from? How can I remove them? I'm 
guessing there's still some default states being set by OSG?

2/ The stats handler text does not work. Would you be willing to share the code 
you have for this please?


Thank you!

Cheers,
Paul

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Does OSG support ES2.0?

2013-01-04 Thread Paul Heraty
Hi,

after removing everything from my SG except the node with the 3DS model, I now 
see only a few warnings in the logfile. After the shaders are compiled and 
textures loaded, I get


Code:
Warning: detected OpenGL error 'invalid enumerant' at After Renderer::compile
openGL extension '' is not supported.
Setting up osg::Camera::FRAME_BUFFER
ShaderComposer::~ShaderComposer() 0x8c34ff0
Warning: detected OpenGL error 'invalid enumerant' at after RenderBin::draw(..)
openGL extension '' is not supported.
Setting up osg::Camera::FRAME_BUFFER



Then I seem to get one of the RenderBin::draw(..) warnings per frame from then 
on.

Also, the text is still not working, so I'd really appreciate that if possible 
:)

Thank you!

Cheers,
Paul

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Does OSG support ES2.0?

2013-01-04 Thread Jorge Izquierdo Ciges
osg Text is really easy to make it work with ogl, you have to use a shaders
that is inherited by the osgText node that can read from texture and that's
pretty much all. The other errors... well openGL extension is not supported
will be probably because it needs some qualifier that it's not included.
Which extension is? I don't know... when i've had those things i had to
recompile several times OSG until I knew from where it comes and then fix
it. If you have a graphical debugger then you'll probalby find the invalid
enumerant by searching the operation code.


2013/1/4 Paul Heraty heratyp...@eircom.net

 Hi,

 after removing everything from my SG except the node with the 3DS model, I
 now see only a few warnings in the logfile. After the shaders are compiled
 and textures loaded, I get


 Code:
 Warning: detected OpenGL error 'invalid enumerant' at After
 Renderer::compile
 openGL extension '' is not supported.
 Setting up osg::Camera::FRAME_BUFFER
 ShaderComposer::~ShaderComposer() 0x8c34ff0
 Warning: detected OpenGL error 'invalid enumerant' at after
 RenderBin::draw(..)
 openGL extension '' is not supported.
 Setting up osg::Camera::FRAME_BUFFER



 Then I seem to get one of the RenderBin::draw(..) warnings per frame from
 then on.

 Also, the text is still not working, so I'd really appreciate that if
 possible :)

 Thank you!

 Cheers,
 Paul

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





 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Does OSG support ES2.0?

2013-01-04 Thread Preet
To follow up on Jorge's reply:

Here's an example of how you can use shaders for osgText:
https://github.com/preet/scratch/blob/master/openscenegraph/osg_text_geometry/main_old.cpp

If you're still having issues, increase the OSG debugging output:
(osg::setDebugNotify(...)) and
osgViewer::getCamera()-getGraphicsContext()-getState()-
setCheckForGLErrors(osg::State::ONCE_PER_ATTRIBUTE)

to try and get a bit more info on the error. Something like APITrace (
https://github.com/apitrace/apitrace) might help too if you can get it
running on the target platform.

To get textures working properly on my platform I had to make a couple of
changes to the source. Unfortunately, for some stupid reason I accidentally
scrubbed the git history so I don't really have diffs of all the changes I
made. One specific thing I remember was having to set _glMaxTextureCoords =
1 in /src/osg/State.cpp to get textures working on my device.

Replace the if clause on line 900 with:

if ( osg::getGLVersionNumber() = 2.0 ||
osg::isGLExtensionSupported(_contextID,GL_ARB_vertex_shader) ||
OSG_GLES2_FEATURES)
{

glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS,_glMaxTextureUnits);

#ifdef OSG_GLES2_AVAILABLE
_glMaxTextureCoords = 1;
#else
glGetIntegerv(GL_MAX_TEXTURE_COORDS,_glMaxTextureCoords);
#endif
}


Preet
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org