displays correctly on emulator but not on real device?

Problems with Canvas, OpenGL, etc...

displays correctly on emulator but not on real device?

Postby crufia » Mon Aug 23, 2010 4:31 am

Hey guys,

I've been developing my top-down 2d OpenGL game using the emulator so far (right now, just displaying a tile map). It looks good on the emulator, but when I put it on my Nexus One to try it out, my tile map was nowhere to be seen and I just had the weird OpenGL funky background.

Since then I've tried to narrow down what the difference between the emulator and the device is, but I can't seem to place it. I never once got any of my tile map (which uses one big VBO with a grid) to display on the device but I did get some squares, etc to show up and it does look quite different.

In the setup of my app, I've screwed around with an ortho projection and fixing the size of the screen. I've been using an emulator resolution that's the same as my N1 though (800x480) so I'm not sure what would happen there.

What's the difference between the emulator and the N1? Is there some dangerous setting that I'm using?

If it helps, here is some of the init code I use:
Code: Select all
gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST);

        gl.glShadeModel(GL10.GL_FLAT);
        gl.glDisable(GL10.GL_DEPTH_TEST);
        gl.glEnable(GL10.GL_TEXTURE_2D);
        gl.glDisable(GL10.GL_LIGHTING);

        gl.glViewport(0, 0, 480, 800);
        gl.glMatrixMode(GL10.GL_PROJECTION);
        gl.glLoadIdentity();
        gl.glOrthof(0, 480f, 800f, 0f, 0.0f, 1.0f);
        gl.glMatrixMode(GL10.GL_MODELVIEW);


This (at least on the emulator) gives me a 800x480 screen with the origin at the top left.

Thanks...
Dave
crufia
Freshman
Freshman
 
Posts: 3
Joined: Mon Aug 23, 2010 3:52 am

Top

Re: displays correctly on emulator but not on real device?

Postby MichaelEGR » Mon Aug 23, 2010 7:51 am

Are you using power of 2 textures? If not that is the 1st problem as the emulator won't complain and will chug right along whereas the device will fail. I highly don't recommend OpenGL ES development on the emulator. You'll be bitten by all sorts of things that don't work in the emulator then you are hit by all the things that actually broken and not working on various Android OS releases and different hardware. So stick to one or more devices if possible.
Founder & Principal Architect; EGR Software LLC
http://www.typhonrt.org
http://www.egrsoftware.com
User avatar
MichaelEGR
Senior Developer
Senior Developer
 
Posts: 147
Joined: Thu Jan 21, 2010 5:30 am
Location: San Francisco, CA

Re: displays correctly on emulator but not on real device?

Postby crufia » Mon Aug 23, 2010 5:35 pm

I definitely learned that for future development - wayy too many discrepancies. I'm using power of 2 textures though (32x32 textures throughout the tile map). The tile map itself isn't power of 2, but I doubt that matters.

Anything else?
crufia
Freshman
Freshman
 
Posts: 3
Joined: Mon Aug 23, 2010 3:52 am

Re: displays correctly on emulator but not on real device?

Postby MichaelEGR » Mon Aug 23, 2010 11:11 pm

It's hard to say unfortunately as debugging OpenGL apps is difficult without getting ones hands dirty and looking at the code due to the state machine way of working with GL 1.x. It could be anything! :) My recommendation is to take the standard divide and conquer approach and start with the basics of your app and get them working on a real device then add more and more functionality until you come across the problem. I'm actually quite surprised that you got VBOs to work on the emulator. It certainly didn't support that back at Android 1.0 at least if I recall correctly! I haven't used the emulator since I got a real device in my hands Oct '08.
Founder & Principal Architect; EGR Software LLC
http://www.typhonrt.org
http://www.egrsoftware.com
User avatar
MichaelEGR
Senior Developer
Senior Developer
 
Posts: 147
Joined: Thu Jan 21, 2010 5:30 am
Location: San Francisco, CA

Re: displays correctly on emulator but not on real device?

Postby crufia » Tue Aug 24, 2010 1:00 am

Thanks Michael. I played around with it for a while and something somewhere worked - it started working on my N1.

So, future noobs finding this thread - nothing I can add. Sorry!
crufia
Freshman
Freshman
 
Posts: 3
Joined: Mon Aug 23, 2010 3:52 am

Top

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

Who is online

Users browsing this forum: MSNbot Media and 2 guests