11-03-2005, 01:08 AM
Hi all,
Ive got a square texture created from an NSImage, what I would like to do is draw a tetrahedon(sp?) with four sides, and on each side draw this texture fully within the triangle, as a square entirely within each triangular face.
So Ive gotten the tetrahedron drawn without any problems, but I seem to be getting lost drawing the square texture within it.
...the best Ive managed is to draw a corner of the image inside the triangle...
has anyone seen this done or got any suggestions?
here is my latest (unsuccessful) effort
glBegin( GL_TRIANGLES ); // Draw a triangle
glVertex3f( 1.0f, 1.0f, 1.0f );
glVertex3f( 1.0f, -1.0f, -1.0f );
glVertex3f( -1.0f, 1.0f, -1.0f );
glEnd();
glBegin( GL_QUADS );
glTexCoord2f( 0.0f, 0.0f );
glTexCoord2f( 1.0f, 0.0f );
glTexCoord2f( 1.0f, 1.0f );
glTexCoord2f( 0.0f, 1.0f );
glEnd();
Ive got a square texture created from an NSImage, what I would like to do is draw a tetrahedon(sp?) with four sides, and on each side draw this texture fully within the triangle, as a square entirely within each triangular face.
So Ive gotten the tetrahedron drawn without any problems, but I seem to be getting lost drawing the square texture within it.
...the best Ive managed is to draw a corner of the image inside the triangle...
has anyone seen this done or got any suggestions?
here is my latest (unsuccessful) effort
glBegin( GL_TRIANGLES ); // Draw a triangle
glVertex3f( 1.0f, 1.0f, 1.0f );
glVertex3f( 1.0f, -1.0f, -1.0f );
glVertex3f( -1.0f, 1.0f, -1.0f );
glEnd();
glBegin( GL_QUADS );
glTexCoord2f( 0.0f, 0.0f );
glTexCoord2f( 1.0f, 0.0f );
glTexCoord2f( 1.0f, 1.0f );
glTexCoord2f( 0.0f, 1.0f );
glEnd();