PDA

View Full Version : Texture coords...



iNsAn1tY
08-17-2002, 03:23 PM
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...

SirKnight
08-17-2002, 04:44 PM
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

reubenhawkins
08-17-2002, 06:24 PM
If your OpenGL supports GL_VERTEX_SHADER_EXT you can generate TexCoords very fast with a shader program.

SirKnight
08-17-2002, 06:30 PM
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! http://www.opengl.org/discussion_boards/ubb/smile.gif

-SirKnight

iNsAn1tY
08-18-2002, 03:21 AM
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...

SirKnight
08-18-2002, 11:39 AM
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