PDA

View Full Version : texture mapping



lyd
11-21-2004, 01:07 PM
hi, I'm a littlebit confused about texture mapping on abitrary objects. For instants I want to texture an object with a cylindrical projection.
First I have to find the texture coordinates for the cylinder and then I have to calculate the coordiantes of each Vertex projected on the face of the cylinder. Is this right?
But how should I implement this in Opengl? I mean I don't want to draw the Cylinder, but I have to bind the Texture to the Cylinder face - or? I'm not sure which order of functions I have to choose. Perhaps anybody knows a good tutorial for this problem.
thanks

jwatte
11-21-2004, 04:49 PM
GL only does linear texture coordinate generation, or spherical/cubical environment mapped coordinate generation. If you want another texture coordinate generation, you have to calculate the texture coordinates yourself.

Look into glTexCoord2f() for how to pass a texture coordinate. Look into your basic 3D graphics and math reference for what the appropriate texture coordinate generation functions are.

marco_dup1
11-22-2004, 07:03 AM
You can use vertex shader to compute the texture coordinates too. But this is done every time you draw the geometry so its better you do it for static geometry to your own and use glTexCoord2f.