Uniform texture on a surface made by triangles

@jmonillo said: I fail to see it, I'm sorry. How would that be with, for instance, a pentagon?

Check how I assign the texture in this video from about 20min on, that should make it clearer. Best watch the whole video.

1 Like
@jmonillo said: I fail to see it, I'm sorry. How would that be with, for instance, a pentagon?

That would depend on how you wanted the texture to appear on the pentagon.

Forgive my crude drawing:

The one on the left is showing you what “texture space” is. No matter what size your texture is in pixels, OpenGL will treat it as a coordinate space from 0…1 as zarch described.

The other two show possible ways to map texture coordinates to the pentagon. There are literally an infinite number of ways depending on the effect desired. For example, you could also give each triangle the exact same texture coordinates in which case each triangle in the pentagon would look like clones of each other.

If the information provided still isn’t making it click then there are bound to be several good places to look online to understand “texture mapping”. This is pretty basic information and we tend to assume the user has some passing familiarity with these concepts already.

A google search for “texture coordinates” seemed to yield better results than “texture mapping”. Here is the first link:

…at the bottom it includes a direct reference to the OpenGL red book. That’s probably useful reading even if the other answers start making it click.

1 Like

Click!

Now I see it. I don’t know why I wasn’t seeing those coordinates referred to the texture. Many thanks.

Now I have the problem of calculating which texture coordinates should have a vertex on an arbitrary polygon. I don’t know how, but I’ll work on it.

@normen : I haven’t been able to look the video yet, because I have a bad internet connection. I expect seeing it soon. Thanks.

Inspiration came to me during the siesta, and yesterday in the evening I manage to write the code that calculates texture coordinates from 3D coordinates. I have tested in two shapes:


There’s still this strange effect on lightning when I add or remove the first piece (lightning of the room changes). So, something goes wrong.

But as the topic is “Uniform texture on a surface made by triangles” I will call this “solved”, while I work on the other problems.

Many thanks for all of you that brought me your help.

1 Like