Skip to main content
gamedev.net
🔒 Locked

Texture co-ordinate problem

Started by last-bastardo 1 reply 200+ views
Original Post
last-bastardo
last-bastardo
If I have 2 traingles forming a square and want to texture a single texture map over those two triangles what are the texture co-ordinates I must employ. I have always texture mapped quads and never traingles so I don't see how you can specify three texture co-ordinates for a triangle when you need four. Please can somebody advise. -=Last Bastardo=- Edited by - last-bastardo on 7/8/00 10:24:15 AM
-=Last Bastardo=-
WitchLord
WitchLord

(0,0) (1,0)
+-----+
!\ !
! \ !
! \ !
! \ !
! \!
+-----+
(0,1) (1,1)


- WitchLord
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - <a href="http://www.angelcode.com/tower" rel
Facehat
Facehat
Just do it with triangle stripts, like so:

    
(in OpenGL code)

glBegin(GL_TRIANGLE_STRIP);

glTexCoord2f(0.0f, 0.0f);
glVertex3f(-1.0f, 1.0f, -1.0f); //top left

glTexCoord2f(1.0f, 0.0f);
glVertex3f( 1.0f, 1.0f, -1.0f); //top right

glTexCoord2f(0.0f, 1.0f);
glVertex3f(-1.0f,-1.0f, -1.0f); //bottom left

glTexCoord2f(0.0f, 1.0f);
glVertex3f( 1.0f,-1.0f, -1.0f); //bottom right


glEnd();



I haven''t used opengl in a while, so you might need to do a couple of things like switch the culling order.

BTW, you really should read up on this a bit more if you don''t understand it.

----------------------------------------
Whenever I see an old lady slip and fall on a wet sidewalk, my first instinct is to laugh. But then I think, what if I was an ant and she fell on me? Then it wouldn't seem quite so funny.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.