Re: Irregulars Question: OpenGL

2004-02-18 Thread Alberto Monteiro
Michael Harney wrote:

 I'm not familiar with OpenGL programming, but have used 3D programs and am
 familiar with vector mathematics.  The only thing I can think of trying is
 to try reversing the point order on the first triangle (which should flip
 the normal vector) and see if that fixes the problem.

No, it didn't.

Alberto Monteiro

___
http://www.mccmedia.com/mailman/listinfo/brin-l


Re: Irregulars Question: OpenGL

2004-02-18 Thread Alberto Monteiro
Steve Sloan wrote:

 I think you should get rid of the glNormal statement. 

No. No change at all :-(

Alberto Monteiro

___
http://www.mccmedia.com/mailman/listinfo/brin-l


Irregulars Question: OpenGL

2004-02-17 Thread Alberto Monteiro
I must be doing something _really_ stupid, but why I can't draw
even a simple tetrahedron with OpenGL? One of the faces does
not show :-/

Is there any magic word that I must utter before it works?

Alberto Monteiro

___
http://www.mccmedia.com/mailman/listinfo/brin-l


Re: Irregulars Question: OpenGL

2004-02-17 Thread Steve Sloan II
Alberto Monteiro wrote:

I must be doing something _really_ stupid, but why I can't
 draw even a simple tetrahedron with OpenGL? One of the faces
 does not show :-/
Is there any magic word that I must utter before it works?
I have two guesses:

1) Could OpenGL be culling the back-facing polygons? Try
   changing GL_FRONT to GL_FRONT_AND_BACK in various places,
   and see if that fixes it.
2) How are you drawing the tetrahedron? Are you using
   GL_TRIANGLES, or more complicated approaches like
   GL_TRIANGLE_STRIP or GL_TRIANGLE_FAN? If it's one of the
   latter two, you may be defining your points in the wrong
   order, which could either cause some triangles not to
   draw at all, or to flip the normal on one or more of the
   triangles, so they look like back-facing polygons (see (1)).
__
Steve Sloan . Huntsville, Alabama = [EMAIL PROTECTED]
Brin-L list pages .. http://www.brin-l.org
Science Fiction-themed online store . http://www.sloan3d.com/store
Chmeee's 3D Objects  http://www.sloan3d.com/chmeee
3D and Drawing Galleries .. http://www.sloansteady.com
Software  Science Fiction, Science, and Computer Links
Science fiction scans . http://www.sloan3d.com
___
http://www.mccmedia.com/mailman/listinfo/brin-l


Re: Irregulars Question: OpenGL

2004-02-17 Thread Alberto Monteiro
Steve Sloan II [I knew you would be the fist to jump :-)] wrote:

 I must be doing something _really_ stupid, but why I can't
 draw even a simple tetrahedron with OpenGL? One of the faces
 does not show :-/

 Is there any magic word that I must utter before it works?

 I have two guesses:

 1) Could OpenGL be culling the back-facing polygons? Try
 changing GL_FRONT to GL_FRONT_AND_BACK in various places,
 and see if that fixes it.

No, the program behaved even more strangely with this.

 2) How are you drawing the tetrahedron? Are you using
 GL_TRIANGLES, 

Yes.

The program is as simple as possible, and all but the first
triangle appear correctly. The first triangle, however, is invisible.

Essentially, this is the OpenGL part of the program: 

  glLoadIdentity();  

  glTranslatef(0.0f,0.0f,-15.0f);
  glRotated(m_angulo, m_x, m_y, m_z);

  glBegin(GL_TRIANGLES);// Draw Triangles

  glNormal3f(1.0f, 1.0f, 1.0f);// should be the yellow face, but is 
invisible
  glColor3f(1.0f, 1.0f, 0.0f);
  glVertex3f(1.0f, 0.0f, 0.0f);
  glVertex3f(0.0f, 1.0f, 0.0f);
  glVertex3f(0.0f, 0.0f, 1.0f);

  glColor3f(0.5f, 0.0f, 0.0f);
  glVertex3f(0.0f, 0.0f, 0.0f);
  glVertex3f(1.0f, 0.0f, 0.0f);
  glVertex3f(0.0f, 1.0f, 0.0f);

  glColor3f(0.0f, 0.5f, 0.0f);
  glVertex3f(0.0f, 0.0f, 0.0f);
  glVertex3f(0.0f, 1.0f, 0.0f);
  glVertex3f(0.0f, 0.0f, 1.0f);

  glColor3f(0.0f, 0.0f, 0.5f);
  glVertex3f(0.0f, 0.0f, 0.0f);
  glVertex3f(0.0f, 0.0f, 1.0f);
  glVertex3f(1.0f, 0.0f, 0.0f);

glEnd();
glLoadIdentity();   // Reset 

