www.jpct.net
jPCT-AE - a 3d engine for Android => Support => Topic started by: dutch_delight on March 12, 2011, 01:13:40 am
-
12 oclock on a friday night and I'm sitting behind my computer. :'(
Anyway, I've been trying to work on a radar that is always visible on screen but I'm not fully understanding the overlay.
I've borrowed some code from the forum:
Overlay uiRadar = new Overlay(world, fb, "uiRadarT");
uiRadar.setVisibility(true);
It does slow things down quite badly so something is working but the overlay isn't showing. Texture shows fine when i do this (using texturepack):
fb.blit(uiRadarT, 0, 0, 0, 0, uiRadarT.getWidth(), uiRadarT.getHeight(), 128, 128, 100, false, null);
It says this in the java Docs:
"A scaled blit has to be applied by the application each frame. "
But I'm not getting it. how do I apply a scaled blit? What is a scaled blit?
-
That simply means that you have to call blit yourself each frame...just as you do right now. A scaled blit is a blit, where the resulting image has another size than the blitted textures->scaled! Apart from that, using an Overlay should not cause a slow down. You are not creating a new Overlay for each frame, are you?
-
Ah I see. And yes I am creating a new overlay every frame. Doh!
public void onDrawFrame(GL10 gl) {
fb.clear(back);
world.renderScene(fb);
world.draw(fb);
Overlay uiRadar = new Overlay(world, fb, "tapache");
uiRadar.setVisibility(true);
fb.display();
} catch (Exception e) {
Logger.log(e, Logger.MESSAGE);
}
}
I removed some of my (bad) code. But how should I be calling it then?
Declare it somewhere else first and then when it needs to be updated do:
uiRadar.setRotation(1.0f);
uiRadar.update(fb);
?
Really appreciate your help.
-
Actually, it shouldn't be needed to call update on it. Just create it and it should be there. If you want to rotate it, just do it. No need to update it afterwards.