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

As a Direct3D developer I can use the ID3DXSprite class (in D3DX library) for drawing 2D graphics. What's the best way to implement this functionality in OpenGL?

share|improve this question
Which version of OpenGL? – Amplify91 Aug 10 '11 at 16:37
OpenGL 3.3 core profile. – MaxFX Aug 11 '11 at 6:19

I think, that if you want to draw just 2D sprite on screen, you can simply draw textured rectangle.

If sprite should be square, you can also draw point with point size set bigger than 1 and some texture enabled. But I don't know, if you can set some texture coordinates in vertex shader (but probably not, because you have just one point). Other way is to split this one point in geometry shader and assign corresponding texture coordinates.

share|improve this answer
You can use point sprites in OpenGL for which texture coordinates are generated automatically for the four corners. But I think point sprites are regarded deprecated, so your rectangle version is the method of choice (should be faster than gshader). – Christian Rau Aug 10 '11 at 16:25
@Christian: Point sprites are neither deprecated nor removed from OpenGL. The reason not to use them is that they are clipped as center of the point, rather than the boundary of the generated geometry. Well, they're clipped that way on ATI hardware, since they follow the OpenGL spec. NVIDIA clips them the way you would want, but that's not allowed by the spec. – Nicol Bolas Aug 10 '11 at 20:26

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.