www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: Lavos on April 26, 2012, 04:45:17 am

Title: Blitting text/textures works fine in emulator but not on actual phone
Post by: Lavos on April 26, 2012, 04:45:17 am
Hi, I've been running into a strange issue that I haven't been able to find any answers for...

I'm trying to blit a background texture behind the game and a text string (using raft's AGLFont class) in the foreground:

In initialization:
Code: [Select]
font = new Paint();
font.setTextSize(20);
overlayFont = new AGLFont(font);
background = new Texture(BitmapHelper.rescale(BitmapHelper.convert(getResources().getDrawable(R.drawable.backtexture)), 512, 256));

And in the drawing method:
Code: [Select]
Display display = getWindowManager().getDefaultDisplay();
fb.blit(background, 0, 0, 0, 0, 512, 256, display.getWidth(), display.getHeight(), 100, false);
world.renderScene(fb);
world.draw(fb);
overlayFont.blitString(fb, "testing", 100, 100, 100, new RGBColor(100,90,25));
fb.display();

This works just fine on the emulator, but not on an actual device. I've tested this on two different phones (a Droid X and a Nexus S) and in both cases, neither the background nor the text show up at all. Any clue what I might be doing wrong?
Title: Re: Blitting text/textures works fine in emulator but not on actual phone
Post by: EgonOlsen on April 26, 2012, 10:18:08 am
Try the latest beta from http://jpct.de/download/beta/jpct_ae.jar (http://jpct.de/download/beta/jpct_ae.zip).
Title: Re: Blitting text/textures works fine in emulator but not on actual phone
Post by: Lavos on April 26, 2012, 11:34:24 pm
Tried it, but unfortunately the problem still persists =(

Edit: Looks like I figured it out, but the solution is bizarre as well. Changing the clipping distance from 4000 to 3000 causes both the texture and text to appear without a problem...
Title: Re: Blitting text/textures works fine in emulator but not on actual phone
Post by: EgonOlsen on April 27, 2012, 10:54:59 am
That's a known issue with some clipping distances that has it's source somewhere in the mix between depth buffer accuracy and gpu accuracy. I thought that it had been fixed for all cases...obviously not. Which OpenGL version are you using and can you create a test case for this?