Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have been using the glDrawTexf extension to draw labels in my Android app using OpenGL ES 1.1.

But I have now moved to OpenGL ES 2.0 and can't figure out what is the equivalent of this call? I could create triangles to hold the texture and draw it like a regular texture. But the glDrawTexf was very convenient:

  • It didn't require any triangles/quads to be setup.
  • You could give it screen co-ordinates.
  • You could specify cropping parameters to pick smaller areas from a large texture.
share|improve this question

1 Answer 1

up vote 5 down vote accepted

However "convenient" it may have been, it was only ever that: a convenience. All it was ever doing was just drawing textured triangles.

OpenGL ES 2.0 doesn't have very many convenience functions. It's a bare-bones, relatively low-level rendering API. So that means you're going to have to build those convenience features yourself.

You can easily set up an orthographic projection matrix that provides a 1:1 correspondence between vertex coordinates a pixels. This allows you to work directly in pixel coordinates. The texture coordinates of your vertex data "crop" which texels of the texture are drawn.

share|improve this answer
    
I feared that would be the answer. I had already started coding a shader while I was waiting for someone to respond :) –  HRJ Oct 12 '11 at 19:12

Your Answer

 
discard

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.