Re: [osg-users] Current state of GLES2
On Tue, Apr 24, 2012 at 4:44 AM, Robert Osfield robert.osfi...@gmail.com wrote: However, you can use the OSG with OpenGL 2.0 with a purely shader based state and if you do this the actual shaders you use for OpenGL or OpenGL ES 2.0 will be very similar. This similarity means you can prototype an OpenGL ES application in OpenGL just be using the shaders and avoiding all built in state. I'm fuzzy on the shader stuff. For all my 3d dev, I just jumped into using osg, and whatever I've built has been derived from tutorials/examples given online. With the level of abstraction osg provides, I haven't had to make any OpenGL calls directly, so when you say using the shaders and avoiding all built in state... I don't understand what avoiding all built in state is in an osg context. Does it mean I shouldn't be using osg::StateSet? You can also build the OSG so that it doesn't compile in the fixed function state, something that you do when you want to compile against the core profile of OpenGL 3.x. I'm using http://www.openscenegraph.org/projects/osg/wiki/Community/OpenGL-ES to set the environment up... and since I'd like to develop for OpenGL ES 2, I'll be using Cmake settings for Emulating OpenGL ES 2.0 when you only have standard OpenGL available to build osg to create my app. When it comes time to actually deploy, I'm guessing I'd rebuild osg against Cmake settings for OpenGL ES 2.0? I also downloaded an emulator/sdk for OpenGL ES 2 from PowerVR, and ran a bunch of default examples they provided. Does that factor in at all? They provide libEGL.so and libGLESv2.so libs for linking as well. On Mon, Apr 23, 2012 at 6:19 PM, Chris Hanson xe...@alphapixel.com wrote: Yes, with ShaderGen. What exactly is involved in using ShaderGen? From the osgshadergen example, it looks like all that's done it is attaching it as a node visitor to your scene graph. Does it just automagically go through your scene and convert fixed function pipeline stuff to shader pipeline stuff? Which OS? OSG really only has ES2/EGL windowing interfaces for Xwindows -- Win32 is not implemented. I'm on Linux Sorry for all the questions and thanks for the valuable feedback/support Preet ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Current state of GLES2
Hi Preet, I'm afraid I too busy with other tasks to go into detail discussion about this stuff right now. My personally recommendation would be to take things steadily with learning and experimenting with different elements one at a time. Rather than dive into OpenGL ES 2 right away I would suggest getting to know GLSL and how you the associated shaders, uniforms and programs in the OSG - it's all driven via osg::StateSet as with the fixed function pipeline so the usuge of the OSG stays pretty similar - you just have to replace the fixed function pipeline state with shaders. Examples the osgshader* and osg*shader examples will all be good starting places to learn how the OSG manages working with shaders. Also do a search through the whole OSG to see where osg::Shader/osg::Program and osg::Uniform are used to see other codes us it. When using OpenGL 2.0 + GLSL you can still use built-in uniform state such as gl_ModelViewMatrix etc but once you go fully over to OpenGL 3.x and OpenGL ES 2.0 you'll need to provide uniforms for these yourself, in special cases like gl_ModelViewMatrix the osg::State has support for automatically setting an osg_ModelViewMatrix for you. However with the later work I wouldn't recommend diving in until you are very comfortable with the OpenGL 2.0 + GLSL usage of shaders. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Current state of GLES2
I'm fuzzy on the shader stuff. For all my 3d dev, I just jumped into using osg, and whatever I've built has been derived from tutorials/examples given online. With the level of abstraction osg provides, I haven't had to make any OpenGL calls directly, so when you say using the shaders and avoiding all built in state... I don't understand what avoiding all built in state is in an osg context. Does it mean I shouldn't be using osg::StateSet? Pretty much. The state info is used by the OpenGL 1.x Fixed Function Pipeline (FFP) to produce different visual appearances (textures, lighting, etc). GLES 1 has FFP (it's very similar to OpenGL 1.x) but has no GLSL shader features. GLES 2.0 has removed all FFP functionality, and ONLY has GLSL shaders.. The GLES 2 ShaderGen I referred to previously will write a replacement GLSL shader for you, on the fly, to emulate SOME of this FFP capacity. However, if you're targeting GLES 2, you're usually doing so with the intent of using GLSL (otherwise you'd just use GLES 1). So, you'll want to learn to do things with shaders eventually. I'm using http://www.openscenegraph.org/projects/osg/wiki/Community/OpenGL-ES to set the environment up... and since I'd like to develop for OpenGL ES 2, I'll be using Cmake settings for Emulating OpenGL ES 2.0 when you only have standard OpenGL available to build osg to create my app. When it comes time to actually deploy, I'm guessing I'd rebuild osg against Cmake settings for OpenGL ES 2.0? Yes. I assume you're intending to deploy on a non-desktop platform, like Android, iOS or some embedded device? There are complications when you go to omit the GLX or WGL windowing system interface that OSG currently relies on and some platforms don't provide. GLES provides EGL which is a similar design, but currently OSG is not equipped to use EGL solely without GLX or WGL. I also downloaded an emulator/sdk for OpenGL ES 2 from PowerVR, and ran a bunch of default examples they provided. Does that factor in at all? They provide libEGL.so and libGLESv2.so libs for linking as well I have worked with this emulator. It works fine on Windows. I had trouble getting it to work on Linux. What exactly is involved in using ShaderGen? From the osgshadergen example, it looks like all that's done it is attaching it as a node visitor to your scene graph. Does it just automagically go through your scene and convert fixed function pipeline stuff to shader pipeline stuff? Yes. Which OS? OSG really only has ES2/EGL windowing interfaces for Xwindows -- Win32 is not implemented. I'm on Linux Well, if you got the PowerVR emulator working, you're ahead of me. -- Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com http://www.alphapixel.com/ Training • Consulting • Contracting 3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 4 • GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL Digital Imaging • GIS • GPS • Telemetry • Cryptography • Digital Audio • LIDAR • Kinect • Embedded • Mobile • iPhone/iPad/iOS • Android ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Current state of GLES2
Hiya, Thanks Robert and Chris for your insight and advice. I think I'll try deploying using OpenGL ES 1.1 with what I have for now, and rebuild the OSG stuff using shaders to eventually build with ES 2.0. As Robert mentioned, this way I'll get a decent amount of exposure to GLSL and the new pipeline before getting in way over my head. Well, if you got the PowerVR emulator working, you're ahead of me. I was surprised that it 'just worked'... that usually never happens with Linux. Downloaded it, unzipped it and all the examples ran flawlessly. It's even more surprising considering I have a really old machine with spotty driver support (integrated ATi chipset). If it helps, I'm running Arch Linux with all the latest updates. The SDK I got was the ES 2.0 Emulation for PC (Linux) off this page: http://www.imgtec.com/powervr/insider/sdkdownloads/. Regards, Preet ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Current state of GLES2
Hi Preet, On 23 April 2012 22:43, Preet prismatic.proj...@gmail.com wrote: I'm new to OSG and OpenGL but I understand that ES2 has some pretty significant changes in how things are drawn. OpenGL ES 2 is entirely shader based, no fixed function pipeline to fullback on, which is a big difference to using OSG/OpenGL with a fixed function pipeline based state. However, you can use the OSG with OpenGL 2.0 with a purely shader based state and if you do this the actual shaders you use for OpenGL or OpenGL ES 2.0 will be very similar. This similarity means you can prototype an OpenGL ES application in OpenGL just be using the shaders and avoiding all built in state. You can also build the OSG so that it doesn't compile in the fixed function state, something that you do when you want to compile against the core profile of OpenGL 3.x. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Current state of GLES2
On Sun, Apr 22, 2012 at 9:11 PM, Eduardo Poyart poy...@gmail.com wrote: Hello, Just to make sure I'm not missing anything, I'd like to ask this. What is the current state of GLES2 in OSG? What should be done to enable texturing? I think it worked ok for me, using the osgvertexattributes example to run shadergen on the scenegraph. OSG's ShaderGen code generates GL2, but not GLES2 shaders. Thomas Hogarth has some more advanced shadergen code that he allowed me to use that dealt with the precision qualifier issues. I don't know Thomas' intent for incorporating his shadergen improvements into OSG core, but I would support this endeavor if he decided to. -- Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com http://www.alphapixel.com/ Training • Consulting • Contracting 3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 4 • GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL Digital Imaging • GIS • GPS • Telemetry • Cryptography • Digital Audio • LIDAR • Kinect • Embedded • Mobile • iPhone/iPad/iOS • Android ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Current state of GLES2
Hi Guys Yes I have a GLES2 version of shader gen. At the moment it only supports a fixed hardcoded light position, which isn't great but it does support, texturing, lighting etc. I've attached it and we can look at including into core osg, but I think support for at least the initial position of one light source would be good. Also we need to either test for backward compatibility with GL2 or have two versions of ShaderGen in the core. I know Roberts long term goal is to introduce a Shader Composer system (bits and pieces already exist), but this can work as an aid to new developers until then. Let me know how you get on with it. Tom -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=47224#47224 Attachments: http://forum.openscenegraph.org//files/gles2shadergen_157.zip ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Current state of GLES2
Hi Thomas et. al, I won't have a chance to complete the shader composition functionality in the near term so an improved ShaderGen would be welcome. Handling items like lights, texgen and clipplanes will require some handling elsewhere other than with just the standard functionality - we'll need to have the osg::Light, osg::TexGen and osg::ClipPlane all be written as appropriate osg_* uniforms with the values being passed to OpenGL using the current modelview matrix as is done by OpenGL with the fixed function pipeline. This might require amendments to osg::State/osgUtil::RenderStage and the osg::Light, osg::TexGen and osg::ClipPlane, but it might also be possible with just amendments to state attributes if they do a little compute work prior to passing their values to OpenGL as uniforms. I would suggest finding a workable solution for lights then when this works roll it out for the other positional state. Thoughts? Robert. On 23 April 2012 15:16, Thomas Hogarth thomas.hoga...@gmail.com wrote: Yes I have a GLES2 version of shader gen. At the moment it only supports a fixed hardcoded light position, which isn't great but it does support, texturing, lighting etc. I've attached it and we can look at including into core osg, but I think support for at least the initial position of one light source would be good. Also we need to either test for backward compatibility with GL2 or have two versions of ShaderGen in the core. I know Roberts long term goal is to introduce a Shader Composer system (bits and pieces already exist), but this can work as an aid to new developers until then. Let me know how you get on with it. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Current state of GLES2
Very clarifying, thank you. I did experiment with ShaderGen and I even patched it to generate GLES2 code. However I'm going in a different direction. My models are simple. I wrote my own shader and added it to the root node. My shader currently has a fixed light position for testing purposes. Now I want to render it with textures. If OSG would detect GLES2 and appropriately write standard-named uniforms for textures, I could just use those names in the shader. Maybe that needs to be done in State::applyModeOnTexUnit, since there is code there for fixed-function Opengl (glEnable(GL_TEXTURE_2D)). If that seems like a good direction, I'll try to do it for textures. The same thing can be done for light positions later. This way I leave ShaderGen out of the way, and it can be improved later. Eduardo On Mon, Apr 23, 2012 at 7:51 AM, Robert Osfield robert.osfi...@gmail.com wrote: Hi Thomas et. al, I won't have a chance to complete the shader composition functionality in the near term so an improved ShaderGen would be welcome. Handling items like lights, texgen and clipplanes will require some handling elsewhere other than with just the standard functionality - we'll need to have the osg::Light, osg::TexGen and osg::ClipPlane all be written as appropriate osg_* uniforms with the values being passed to OpenGL using the current modelview matrix as is done by OpenGL with the fixed function pipeline. This might require amendments to osg::State/osgUtil::RenderStage and the osg::Light, osg::TexGen and osg::ClipPlane, but it might also be possible with just amendments to state attributes if they do a little compute work prior to passing their values to OpenGL as uniforms. I would suggest finding a workable solution for lights then when this works roll it out for the other positional state. Thoughts? Robert. On 23 April 2012 15:16, Thomas Hogarth thomas.hoga...@gmail.com wrote: Yes I have a GLES2 version of shader gen. At the moment it only supports a fixed hardcoded light position, which isn't great but it does support, texturing, lighting etc. I've attached it and we can look at including into core osg, but I think support for at least the initial position of one light source would be good. Also we need to either test for backward compatibility with GL2 or have two versions of ShaderGen in the core. I know Roberts long term goal is to introduce a Shader Composer system (bits and pieces already exist), but this can work as an aid to new developers until then. Let me know how you get on with it. ___ 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] Current state of GLES2
Hiya, Not to hijack this thread, but I'm also interested in porting my osg application to an OpenGL ES2 device. I'm new to OSG and OpenGL but I understand that ES2 has some pretty significant changes in how things are drawn. What sort of steps should I be taking to accomplish this? I'm not sure what level of 'continuity' OSG offers between the different OpenGL versions, and I didn't design the original application with OpenGLES in mind (no shaders, just simple geometry, transforms and materials). Based on this thread I get the feeling I shouldn't expect my application to 'just work'... so what's the right way to proceed? Does 'most' of OSG's basic functionality still work with ES2? Will I need to rewrite much of my code? I downloaded an OpenGLES2 emulator from PowerVR... I'll try to compile OSG for ES2 and see if I can get any examples working, but beyond that I really don't know how to approach this and would appreciate any advice. Regards, Preet On Mon, Apr 23, 2012 at 4:51 PM, Eduardo Poyart poy...@gmail.com wrote: Very clarifying, thank you. I did experiment with ShaderGen and I even patched it to generate GLES2 code. However I'm going in a different direction. My models are simple. I wrote my own shader and added it to the root node. My shader currently has a fixed light position for testing purposes. Now I want to render it with textures. If OSG would detect GLES2 and appropriately write standard-named uniforms for textures, I could just use those names in the shader. Maybe that needs to be done in State::applyModeOnTexUnit, since there is code there for fixed-function Opengl (glEnable(GL_TEXTURE_2D)). If that seems like a good direction, I'll try to do it for textures. The same thing can be done for light positions later. This way I leave ShaderGen out of the way, and it can be improved later. Eduardo On Mon, Apr 23, 2012 at 7:51 AM, Robert Osfield robert.osfi...@gmail.com wrote: Hi Thomas et. al, I won't have a chance to complete the shader composition functionality in the near term so an improved ShaderGen would be welcome. Handling items like lights, texgen and clipplanes will require some handling elsewhere other than with just the standard functionality - we'll need to have the osg::Light, osg::TexGen and osg::ClipPlane all be written as appropriate osg_* uniforms with the values being passed to OpenGL using the current modelview matrix as is done by OpenGL with the fixed function pipeline. This might require amendments to osg::State/osgUtil::RenderStage and the osg::Light, osg::TexGen and osg::ClipPlane, but it might also be possible with just amendments to state attributes if they do a little compute work prior to passing their values to OpenGL as uniforms. I would suggest finding a workable solution for lights then when this works roll it out for the other positional state. Thoughts? Robert. On 23 April 2012 15:16, Thomas Hogarth thomas.hoga...@gmail.com wrote: Yes I have a GLES2 version of shader gen. At the moment it only supports a fixed hardcoded light position, which isn't great but it does support, texturing, lighting etc. I've attached it and we can look at including into core osg, but I think support for at least the initial position of one light source would be good. Also we need to either test for backward compatibility with GL2 or have two versions of ShaderGen in the core. I know Roberts long term goal is to introduce a Shader Composer system (bits and pieces already exist), but this can work as an aid to new developers until then. Let me know how you get on with it. ___ 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 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Current state of GLES2
different OpenGL versions, and I didn't design the original application with OpenGLES in mind (no shaders, just simple geometry, transforms and materials). You'll need the GLES2 shadergen code. way to proceed? Does 'most' of OSG's basic functionality still work with ES2? Yes, with ShaderGen. I downloaded an OpenGLES2 emulator from PowerVR... I'll try to compile OSG for ES2 and see if I can get any examples working, but beyond that I really don't know how to approach this and would appreciate any advice. Which OS? OSG really only has ES2/EGL windowing interfaces for Xwindows -- Win32 is not implemented. -- Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com http://www.alphapixel.com/ Training • Consulting • Contracting 3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 4 • GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL Digital Imaging • GIS • GPS • Telemetry • Cryptography • Digital Audio • LIDAR • Kinect • Embedded • Mobile • iPhone/iPad/iOS • Android ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org