OpenGL Orthographic Projection problems on emulator (rendering 1/4 size)

by Robert Green » Thu, 20 Aug 2009 13:07:50 GMT


Sponsored Links
  seem to have found the bug.  The problem appears to be with how
Fixed Point numbers are used with glOrthox. The specification is such
that glOrtho creates a relative number of "pixels" that can be used -
so no matter what the actual screen resolution is, you get to draw to
whatever you defined as your coordinate system in glOrtho. This means
that instead of converting everything to FP (int << 16), you can just
put the regular int in for the width and height of the orthographic
projection and then use regular ints in your geometry. This works
correctly on the device and in every opengl example I've seen, but the
emulator doesn't like it. Here's what I found:

Testing landscape full screen 480x320

glOrthox(0, 480, 320, 0, 0, 1) and geometry using ints (320, 480)
works on device but not on emulator (1/2 length and width show up)
glOrthox(0, 480 << 16, 320 << 16, 0, 0, 1) and geometry using FP (320
<< 16, 480 << 16) works on both emulator and device
glOrthof(0, 480f, 320f, 0, 0, 1) and geometry using floats (320f x
480f) works on both emulator and device
glOrthof(0, 480f, 320f, 0, 0, 1) and geometry using FP (320 << 16, 480
<< 16) works on both emulator and device

I think it's a bug that the first method doesn't work, but I'll just
convert everything to FP and forget about it.

On Aug 19, 11:44pm, Robert Green <rbgrn....@gmail.com> wrote:
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Magician abrakadabra

Magician thirty two-A,
Review dan pertempurkan dong..

Myhero vs cyanogen..

Which is

Better UI
Faster
Aplikasi terlengkap,banyak
Etc..

*nubi nanya.. Ganti rom,app dsb ikut ilang?bisa direstore?



~YK~

2. Finding Location Latitude and Longitude using GPS in HTC MAGIC device..



You have not requested location updates, so getLastKnownLocation() will
always return null.

Also, getLastKnownLocation() will almost never have a value immediately,
as it takes GPS some time to obtain a fix.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android Consulting/App Development: http://commonsware.com/consulting

3. Finding Location Latitude and Longitude using GPS in HTC MAGIC device..

4. Finding direction using compass

5. 2010 : Android Army is coming..choose ur soldier!!

6. App crashes on Droid, works fine on G1

7. Flowing View Group