PDA

View Full Version : 'unwrapping' textures



02-24-2003, 07:40 AM
I know barely anything about openGL, but I'm aware that it's often used to say wrap a 2d texture around a 3d model in games for eg.

What I'd really like to know, is can you take a 3d model, and then use openGL to 'unwrap' a 2d texture easily, possibly with hardware acceleration?

Many thanks,

Andrew Cowley

nexusone
02-24-2003, 07:50 AM
There are multiple types of data in a 3D model, vertex information(triangles), normal(lighting), color, texture coord(where to apply the texture) and the texture image data.

You can just read the model data and extract the texture information, if that is want.

Else I am not sure what you mean by 'unwrap'???



Originally posted by Andrewpcowley:
I know barely anything about openGL, but I'm aware that it's often used to say wrap a 2d texture around a 3d model in games for eg.

What I'd really like to know, is can you take a 3d model, and then use openGL to 'unwrap' a 2d texture easily, possibly with hardware acceleration?

Many thanks,

Andrew Cowley

02-24-2003, 08:36 AM
OK I guess I mean is it possible to create a 2d texture from a 3d model (that doesn't have a texture) - akin to creating a contour map from a valley.

Thanks,

Andrew

nexusone
02-24-2003, 10:59 AM
Yes, it is called render to texture.

You load your model, render it then copy it into a texture buffer then you could save it or do some other processing to it.

Also could just do a render to screen and save the screen.



Originally posted by Andrewpcowley:
OK I guess I mean is it possible to create a 2d texture from a 3d model (that doesn't have a texture) - akin to creating a contour map from a valley.

Thanks,

Andrew

Deiussum
02-25-2003, 05:37 AM
I could be wrong, but I think he's talking about calculating texture coordinates for a model. If I remember right, 3ds called this "unwrapping" or something like that.

If that's the case, OpenGL won't help much for this if you want to store the calculated texture coordinates. You could possibly use texgen and feedback mode to do this, but I think you really would be better off calculating your own texcoords or having some modelling package do so for you.