[android-developers] my problems with point sprites
I'm trying to use point sprites in OpenGL on my HTC Desire. In the
emulator I've got them working, but on my phone nothing is displayed.
This is my first Android app though so I could quite easily have done
something wrong. Perhaps the emulator isn't configured to behave as a
Desire would.
I'm not sure if the problem is related to how I'm trying to use point
sprites; perhaps it's not supported on the Desire. It took me a while
to get the point sprites working in the emulator. I spent quite some
time looking for examples but only found a close-ish example and
combined that with a triangle example!
The three lines that actually perform the drawing are:
gl.glVertexPointer(2,GL11.GL_FIXED,0,mVertexBuffer); // these
are 2d point sprites
((GL11)(gl)).glPointSizePointerOES(GL10.GL_FIXED, 0,
mSizeBuffer);
gl.glDrawArrays(GL10.GL_POINTS,0,_numStars);
So a mixture of GL10 and 11 there. The mSizeBuffer is, laughably, an
array of 1's - one for each point. I have no idea why I have to do
this; suppling 'none' as a parameter doesn't work. But at least this
method allows me to make one call to plot all the point sprites; the
other way I've seen people render them is one at a time, in a bit java
loop, calling 10 or 20 OpenGL functions per dot. This seems crazy;
surely it'd be quicker to draw the point into the display yourself
than do that?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home