Re: [osg-users] How to build OSG 2.9.8 for Emulator on linux
Hi Rakash, Right now, for OpenGL ES 2.0, you have no alternative but to write shaders and uniforms to do all the vertex and framgemet shader operations, the traditional fixed function pipeline is a non op. There is a utility osgUtil::ShaderGen but this was designed for GL2.0 shaders that can help generate some shaders to replace the fixed function state, but it's not written explictly for GLES 2.0 and uses built-ins that don't exist under GLES. Please also remember that all gl_ built-ins don't exist under GLES, the OSG try to rewrite the gl_ uniforms to use osg_ versions such as osg_ModelViewProjectionMatrix, but it's not a complete mapping. What you should assume is no builts at all. In the future my plan is to have a Shader Composer system for the OSG that will provide an automatic mapping from fixed function state in the form of uniforms and shaders. I've written about 1/3rd of the infrastructure for this funcitonality, but right now it's not operational. Robert. On Fri, Sep 10, 2010 at 12:29 PM, Rakesh Parmar rakes...@kpitcummins.com wrote: Hi List, Thanks for all the support.Now I am able to build Osg with opengl ES 2.0 without Qt and can run the sample programs. I am able to load the .3ds file but I am unable to render the correct material on the screen. Following is the source code I m using: Code: #include osgViewer/Viewer #include osgDB/ReadFile #include osg/MatrixTransform #include iostream #include osg/ShapeDrawable #include osg/Geode #include osgDB/ReadFile #includestdio.h //#includeosg/vec3 #includeUniform using namespace osg; osg::Uniform* _ClrUniform; static const char* vertSource = { // colors a fragment based on its position\n uniform vec3 color; \n varying mediump vec4 Finalcolor;\n void main(void) {\n Finalcolor = color;\n gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n }\n }; static const char* fragSource = { //SHADER_COMPAT varying mediump vec4 Finalcolor;\n void main(void) {\n gl_FragColor = Finalcolor;\n }\n }; int main( int, char ** ) { osgViewer::Viewer viewer; osg::setNotifyLevel(osg::INFO); ref_ptrGroup m_root = new Group; osg::Geode* geode = (osg::Geode* )osgDB::readNodeFile( info_icon.3ds ); osg::Program* program = new osg::Program; program-setName(shader); program-addShader(new osg::Shader(osg::Shader::VERTEX, vertSource)); program-addShader(new osg::Shader(osg::Shader::FRAGMENT, fragSource)); geode-getOrCreateStateSet()-setAttributeAndModes(program, osg::StateAttribute::ON); _ClrUniform = new osg::Uniform(color,osg::Vec3(1.0,0.0,0.0));//Initializing the uniform osg::StateSet *stateSet = geode-getOrCreateStateSet(); stateSet-addUniform(_ClrUniform); stateSet-setMode(GL_BLEND, osg::StateAttribute::ON); m_root-addChild(geode); viewer.setUpViewInWindow( 32, 32, 1024, 600 ); viewer.setSceneData(m_root.get()); return viewer.run(); } I have looked at material.cpp and tried to set the Uniform for material.But somehow its not updating in the application.It is taking black color by default. I think that, they have not handled the material property for ES 2.0 in material.cpp I have tried modifying the code in material.cpp in void Material::apply(State) const function. The modified code is as follows: osg::Uniform* _myClrUniform; _myClrUniform-set( osg::Vec3(_diffuseFront.x(), _diffuseFront.y(), _diffuseFront.z()) ); [/code] How can I set the material property of every object through application for .3DS file? Any help will be appreciated. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=31514#31514 ___ 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] How to build OSG 2.9.8 for Emulator on linux
Hi List, Thanks for all the support.Now I am able to build Osg with opengl ES 2.0 without Qt and can run the sample programs. I am able to load the .3ds file but I am unable to render the correct material on the screen. Following is the source code I m using: Code: #include osgViewer/Viewer #include osgDB/ReadFile #include osg/MatrixTransform #include iostream #include osg/ShapeDrawable #include osg/Geode #include osgDB/ReadFile #includestdio.h //#includeosg/vec3 #includeUniform using namespace osg; osg::Uniform* _ClrUniform; static const char* vertSource = { // colors a fragment based on its position\n uniform vec3 color; \n varying mediump vec4 Finalcolor;\n void main(void) {\n Finalcolor = color;\n gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n }\n }; static const char* fragSource = { //SHADER_COMPAT varying mediump vec4 Finalcolor;\n void main(void) {\n gl_FragColor = Finalcolor;\n }\n }; int main( int, char ** ) { osgViewer::Viewer viewer; osg::setNotifyLevel(osg::INFO); ref_ptrGroup m_root = new Group; osg::Geode* geode = (osg::Geode* )osgDB::readNodeFile( info_icon.3ds ); osg::Program* program = new osg::Program; program-setName(shader); program-addShader(new osg::Shader(osg::Shader::VERTEX, vertSource)); program-addShader(new osg::Shader(osg::Shader::FRAGMENT, fragSource)); geode-getOrCreateStateSet()-setAttributeAndModes(program, osg::StateAttribute::ON); _ClrUniform = new osg::Uniform(color,osg::Vec3(1.0,0.0,0.0));//Initializing the uniform osg::StateSet *stateSet = geode-getOrCreateStateSet(); stateSet-addUniform(_ClrUniform); stateSet-setMode(GL_BLEND, osg::StateAttribute::ON); m_root-addChild(geode); viewer.setUpViewInWindow( 32, 32, 1024, 600 ); viewer.setSceneData(m_root.get()); return viewer.run(); } I have looked at material.cpp and tried to set the Uniform for material.But somehow its not updating in the application.It is taking black color by default. I think that, they have not handled the material property for ES 2.0 in material.cpp I have tried modifying the code in material.cpp in void Material::apply(State) const function. The modified code is as follows: osg::Uniform* _myClrUniform; _myClrUniform-set( osg::Vec3(_diffuseFront.x(), _diffuseFront.y(), _diffuseFront.z()) ); [/code] How can I set the material property of every object through application for .3DS file? Any help will be appreciated. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=31514#31514 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to build OSG 2.9.8 for Emulator on linux
Hi List, Please give me some pointer on this issue. Thank you. Cheers, Parmar. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=31137#31137 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to build OSG 2.9.8 for Emulator on linux
Hi Parmar, On Mon, Aug 30, 2010 at 7:15 AM, Rakesh Parmar rakes...@kpitcummins.com wrote: Please give me some pointer on this issue. I have done what I can, I've pointed your in the right direction as I have done to others and they have got on just fine, porting the OSG to iPhone, Android, Chrome. Is that you don't under CMake? Is it that you can't install or understand GLES emulators? People can't help you unless you show a little initialitive yourself and the ability to communicate clearly what you've attempted to do and where you've failed. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] How to build OSG 2.9.8 for Emulator on linux
Hi List, I have built osg 2.9.8 on linux but i m not getting how to build as a emulator on linux. Thank you! Cheers, Parmar -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=31094#31094 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to build OSG 2.9.8 for Emulator on linux
HI Paramar, On Fri, Aug 27, 2010 at 10:52 AM, Rakesh Parmar rakes...@kpitcummins.com wrote: I have built osg 2.9.8 on linux but i m not getting how to build as a emulator on linux. And what might you mean by emulator on linux as it really means nothing to me, I suspect others will also be rather clueless what you might mean. If you want effective support you need to specific about what you mean, you can't just wave you arms around and throw out meaningless words and expect others to know what's going on inside your head. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to build OSG 2.9.8 for Emulator on linux
Hi Roberts, I am really sorry for that. i would like to build OSG for OpenGL ES 2.0 but i dont have es 2.0 hardware. So i wanted to use es 2.0 emulator version of build .Before sending to forum i have searched on google but i didnt get it any info . i have read this link also. [url] http://www.openscenegraph.org/projects/osg/wiki/Community/OpenGL-ES [/url] but i am not getting how to do this. I have just started using OSG . So Please help me out. ... Thank you! Cheers, parmar -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=31096#31096 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to build OSG 2.9.8 for Emulator on linux
Hi Parmar, The settings for CMake are on the wiki page I specified. You'll need to download the GLES emulator libraries as well of course. The ones I used for Linux were from Imagination Technologies Ltd. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to build OSG 2.9.8 for Emulator on linux
Hi Robert, Thanks for your reply. I have seen CMakeLists.txt ,here we have to change according to the link you have given to me , Code: OPTION(OSG_GL2_AVAILABLE Set to OFF to disable use of OpenGL 2.x functions library. ON) or some where else. I am not getting it. PLease guide me how to run es 2.0 example using OSG. If you provide any link or sample it will be great. PLease help me out. Thank you! Cheers, Rakesh -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=31104#31104 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org