Re: [osg-users] How to pass materail color of 3ds through shader using OpenGL ES 2.0
it got resolved . Code is perfect just we need to initialize uniform properly -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=31530#31530 ___ 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 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] Question about GLSL shaders
Hi Werner, On Fri, Sep 10, 2010 at 1:39 PM, Werner Modenbach werner.modenb...@texion.eu wrote: Does anybody know if it is possible inside a shader program to querry if a uniform sampler2D was set by uniform attribute or if it contains legal data? The OSG should report a warning when shaders fail to link and don't have the required uniforms. There isn't any way for the OSG or OpenGL to know what legal data is for you shaders, this is all down to you - if you put garbage in you'll get garbage out. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Digital Learning Foundation?
Hi JS, On Fri, Sep 10, 2010 at 2:14 PM, Jean-Sébastien Guay jean-sebastien.g...@cm- Searching for osgVolume info yesterday, I found this site: http://dlfresources.pbworks.com/donations%20Open%20Source Seems they ask for donations for supporting osgVolume, Present3D and other OSG related things. I was wondering, did they actually do any work on these projects? Or are they sending their donation money to you, Robert? The DLF secured funding for the development of osgVolume, this work I was commissioned to undertake. The DLF continue to seek a further round of funding for further development of osgVolume and Present3D, if we can achieve this then I'll be again commissioned to put the requirements into code ;-) Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgViewer direct support for depth partitioning and stereo
Hi Paul, On Fri, Sep 10, 2010 at 4:22 PM, Paul Martz pma...@skew-matrix.com wrote: With respect to depth partitioning, I've successfully implemented this with a custom RenderStage. The CullVisitor does a single cull on the entire view volume, but the custom RenderStage does multiple draw passes, varying the projection matrix appropriately for each pass. This is not yet open source, but I wanted to mention it so that you know it's possible. Doesn't this result in some objects getting sent to OpenGL twice even though they will get clipped by the near/far planes? For performance and ease of high level management I would still strongly recommend the slave Camera approach. This approach will allow the view frustum to cull subgraphs efficiently so that only components that will continue to each partition will be dispatched to OpenGL. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Digital Learning Foundation?
Hi Robert, The DLF secured funding for the development of osgVolume, this work I was commissioned to undertake. The DLF continue to seek a further round of funding for further development of osgVolume and Present3D, if we can achieve this then I'll be again commissioned to put the requirements into code ;-) Ok, thanks for clearing this up. There seems to be a large number of startups these days that are set up only to sell products entirely based on open source code without giving proper credit or distributing their modifications, hoping no one ever picks up on their GPL/LGPL/other license violations. Good to see this wasn't such a case. J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgViewer direct support for depth partitioning and stereo
Robert Osfield wrote: Hi Paul, On Fri, Sep 10, 2010 at 4:22 PM, Paul Martz pma...@skew-matrix.com wrote: With respect to depth partitioning, I've successfully implemented this with a custom RenderStage. The CullVisitor does a single cull on the entire view volume, but the custom RenderStage does multiple draw passes, varying the projection matrix appropriately for each pass. This is not yet open source, but I wanted to mention it so that you know it's possible. Doesn't this result in some objects getting sent to OpenGL twice even though they will get clipped by the near/far planes? Correct. This solution is therefore well-suited to apps that are cull limited. In my experience, this is the majority of OSG apps that I work with. For performance and ease of high level management I would still strongly recommend the slave Camera approach. This approach will allow the view frustum to cull subgraphs efficiently so that only components that will continue to each partition will be dispatched to OpenGL. Robert. -- -Paul Martz Skew Matrix Software http://www.skew-matrix.com/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] osgGA modifications for IPhone and other stuff
Hi Stephan and everyone else I've been thinking a little about multi touch support for osgGA for use with IPhones and other multi touch devices. I've got a few things I'd like others thoughts on before beginning. -Firstly do we treat multi touch inputs as completely separate event types, or do we have an array for each of the mouse event variables and treat them as if there were multiple mice? -If we use the first method do we still use touch one as if it is the mouse, basically generating two events a mouse and touch1 event? -Do we make the system capable of handling any number of inputs all encapsulated under the same event type or do we just support the current max of 4 points and have a different event type for each? -Do we also add support for the other input devices that are now becoming common place? -Accelerometers -3 Axis gyros -And on a slightly different note what do people think of adding two new event types -RECEIVE_FOCUS -LOOSE_FOCUS My hud system is starting to need them and I can't think of a way to find when the mouse enters/leaves the window without osgGA supporting it. Cheers Tom ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org