The interesting thing is that, if I begin with the Red Face,
then the Yellow Face becomes visible and the Red Face
becomes invisible.

Alberto Monteiro

___
http://www.mccmedia.com/mailman/listinfo/brin-l


Re: Irregulars Question: OpenGL

2004-02-17 Thread Michael Harney

From: Alberto Monteiro [EMAIL PROTECTED]



 The program is as simple as possible, and all but the first
 triangle appear correctly. The first triangle, however, is invisible.

 Essentially, this is the OpenGL part of the program:

   glLoadIdentity();

   glTranslatef(0.0f,0.0f,-15.0f);
   glRotated(m_angulo, m_x, m_y, m_z);

   glBegin(GL_TRIANGLES); // Draw Triangles

   glNormal3f(1.0f, 1.0f, 1.0f);// should be the yellow face, but
is
 invisible
   glColor3f(1.0f, 1.0f, 0.0f);
   glVertex3f(1.0f, 0.0f, 0.0f);
   glVertex3f(0.0f, 1.0f, 0.0f);
   glVertex3f(0.0f, 0.0f, 1.0f);

   glColor3f(0.5f, 0.0f, 0.0f);
   glVertex3f(0.0f, 0.0f, 0.0f);
   glVertex3f(1.0f, 0.0f, 0.0f);
   glVertex3f(0.0f, 1.0f, 0.0f);

   glColor3f(0.0f, 0.5f, 0.0f);
   glVertex3f(0.0f, 0.0f, 0.0f);
   glVertex3f(0.0f, 1.0f, 0.0f);
   glVertex3f(0.0f, 0.0f, 1.0f);

   glColor3f(0.0f, 0.0f, 0.5f);
   glVertex3f(0.0f, 0.0f, 0.0f);
   glVertex3f(0.0f, 0.0f, 1.0f);
   glVertex3f(1.0f, 0.0f, 0.0f);

 glEnd();
 glLoadIdentity();   //
Reset

 The interesting thing is that, if I begin with the Red Face,
 then the Yellow Face becomes visible and the Red Face
 becomes invisible.

 Alberto Monteiro


I'm not familiar with OpenGL programming, but have used 3D programs and am
familiar with vector mathematics.  The only thing I can think of trying is
to try reversing the point order on the first triangle (which should flip
the normal vector) and see if that fixes the problem.

Michael Harney
[EMAIL PROTECTED]

___
http://www.mccmedia.com/mailman/listinfo/brin-l


Re: Irregulars Question: OpenGL

2004-02-17 Thread Trent Shipley
On Tuesday 2004-02-17 06:57, Alberto Monteiro wrote:
 I must be doing something _really_ stupid, but why I can't draw
 even a simple tetrahedron with OpenGL? One of the faces does
 not show :-/

 Is there any magic word that I must utter before it works?

 Alberto Monteiro

 ___
 http://www.mccmedia.com/mailman/listinfo/brin-l

Dunno.

Try:
http://plug.phoenix.az.us/index.php

Perhaps join:
[EMAIL PROTECTED]

Before escalating to an OpenGL discussion group.
___
http://www.mccmedia.com/mailman/listinfo/brin-l


Re: Irregulars Question: OpenGL

2004-02-17 Thread Steve Sloan II
Alberto Monteiro wrote:

The program is as simple as possible, and all but
 the first triangle appear correctly. The first
 triangle, however, is invisible.
Essentially, this is the OpenGL part of the program: 

  glLoadIdentity();  

  glTranslatef(0.0f,0.0f,-15.0f);
  glRotated(m_angulo, m_x, m_y, m_z);

  glBegin(GL_TRIANGLES); // Draw Triangles

  glNormal3f(1.0f, 1.0f, 1.0f);
 // should be the yellow face, but is invisible
  glColor3f(1.0f, 1.0f, 0.0f);
  glVertex3f(1.0f, 0.0f, 0.0f);
  glVertex3f(0.0f, 1.0f, 0.0f);
  glVertex3f(0.0f, 0.0f, 1.0f);
I think you should get rid of the glNormal statement. It's not
the correct normal for a flat triangle with the vertices you've
given. If the object you want to create has perfectly flat
faces, you should avoid specifying normals at all. Just let
OpenGL automatically generate the correct normal. You should
only specify normals if you're trying to create a smoothly
curving object.
__
Steve Sloan . Huntsville, Alabama = [EMAIL PROTECTED]
Brin-L list pages .. http://www.brin-l.org
Science Fiction-themed online store . http://www.sloan3d.com/store
Chmeee's 3D Objects  http://www.sloan3d.com/chmeee
3D and Drawing Galleries .. http://www.sloansteady.com
Software  Science Fiction, Science, and Computer Links
Science fiction scans . http://www.sloan3d.com
___
http://www.mccmedia.com/mailman/listinfo/brin-l