Re: [osg-users] Bump mapping with embedded maps in OBJs and OpenGL ES 2.0 programmable pipeline

2012-08-07 Thread Sergey Polischuk
Hi osg automatically convert gl_Vertex, gl_MultiTexCoordX, gl_Normal, gl_ModelViewProjectionMatrix, gl_ProjectionMatrix (+ inverse), gl_ModelViewMatrix (gl_NormalMatrix?, gl_FragColor?, iirc this is complete list) to osg builtins, ftransform() - to osg_ModelViewProjectionMatrix * osg_Vertex. I

Re: [osg-users] Bump mapping with embedded maps in OBJs and OpenGL ES 2.0 programmable pipeline

2012-08-07 Thread John Moore
hybr wrote: > In gles 2.0 shaders dont have builtins like gl_MultiTexCoord gl_Color > gl_FrontColor\gl_BackColor gl_TexCoord gl_FragColor etc, and ftransform too. > Check gles 2.0 spec. > Use your own varyings and attributes, use your own output from fragment > shader(and dont forget to bind st

Re: [osg-users] Bump mapping with embedded maps in OBJs and OpenGL ES 2.0 programmable pipeline

2012-08-07 Thread John Moore
ok, I understand... but is there anyway to have a Geometry object from a osg::Node? I am trying with this lines of code but I have no success because "no geode is found" is printed. Code: osg::Geode *geode = dynamic_cast(_oggettoObj.get()); if (geode) { std::cout <<

Re: [osg-users] Bump mapping with embedded maps in OBJs and OpenGL ES 2.0 programmable pipeline

2012-08-07 Thread Chris Hanson
On Tue, Aug 7, 2012 at 10:23 AM, Sergey Polischuk wrote: > In gles 2.0 shaders dont have builtins like gl_MultiTexCoord gl_Color > gl_FrontColor\gl_BackColor gl_TexCoord gl_FragColor etc, and ftransform > too. Check gles 2.0 spec. > Use your own varyings and attributes, use your own output from f

Re: [osg-users] Bump mapping with embedded maps in OBJs and OpenGL ES 2.0 programmable pipeline

2012-08-07 Thread Sergey Polischuk
In gles 2.0 shaders dont have builtins like gl_MultiTexCoord gl_Color gl_FrontColor\gl_BackColor gl_TexCoord gl_FragColor etc, and ftransform too. Check gles 2.0 spec. Use your own varyings and attributes, use your own output from fragment shader(and dont forget to bind stuff in osg::Program).

Re: [osg-users] Bump mapping with embedded maps in OBJs and OpenGL ES 2.0 programmable pipeline

2012-08-07 Thread John Moore
In this way it's using another shader that I did not write by myself and this shader is giving errors. Code: State::convertShaderSourceToOsgBuiltIns() ++Before Converted source void main() { gl_Position = ftransform(); gl_TexCoord[0] = gl_MultiTexCoord0; gl_FrontColor = gl_Color; } +++

Re: [osg-users] Bump mapping with embedded maps in OBJs and OpenGL ES 2.0 programmable pipeline

2012-08-07 Thread Sergey Polischuk
You can use visitor for that purpose: class TSVisitor: public osg::NodeVisitor { public: TSVisitor(): osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {} void apply(osg::Geode& geode) { for (unsigned i=0; i(geode.getDrawable(i));

Re: [osg-users] Bump mapping with embedded maps in OBJs and OpenGL ES 2.0 programmable pipeline

2012-08-07 Thread John Moore
Hi Sergey, I am looking to TangentSpaceGenerator and I need to pass a Geometry to the generate method. However I have a osg::Node data structure because I load data using obj reader. Code: _oggettoObj = osgDB::readNodeFile("provaBump/objconbump.obj"); then I create a tangent space with th

Re: [osg-users] Bump mapping with embedded maps in OBJs and OpenGL ES 2.0 programmable pipeline

2012-08-07 Thread Sergey Polischuk
Hi, John take a look at osgUtil::TangentSpaceGenerator Cheers, Sergey. 07.08.2012, 15:54, "John Moore" : > I just realized that I didn't linked the attributes tangent and binormals. > How can I compute them. I have stored in my OBJ only the information about > normals. > > -- >

Re: [osg-users] Bump mapping with embedded maps in OBJs and OpenGL ES 2.0 programmable pipeline

2012-08-07 Thread John Moore
I just realized that I didn't linked the attributes tangent and binormals. How can I compute them. I have stored in my OBJ only the information about normals. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=49189#49189 _

[osg-users] Bump mapping with embedded maps in OBJs and OpenGL ES 2.0 programmable pipeline

2012-08-07 Thread John Moore
Hi, I am trying to write a shader to do bump mapping using OSG and OpenGL ES 2.0 in a mobile platform (iOS). My 3d models are saved as OBJs. The bump map is embedded in the .MTL and declared in lines of the type: Code: newmtl brick2 Kd 0.80 0.80 0.80 illum 2 Ns 50.781250 map_Kd BRI