[osg-users] Confused by rendering loop

2013-04-11 Thread Paul Heraty
Hi,

I'm using some profiling tools to try to understand how to optimize an OSG 
application built on osgviewer. In fact, for the purpose of this question, I am 
just running osgview cow.osg.

When I look at the rendering calls, I can see that glDrawArrays get's called 
around 4000 times at application startup, but this quickly drops down to 0 
calls after about 1 second. I can see that there are ~1500 vertices reported, 
but this number also drops off to zero after 1 second.

However, I can see that the GPU cores are kept busy constantly, and I achieve a 
frame rate of 120fps after an initial ramp of about 1s also (corresponds to the 
drop off in dlDraw calls).

What confuses me most is that I would expect the nmuber of glDrawArray calls to 
remain relatively constant throughout the application lifetime, as the cow data 
model is not changing.

Am I missing something?

Thank you!

Cheers,
Paul

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





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


Re: [osg-users] osgviewer render loop profiling

2013-04-11 Thread Paul Heraty
Hi,

I think I see why. It seems that osgviewer is using display lists for drawing.

Thank you!

Cheers,
Paul

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





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


Re: [osg-users] osgviewer render loop profiling

2013-04-11 Thread Paul Heraty
Thanks Robert - that explains what I'm seeing,

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





___
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-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-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 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


[osg-users] Skybox blocks out other model data

2012-12-05 Thread Paul Heraty
Hi,

I have an OSG app setup where I load in a relatively large model. The bounding 
sphere is centered at 0,0,0 with a radius of 5.

I have copied the skybox code from the osgvertexprogram, and set the radius of 
the sphere to 100,000.

However, when I run the app now, All I see is the skybox. If I change the state 
to see un-filled polygons, I can see the model data as well as the sky box, so 
it seems the skybox is over-writing the model data. The stats 's' also shows 
that all of the model data polygons are being processed and drawn.

So my question is, why is my skybox overwriting my model pixels? I've followed 
the code exactly as per the osgvertexprogram. 

Any ideas please?

Thank you!

Cheers,
Paul

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





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


Re: [osg-users] Skybox blocks out other model data

2012-12-05 Thread Paul Heraty
Found the answer. The code in the example resets the depth buffer to 1.0 before 
drawing the skybox. This means that all depth info is effectively cleared from 
the z buffer, and the skybox overwrites everything then.

Not sure how this code worked in the example, but removed the z-clear from my 
code made the skybox work perfectly.

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





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