Strange behavior of glDrawTexiOES on 854x480 screen

Tutorials concerning the OpenGL® ES cross-platform API for full-function 2D and 3D graphics on the Google-Android platform.

Strange behavior of glDrawTexiOES on 854x480 screen

Postby frustrateddev » Sun May 02, 2010 11:38 pm

I'm currently doing a small test app using OpenGL, and to render text on top of the screen, I'm using glDrawTexiOES just like the LabelMaker sample class does in ApiDemos.
Of course, I've added the necessary <supports-screens> stuff in the manifest (everything set to "true") so that it sets the correct resolution.

On the emulator, everything works fine, but on the phone however, the text is offset and appears scaled.
I've found out that on the phone glDrawTexiOES uses different screen coordinates, so that the x coords are 0 to 800 instead of 0 to 854 like it should be, and that causes the text offset, however onSurfaceChanged() still reports a screen resolution of 854x480.

So how come glDrawTexiOES doesn't use the screen resolution as its coords like it should ?
Is there something i'm doing wrong, or is it a known issue ?
Also is there another way of doing this without using glDrawTexiOES ?

I can post code if anyone wants, though the bug also appears when running the ApiDemos sample on the phone (with correct <supports-screens>)...
for reference, the device is a Xperia X10 running android 1.6 (is that the issue ? i read that the 854x480 resolution is a android 2.0 thing :/)
Posts: 2
Joined: Sun May 02, 2010 10:55 pm


Postby » Mon May 03, 2010 4:33 am

Hey, although I'm by no means an expert, and might actually be giving you wrong advice, I would suggest you check out ... pport.html . It could be that your droid (I assume) is simply upscaling your texture because of the resource directory its using for it.
User avatar
Posts: 41
Joined: Tue Mar 02, 2010 8:33 pm

Postby frustrateddev » Mon May 03, 2010 11:27 pm

Thanks for the hint, unfortunately i already took a look at that page and followed the necessary steps :cry:
My manifest includes :
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <supports-screens
  3.          android:largeScreens="true"
  5.          android:normalScreens="true"
  7.          android:smallScreens="true"
  9.          android:resizable="true"
  11.          android:anyDensity="true" />
Parsed in 0.000 seconds, using GeSHi

This doesn't change anything concerning glDrawTexiOES, also the texture used for drawing text is not in any folder, but generated through a Bitmap (its SetDensity is set to NO_DENSITY, but changing it has no effect)
Basically, the relevant characters are drawn in the bitmap then this bitmap is used as a texture and the different chars are cropped to be drawn.
I don't think that's the issue unfortunately, i think i'll try not using glDrawTex, unless there's some way to retrieve the max coords, but i doubt that :(

(btw, sorry for my english, i'm french)
Posts: 2
Joined: Sun May 02, 2010 10:55 pm


Return to Android 2D/3D Graphics - OpenGL Tutorials

Who is online

Users browsing this forum: No registered users and 2 guests