Texture coords...

Hi there. I was just wondering if someone could tell me how to generate texture coords without using glTexGen[idf]?

I’m making a map maker, and I need the texture coords for when I compile the map.

I haven’t been able to find anything on the net, despite having searched quite a bit, and I just wanted to know if anyone here knew how to do it…

The RedBook shows the math behind glTexGen. It’s under the title: Creating Contours. In the 3rd edition it’s on page 414 if you have that edition.

-SirKnight

If your OpenGL supports GL_VERTEX_SHADER_EXT you can generate TexCoords very fast with a shader program.

If your OpenGL supports GL_VERTEX_SHADER_EXT you can generate TexCoords very fast with a shader program.

Yes or any vertex program extension for that matter. Like NV_vertex_program for NVIDIA cards for example.

But I think he wants to compute the tex coords while his map is compiling. So this way they are stored in his compiled map format and can then be read in and used directly instead of being computed at each vertex every frame. But if the way you’re doing the tex coord generation needs to be done at run-time then yes a nice vertex program would work great!

-SirKnight

Yeah, the problem is, my map maker is like WorldCraft, and when a brush is created, I need to generate the texture coords for every vertex so that the texture the user selected can be mapped on to the brush.

I’ll definitely look at the Red Book, and try to use the system glTexGen uses…

Also check out the GtkRadiant, QERadiant or Q3Radiant code. All three editors’ code is out so they might be worth while to check out. Also the q3map code is nice to see how they compute s/t pairs from the texture axis and other data in the map file that the editor made.

-SirKnight