Mapping problem in OpenGL

Started by
5 comments, last by Zeblar Nagrim 23 years, 9 months ago
Why doesn´t this triangle strip work? ( want to use tsrip not quadstrip)
        

		glBegin(GL_TRIANGLE_STRIP);

			glNormal3f  (0, 0, 1);

			glTexCoord2f(0, 0);
			glVertex3f  (0, 0, 0);

			glTexCoord2f(0, 1);
			glVertex3f  (0, 1, 0);

			glTexCoord2f(1, 0);
			glVertex3f  (1, 0, 0);

			glTexCoord2f(1, 1);
			glVertex3f  (1, 1, 0);

		glEnd();

        
Thanks, Zeblar Nagrim, Lord of Chaos Edited by - Zeblar Nagrim on 7/13/00 2:56:44 AM
Advertisement
To make a triangle strip you draw the quad like a "z". Why can´t I get it to work in GL?

// 1 // 3

// 0 // 2

Alright the quad show up. But the mapping is totaly wrong:

To set u,v. right for a 1x1 size quad created with tstrip:

bottom left = 0,0
top left = 0,1
bottom left = 1,0
bottom top = 1,1

In GL it is:

bottom left = 0,1
top left = 0,0
bottom left = 1,1
bottom top = 1,0

Why this displacement?



Zeblar Nagrim, Lord of Chaos
I think I know the answer to my question now.
OpenGL draw primitives anti-clockwise and Direct3D the other way around.



Zeblar Nagrim, Lord of Chaos
Your texture coords look ok to me.

GL is indeed:
(0,0) bottom left
(0, 1) top left
(1, 1) top right
(1, 0) bottom right

So that''s not the problem.

It''s been a while since I''ve used triangle strips, so this is probably wrong, but try creating the first triangle of the strip with anti-clockwise winding. You may be drawing everything upside down. Then again I get the impression that I''m talking crap :p

I''ll try it out later.
Your texture coords look ok to me.

GL is indeed:
(0,0) bottom left
(0, 1) top left
(1, 1) top right
(1, 0) bottom right

So that''s not the problem.

It''s been a while since I''ve used triangle strips, so this is probably wrong, but try creating the first triangle of the strip with anti-clockwise winding. You may be drawing everything upside down. Then again I get the impression that I''m talking crap :p

I''ll try it out later.
Dear mr moderator.

Please forgive my abject stupidity by forgetting to enter my username and then posting twice.
HAHAH LOL

Actually it isn''t your fault totaly GDNET needs to make a login cookie for a month or year

This topic is closed to new replies.

Advertisement