Needs graphics formula

I'm using OpenGL to procedurely map a 2D texture onto a 3D object. Using the vertices and normal vectors for each point, what's the formula for calculating the texture coordinates for each point?
Assigning texture coordinates to vertices is the job of whoever made that model. There is no general way to do it procedurally.
Are you sure? I'm marking the vertices and normal vectors procedurally, so I would think there would be a formula to determine the texture coordinates of a point using the vertex and normal vector of that point, which would then procedurally be used to do the same for every point.

Basically, what I'm asking is: When you have the 3D coordinates and normal vector for a point, how do you calculate the 2D texture coordinates for that point?
Last edited on
As hamsterman said - this isn't something you do procedurally. Actually, you'd normally not even calculate the normals procedurally. There's no "formula" to assign texture coordinates to a vertex because there is no conceivable "right" way of mapping a texture onto an object.
If you're generating vertices procedurally too, this must be a simple shape. In that case, if you explained what that shape is and what kind of texture you want to map on it, we may be able to help.
ya I support the answer of @hamsterman Iam also ready to help.
Topic archived. No new replies allowed.