Sign in to follow this  
Phoresis

Assigning texture co-ords on the fly

Recommended Posts

I'm wondering how I can assign texture co-ordinates to a many-sided 2d polygon, if the polygon is being built in a loop by reading data from a file i.e the program doesn't know what type of polygon is being read in.

Share this post


Link to post
Share on other sites
? Ok you have a model in a file. You are reading that polygon from a file right? If you can do that, then why not edit texture coords before loading the file.

How are you assigning them on the fly. There could be alot of ways to do this like: Select all the triangles and map them individually to a bitmap. Or you could project the entire polygon onto a bitmap.

Share this post


Link to post
Share on other sites
File reading functions should only be used for reading files, IMHO. If data is missing, just
assign default values to it, like zero.

Then, do your texture coordinate assignment after all data has been read.

Share this post


Link to post
Share on other sites
btw, you said you're reading in 2D data, so if you don't care about scale, just assign the same 2D vertex positions to the tex coords. Simple.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this