Re: [osg-users] Why to use Shaders to render model in Android with OpenGLES2
Hello Chris Hanson, Thank you very much for giving valuable information. At present it is not possible for me to rewrite my desktop application by using shaders. So I will use GLES1. Now onwards I will use shaders in all applications as the future devices may support only GLES2. Thank you very much. ... Thank you! Cheers, Koduri -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=51141#51141 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Why to use Shaders to render model in Android with OpenGLES2
Hello Chris Hanson, Thank you very much for the great help. I have a small application build on desktop using OSG with OpenGL2 version. I will get ready to render 3D models (with full texturing, lighting etc ) from 3DSMAX (Exported as .OSG from Max using OSGExporter). As this supports Fixed Function Pipeline the desktop application is able to render these 3D models successfully. Similarly does OpenGL 3 and OpenGL 4 versions supports Fixed Function Pipeline? Now I want to port the same on Android and iPhone. With your help and from some documents I came to know that GLES2.0 never supports Fixed Function Pipeline. So I can't port that code in Android. To make an application to work on both Desktop and Embedded devices, should I code my project by using only Shaders. In such case I should get 3D model in OBJ format and I should write shaders for Textures, Lightings etc. I think this is very painful work. I have to see whether will it be easy with ShadreGen. I need to go through ShaderGen. Can I expect that GLES2 will support Fixed Functionality in near future like GLES1. Once again thank you very much for the great help. ... Thank you! Cheers, Koduri -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=51132#51132 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Why to use Shaders to render model in Android with OpenGLES2
I have a small application build on desktop using OSG with OpenGL2 version. I will get ready to render 3D models (with full texturing, lighting etc ) from 3DSMAX (Exported as .OSG from Max using OSGExporter). As this supports Fixed Function Pipeline the desktop application is able to render these 3D models successfully. Yes. Similarly does OpenGL 3 and OpenGL 4 versions supports Fixed Function Pipeline? They can. Around OpenGL 3, a number of FFP features were removed. Most current drivers allow you to still request a legacy compatability GL3 or GL4 context that still offers FFP functionality, or you can requesta pure GL3/4 context that omits the FFP capabilities. Now I want to port the same on Android and iPhone. With your help and from some documents I came to know that GLES2.0 never supports Fixed Function Pipeline. So I can't port that code in Android. Remember, most GLES chipsets support GLES 1, which DOES offer FFP. Do you NEED GLES 2? To make an application to work on both Desktop and Embedded devices, should I code my project by using only Shaders. If you need shader capability, then to support GLES devices, you must use shaders, and you might as well use shaders exclusively, on both desktop and GLES. In such case I should get 3D model in OBJ format and I should write shaders for Textures, Lightings etc. I think this is very painful work. This is what ShaderGen can help you with. Can I expect that GLES2 will support Fixed Functionality in near future like GLES1. No. It was intentionally removed. The intent, I believe, is that future devices might ONLY support GLES2, and save die space by leaving out GLES 1 capacity. Or, certain resources might be re-used between ES1 and ES2, but not duplicated. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- 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 @alphapixel https://twitter.com/alphapixel facebook.com/alphapixel ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Why to use Shaders to render model in Android with OpenGLES2
Hi, I completed osgAndroid Example with GLES1 successfully. If I try to run the same example with OpenGLES2 then the OSG model is not rendering. If I add the following code then I am able to see the model on my device. Code: mtForMarker[idx]=new osg::MatrixTransform(); osg::Shader * vshader = new osg::Shader(osg::Shader::VERTEX, gVertexShader ); osg::Shader * fshader = new osg::Shader(osg::Shader::FRAGMENT, gFragmentShader ); osg::Program * prog = new osg::Program; prog-addShader ( vshader ); prog-addShader ( fshader ); mtForMarker[idx]-getOrCreateStateSet()-setAttribute ( prog ); mtForMarker[idx]-addChild(loadedModel[idx].get()); modelSwitch-addChild(mtForMarker[idx].get()); osgViewer::Viewer::Windows windows; _viewer-getWindows(windows); for(osgViewer::Viewer::Windows::iterator itr = windows.begin();itr != windows.end();++itr) { (*itr)-getState()-setUseModelViewAndProjectionUniforms(true); (*itr)-getState()-setUseVertexAttributeAliasing(true); } This code I added from osgAndroidOpenGLES2 example. As I am new to OSG I have two doubts 1) Why should I add the shaders in OpenGLES2 to display model.Can't I display the model with out this Shaders code. OpenGLES1 example doesn’t have this shaders. 2) If I add the shaders then the fixed functionalities like textures, lighting etc. were disabled. But I need to enable them because I got model from 3DS MAX. How can I enable fixed functionalities? Can you please guide me how to enable fixed functionalities? If shaders are necessary to render model on Android with OpenGLES2 then how can I handle textures (or any others fixed functionalities) ? Is there any tutorial to handle this in Android? NOTE:- By mistake i posted the same under Build System category. ... Thank you! Cheers, Koduri -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=51130#51130 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Why to use Shaders to render model in Android with OpenGLES2
I completed osgAndroid Example with GLES1 successfully. If I try to run the same example with OpenGLES2 then the OSG model is not rendering. If I add the following code then I am able to see the model on my device. This is normal. 1) Why should I add the shaders in OpenGLES2 to display model.Can't I display the model with out this Shaders code. OpenGLES1 example doesn’t have this shaders. No. OpenGL ES2 is not like regular OpenGL. ES2 does NOT have the fixed functionality available that ES1 has. You can have shaders OR fixed function, but not both. 2) If I add the shaders then the fixed functionalities like textures, lighting etc. were disabled. But I need to enable them because I got model from 3DS MAX. How can I enable fixed functionalities? You can not. You need to write shaders that provide that same functionality. Can you please guide me how to enable fixed functionalities? If shaders are necessary to render model on Android with OpenGLES2 then how can I handle textures (or any others fixed functionalities) ? Is there any tutorial to handle this in Android? One way to do this is to use a shader generator to create a shader to implement some of the fixed function capability in a shader. OSG has a ShaderGen tool, but it's somewhat out of date with regard to OpenGL ES2. We've been using an updated version of it, but it's not in core OSG yet. -- 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 @alphapixel https://twitter.com/alphapixel facebook.com/alphapixel ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org