Sign in to follow this  
chris95219

Texture Quad - Reading RECT from file

Recommended Posts

chris95219    122
Hi. I'm trying to draw a specific rectangle out of a texture onto a texture quad. I am having some trouble finding out what to set the U and V coordinates to. For example here is my prototype:
bgeSprite::DrawEx(bgeVector &source_pos, float source_width, float source_height,  bgeVector &dest_pos, float dest_width, float dest_height, float rotation, BGECOLOR *color)
As you can see the user can specify the source position (x, y) and the source size(width and height). They can also specify the destination position and size. How do I find out the U and V coordinates that map to what the user wants? TIA!

Share this post


Link to post
Share on other sites
Evil Steve    2017
It depends entirely on the texture, not on the size or position of the quad. To map the whole texture to the quad, you'd use UV coords of (0, 0) to (1, 1).

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