[osg-users] Normal bindings and triangle strips

2008-10-08 Thread Argentieri, John-P63223
Greetings All,

Is it possible to define a normal for every triangle without using
primitive type TRIANGLES? For instance, if I am using TRIANGLE_STRIP,
what is the effect of setting normals with BIND_PER_PRIMITIVE? And why
does BIND_PER_VERTEX seem so wrong on a triangle strip? If the triangle
strip faces are not radically different I guess it works ok. But it
seems impossible to declare normal vectors precisely when using triangle
strips. Am I missing something obvious?

Thanks,

John Argentieri
Software Engineer
GENERAL DYNAMICS
C4 Systems 
[EMAIL PROTECTED]


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Normal bindings and triangle strips

2008-10-08 Thread Paul Martz
Hi John -- I think normals with BIND_PER_PRIMITIVE on a N-triangle strip
would mean you have N-2 normals. As we discussed previously, you'll use the
OpenGL slow path (albeit stored in a display list) so the effective OpenGL
calls would be:
  glVertex3f
  glVertex3f
  glNormal3f // normal for first triangle
  glVertex3f
  glNormal3f // normal for second triangle
  glVertex3f
  glNormal3f // normal for third triangle
  glVertex3f
  ...etc...
 
This should result in a typical faceted appearance (with glShadeModel set to
GL_FLAT). However, if you want smooth shading, you'll want to use
BIND_PER_VERTEX of course. Which brings us to the next topic...
 
I'm not sure why you are having problems with BIND_PER_VERTEX in a tri
strip. It works just like BIND_PER_VERTEX with any other primitive type.
Perhaps you could provide more information about the problem you're
encountering. You say it works OK if the faces aren't radically different
but I'm not sure why you'd use BIND_PER_VERTEX if you were not trying to get
a smooth-shaded result. What type of surface are you trying to render,
anyway? Do you encounter the same issue in a vanilla OpenGL app? 
 
Paul Martz
Skew Matrix Software LLC
http://www.skew-matrix.com http://www.skew-matrix.com/ 
+1 303 859 9466
 


  _  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Argentieri,
John-P63223
Sent: Wednesday, October 08, 2008 12:34 PM
To: [EMAIL PROTECTED]
Subject: [osg-users] Normal bindings and triangle strips



Greetings All, 

Is it possible to define a normal for every triangle without using primitive
type TRIANGLES? For instance, if I am using TRIANGLE_STRIP, what is the
effect of setting normals with BIND_PER_PRIMITIVE? And why does
BIND_PER_VERTEX seem so wrong on a triangle strip? If the triangle strip
faces are not radically different I guess it works ok. But it seems
impossible to declare normal vectors precisely when using triangle strips.
Am I missing something obvious?

Thanks, 

John Argentieri 
Software Engineer 
GENERAL DYNAMICS 
C4 Systems 
[EMAIL PROTECTED] 


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Normal bindings and triangle strips

2008-10-08 Thread Argentieri, John-P63223
Paul,
 
I'm just trying to learn how it works. If the way you've described it is
in fact how I can give each triangle its own normal in a triangle strip,
then I thank you my friend. I hope that this is how it works in OSG when
using tri strip and bind per primitive.
 
What about bind per vertex and tri strips? Can a vertex have more than
one normal in this case as well?
 
Thanks pal,
John




From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Paul
Martz
Sent: Wednesday, October 08, 2008 3:11 PM
To: 'OpenSceneGraph Users'
Subject: Re: [osg-users] Normal bindings and triangle strips


Hi John -- I think normals with BIND_PER_PRIMITIVE on a N-triangle strip
would mean you have N-2 normals. As we discussed previously, you'll use
the OpenGL slow path (albeit stored in a display list) so the effective
OpenGL calls would be:
  glVertex3f
  glVertex3f
  glNormal3f // normal for first triangle
  glVertex3f
  glNormal3f // normal for second triangle
  glVertex3f
  glNormal3f // normal for third triangle
  glVertex3f
  ...etc...
 
This should result in a typical faceted appearance (with glShadeModel
set to GL_FLAT). However, if you want smooth shading, you'll want to use
BIND_PER_VERTEX of course. Which brings us to the next topic...
 
I'm not sure why you are having problems with BIND_PER_VERTEX in a tri
strip. It works just like BIND_PER_VERTEX with any other primitive type.
Perhaps you could provide more information about the problem you're
encountering. You say it works OK if the faces aren't radically
different but I'm not sure why you'd use BIND_PER_VERTEX if you were
not trying to get a smooth-shaded result. What type of surface are you
trying to render, anyway? Do you encounter the same issue in a vanilla
OpenGL app? 
 
