Texture coord question

Started by
10 comments, last by Mulligan 21 years, 5 months ago
Well, the number 40 I chose after some experimentation, choosing values (I think I started out at 10), and seeing what effect it had on the scale of the texture. If you scale the texture too little, you get artifacts when you''re up close to it, and if you scale it too much you can''t see the detail of the texture. 40 seemed to be just right. I think it scales down a 64x64 texture to be about 32x32 or 16x16 on the polygon. It''s a good trade off when considering the above scaling problem.

Tri_TexCoords() are the texture coords of the three vertices of that triangle. The declaration is this:

Tri_TexCoords(1 To 3, 1 To 2) As GLfloat

Basically, there are three (the "1 To 3" bit) pairs (the "1 To 2" bit) of texture coords, one for each vertex in the triangle. It''s a two-dimensional array. In C it would be:

GLfloat Tri_TexCoords[3][2];

The for loop runs through the three vertices of the triangle, multiplies every x, y, z element of the vertex by the x, y, z elements of sCoord and tCoord and then adds together the products of those multiplications to get the s texture coord and t texture coord respectively.

I hope this is explained well enough here for you to understand it, like I said before, it''s kinda difficult without pictures. I''ll try to do it in C:


  for(int y=0;y<3;y++){        // Get the s texture coord...    TextureCoord[y][0] = (sCoord[0] * Vertex[y][0]) +                         (sCoord[1] * Vertex[y][1]) +                         (sCoord[2] * Vertex[y][2]);        // Get the t texture coord...    TextureCoord[y][1] = (tCoord[0] * Vertex[y][0]) +                         (tCoord[1] * Vertex[y][1]) +                         (tCoord[2] * Vertex[y][2]);    }  

I had to think about that! I''ve been using VB to develop my map editor for some time now, and VB''s syntax is nothing compared to C. Anyway, that''s it. Do you have a website with some pictures of your map editor on it? I''d be interested to see how you''re doing it...

Movie Quote of the Week:

"Mr. Madison, what you have just said is one of the most insanely
idiotic things I have ever heard. At no point in your rambling,
incoherent response were you even close to anything that could
be considered a rational thought. Everyone in this room is now
dumber for having listened to it. I award you no points, and may
God have mercy on your soul."
- The Principal, Billy Madison.Try http://uk.geocities.com/mentalmantle. Seriously. It''s brilliant.
And I just completely redesigned it so it looks even better.
DarkVertex Beta 0.8 available soon!
My opinion is a recombination and regurgitation of the opinions of those around me. I bring nothing new to the table, and as such, can be safely ignored.[ Useful things - Firefox | GLee | Boost | DevIL ]
Advertisement
You figured it out, cool

Movie Quote of the Week:

"Mr. Madison, what you have just said is one of the most insanely
idiotic things I have ever heard. At no point in your rambling,
incoherent response were you even close to anything that could
be considered a rational thought. Everyone in this room is now
dumber for having listened to it. I award you no points, and may
God have mercy on your soul."
- The Principal, Billy Madison.Try http://uk.geocities.com/mentalmantle. Seriously. It''s brilliant.
And I just completely redesigned it so it looks even better.
DarkVertex Beta 0.8 available soon!
My opinion is a recombination and regurgitation of the opinions of those around me. I bring nothing new to the table, and as such, can be safely ignored.[ Useful things - Firefox | GLee | Boost | DevIL ]

This topic is closed to new replies.

Advertisement