Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How would I take a texture and render it to a specific size? The texture I'm rendering has a 1:1 ratio so I want to be able to render the whole image like if the window is wide then put black outlines and the left and right and render the texture in the middle and if the window is taller (I don't see why it would be) then do the same with the texture by rendering lines at the top and bottom and rendering the texture in the middle. Does anyone know how to do this?

share|improve this question

You don't really need to change the texture at all, just change the size of the quad you're drawing the texture on. Make sure they maintain the correct aspect ration, and make the quad fit the constraints of the screen. Just re-size the quad to fit the screen and draw the texture full size on the quad.

Altering the texture based on the screen aspect ratio is much more difficult.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.