Re: [osg-users] Draw a triangle with front and back faces

2009-03-19 Thread Robert Osfield
Hi Raqin, To enable/disabe modes in OSG you use: stateset-setMode(GLenum, osg::StateAttribute::ON/OFF); In you case you probably want to disable back face culling. stateset-setMode(GL_CULL_FACE, osg::StateAttribute::OFF); Robert. 2009/3/18 Ruqin Zhang ruzh...@gmail.com Yes, the openGL

Re: [osg-users] Draw a triangle with front and back faces

2009-03-18 Thread Robert Osfield
Hi Ruqin, The OSG uses exactly the same name conventions and state granularity as OpenGL, typically you just need to change glName to osg::Name to find the right class to work with. In your case are you simply looking for two sided lighting? Robert. 2009/3/18 Ruqin Zhang ruzh...@gmail.com

Re: [osg-users] Draw a triangle with front and back faces

2009-03-18 Thread Ruqin Zhang
Thanks Robert. Alright, here is the deal. I'm trying to draw a 3D triangular mesh with osg. For some mesh, the calculated normal points to the inside. So, I want to draw both the front and back faces, which have opposite normals. Then you can render the mesh visible. Is there an example of this?

Re: [osg-users] Draw a triangle with front and back faces

2009-03-18 Thread Robert Osfield
Hi Ruqin, 2009/3/18 Ruqin Zhang ruzh...@gmail.com Thanks Robert. Alright, here is the deal. I'm trying to draw a 3D triangular mesh with osg. For some mesh, the calculated normal points to the inside. So, I want to draw both the front and back faces, which have opposite normals. Then you can

Re: [osg-users] Draw a triangle with front and back faces

2009-03-18 Thread Ruqin Zhang
Sorry about the confusion. Here is the openGL code that works: *triangle t;* *const float* pFltArrayN = t.getNormal();* *const float* pFltArray1 = t.getVert1();* *const float* pFltArray2 = t.getVert2();* *

Re: [osg-users] Draw a triangle with front and back faces

2009-03-18 Thread Robert Osfield
Hi Ruqin, I'm not going to review your code as it's pointless, it's not seeing the wood from the trees. Answer the question I asked, is it back face culling that you are talking about?? In your OpenGL app did you enable/disable back face culling? Robert. 2009/3/18 Ruqin Zhang

Re: [osg-users] Draw a triangle with front and back faces

2009-03-18 Thread Ruqin Zhang
Yes, the openGL code enabled the back face culling. I think I didn't do this in osg, my bad. Where should I look for back face culling in osg? Something in example? Thanks! Ruqin 2009/3/18 Robert Osfield robert.osfi...@gmail.com Hi Ruqin, I'm not going to review your code as it's pointless,

[osg-users] Draw a triangle with front and back faces

2009-03-17 Thread Ruqin Zhang
Hi, I am trying to draw a triangle with filled front and back faces. In this way, even the normal of it has a wrong direction, I can still have it rendered correctly. I know how to do this in OpenGL, while didn't figure it out in OSG. Has anyone done this before? Please help me out with some