Wednesday, August 29, 2012

[android-developers] using pixel coordinates in opengl es 2

Hi,

I downloaded and played with the opengl sample at
http://developer.android.com/training/graphics/opengl/draw.html

However, it uses the standard coordinate system for opengl, where 0,0
is at the center of the screen and -1,-1 at top-left and 1,1 at bottom-
right.

I want to use the screen's coordinate, where 0,0 is at top-left and
width,height is at bottom-right.

I already tried a dozen things, read about 30 articles, but since i'm
a newbie at opengl, i'm still stumped.

Can someone tell what it has to be done to change the coordinate so
that the given rectangle

static float squareCoords[] = { 10f, 10f, 0.0f, // top left
10f, 20f, 0.0f, // bottom left
20f, 20f, 0.0f, // bottom right
20f, 10f, 0.0f }; // top right

... is shown at screen?

thanks

guich

--
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

No comments:

Post a Comment