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. app2sd liquid?

para suhu,
mau tanya utk Liqiud apa ada app2sd yang cocok ? gimana caranya yah?
Maklum noobie nih..

-- 
"Indonesian Android Community [id-android]" 

2. Showing Google MyMaps

Hi,

I created a custom map in Google Maps "My Maps". Now i want to show
that map on an android device, but not just opening it as a web page
but showing it using MapView or smth similar. I want to be able to
center on a place I have marked on the map etc. My custom map is a map
containing the location of all gas stations in a city.

Can someone please point me to the right direction or to an article
describing this (I couldn't find anything).

-- 

3. nanya e-book reader di android

4. OOT..Just for fun..

5. Edit ReTweet di twitter

6. Twitter / Facebook source code

7. Prevent my apk from installing on other devices