Paul Martz
Skew Matrix Software LLC
http://www.skew-matrix.com http://www.skew-matrix.com/ 
+1 303 859 9466
 




From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Argentieri, John-P63223
Sent: Wednesday, October 08, 2008 12:34 PM
To: [EMAIL PROTECTED]
Subject: [osg-users] Normal bindings and triangle strips



Greetings All, 

Is it possible to define a normal for every triangle without
using primitive type TRIANGLES? For instance, if I am using
TRIANGLE_STRIP, what is the effect of setting normals with
BIND_PER_PRIMITIVE? And why does BIND_PER_VERTEX seem so wrong on a
triangle strip? If the triangle strip faces are not radically different
I guess it works ok. But it seems impossible to declare normal vectors
precisely when using triangle strips. Am I missing something obvious?

Thanks, 

John Argentieri 
Software Engineer 
GENERAL DYNAMICS 
C4 Systems 
[EMAIL PROTECTED] 


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Normal bindings and triangle strips

2008-10-08 Thread Paul Martz
Hi John -- BIND_PER_VERTEX is BIND_PER_VERTEX, just one normal for each
vertex. To approximate a curved surface, apps typically average the facet
normals from each facet that shares a vertex, and use that average normal as
the normal for that vertex. I'm pretty sure the SmoothingVisitor does this
for you.
 
If I remember correctly, the OpenGL red book goes into some detail about why
you would want normals per facet or per vertex, and how to compute normals
at each vertex.
   -Paul
 


  _  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Argentieri,
John-P63223
Sent: Wednesday, October 08, 2008 2:01 PM
To: [EMAIL PROTECTED]
Subject: Re: [osg-users] Normal bindings and triangle strips


Paul,
 
I'm just trying to learn how it works. If the way you've described it is in
fact how I can give each triangle its own normal in a triangle strip, then I
thank you my friend. I hope that this is how it works in OSG when using tri
strip and bind per primitive.
 
What about bind per vertex and tri strips? Can a vertex have more than one
normal in this case as well?
 
Thanks pal,
John


  _  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Paul Martz
Sent: Wednesday, October 08, 2008 3:11 PM
To: 'OpenSceneGraph Users'
Subject: Re: [osg-users] Normal bindings and triangle strips


Hi John -- I think normals with BIND_PER_PRIMITIVE on a N-triangle strip
would mean you have N-2 normals. As we discussed previously, you'll use the
OpenGL slow path (albeit stored in a display list) so the effective OpenGL
calls would be:
  glVertex3f

  glVertex3f
  glNormal3f // normal for first triangle

  glVertex3f

  glNormal3f // normal for second triangle

  glVertex3f

  glNormal3f // normal for third triangle

  glVertex3f
  ...etc...
 
This should result in a typical faceted appearance (with glShadeModel set to
GL_FLAT). However, if you want smooth shading, you'll want to use
BIND_PER_VERTEX of course. Which brings us to the next topic...
 
I'm not sure why you are having problems with BIND_PER_VERTEX in a tri
strip. It works just like BIND_PER_VERTEX with any other primitive type.
Perhaps you could provide more information about the problem you're
encountering. You say it works OK if the faces aren't radically different
but I'm not sure why you'd use BIND_PER_VERTEX if you were not trying to get
a smooth-shaded result. What type of surface are you trying to render,
anyway? Do you encounter the same issue in a vanilla OpenGL app? 
 

Paul Martz
Skew Matrix Software LLC
http://www.skew-matrix.com http://www.skew-matrix.com/ 
+1 303 859 9466
 


  _  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Argentieri,
John-P63223
Sent: Wednesday, October 08, 2008 12:34 PM
To: [EMAIL PROTECTED]
Subject: [osg-users] Normal bindings and triangle strips



Greetings All, 

Is it possible to define a normal for every triangle without using primitive
type TRIANGLES? For instance, if I am using TRIANGLE_STRIP, what is the
effect of setting normals with BIND_PER_PRIMITIVE? And why does
BIND_PER_VERTEX seem so wrong on a triangle strip? If the triangle strip
faces are not radically different I guess it works ok. But it seems
impossible to declare normal vectors precisely when using triangle strips.
Am I missing something obvious?

Thanks, 

John Argentieri 
Software Engineer 
GENERAL DYNAMICS 
C4 Systems 
[EMAIL PROTECTED] 


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org