tags:

views:

305

answers:

3
A: 

You're not setting texture coordinates for the last 2 vertices (5 and 6) on the second quad.

Kevin
A: 

But how i do that, because i runned out coords for the first 4 vertices?

nunolourenco
+2  A: 

When you see this line of code:

glTexCoord2f(0.0,1.0);  glVertex3f(-1.0f * size, -1.0f* size, 0);    //1

the first statement, glTexCoord2f() specifies which point of the texture to hook up to the specified vertex (glVertex3f()). For each vertex you have to tell which point of the texture to map to it.

It might be usefull for you to look here: GameDev.NET - OpenGL texture mapping: An introduction Especially the part of "The texture coordinate system".

Hope this helps!

*edit, try http://nehe.gamedev.net/ as well! alot of OpenGL tutorials/articles, tutorial Lesson 6 has texture mapping in it. :) (Although it's not a very good example of good coding practice)

Kevin
Thanks for your help ;)
nunolourenco
That's what SO's for! Have fun! And if you get something neat going I'd love to see it. :)
Kevin
Sure, I am doing a project to a course of this semester. When is finished I will be happy to show you :)
nunolourenco
Nice, you can find my contact details through my site. (lower right is a "contact" link). Good luck with the project and your course!
Kevin