Getting to the point in OpenGL ES
September 11, 2008 5:36 AM Subscribe
Drawing pixels with OpenGL ES 1.1?
Is there a straightforward way to draw (x, y) or (x, y, 0.0f) in OpenGL ES?
So far I have found
Thanks for any advice or example code.
Is there a straightforward way to draw (x, y) or (x, y, 0.0f) in OpenGL ES?
So far I have found
glDrawArrays
and glDrawElements
but these appear to be used to draw 1D or 2D elements (lines, triangles, etc.). My Google fu isn't helping me tonight.Thanks for any advice or example code.
I'm not an OpenGL ES expert, but I think your best bet would be to draw to a bitmap offscreen, then apply that as a texture to a quad. Then you set up an orthographic projection such that the quad fills the screen exactly to the edges, and such that one unit in OpenGL space equals one unit in pixel space, and voila. Here's some sample code that should be applicable.
Good luck!
posted by aparrish at 11:34 AM on September 11, 2008
Good luck!
posted by aparrish at 11:34 AM on September 11, 2008
This thread is closed to new comments.
glDrawElements(GL_POINTS, 0, num_points, point_array);
You can also use
glDrawArrays
if you useglVertexPointer
first.Use
glPointParameter
,glPointSize
, andglColor
to modify the appearance of the points. UsingglPointSizePointer
lets you specify an array of point sizes, which is handy for particle effects.posted by jedicus at 7:13 AM on September 11, 2008