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

Hi,
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 :/)
frustrateddev
Freshman
Freshman
 
Posts: 2
Joined: Sun May 02, 2010 10:55 pm

Top

Postby mark@project8games.com » 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 http://developer.android.com/guide/prac ... 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
mark@project8games.com
Developer
Developer
 
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
  2.  
  3.          android:largeScreens="true"
  4.  
  5.          android:normalScreens="true"
  6.  
  7.          android:smallScreens="true"
  8.  
  9.          android:resizable="true"
  10.  
  11.          android:anyDensity="true" />
  12.  
  13.  
Parsed in 0.001 seconds, using GeSHi 1.0.8.4

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)
frustrateddev
Freshman
Freshman
 
Posts: 2
Joined: Sun May 02, 2010 10:55 pm

Top

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

Who is online

Users browsing this forum: No registered users and 1 guest