Author Topic: Aksing the framebuffer width and hight gives strange Values  (Read 920 times)

Offline dandee

  • byte
  • *
  • Posts: 7
    • View Profile
Aksing the framebuffer width and hight gives strange Values
« on: December 19, 2011, 10:38:47 pm »
Hello,

searching the forum gives me no hint about my problem. Maybe you know somethin about that.

I initialize my frame buffer due to some samples. At the moment I am working on some tests about overlays. The overlays should fit its size relative to the frame buffer width and hight.

Am I right if I assume that the framebuffer.getHeight() and framebuffer.getWidth() should be the same as my screensize on my device?

Everytime I ask the framebuffer  for its dimensions I get something like (nearly the same on my sgs2 and the emulator)

12-19 22:27:04.780: INFO/System.out(14500): AUFLÖSUNG HEIGHT!: 320
12-19 22:27:04.780: INFO/System.out(14500): AUFLÖSUNG WIDTH!: 533

The Initialisation of my mglview:
Code: [Select]
mGLView = new GLSurfaceView(getApplication());

mGLView.setEGLConfigChooser(new GLSurfaceView.EGLConfigChooser() {
public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) {
// Ensure that we get a 16bit framebuffer. Otherwise, we'll fall
// back to Pixelflinger on some device (read: Samsung I7500)
int[] attributes = new int[] { EGL10.EGL_DEPTH_SIZE, 16, EGL10.EGL_NONE };
EGLConfig[] configs = new EGLConfig[1];
int[] result = new int[1];
egl.eglChooseConfig(display, attributes, configs, 1, result);
return configs[0];

}

My Renderer:
Code: [Select]
    //----------------DER RENDERER----- EMBD KLASSE----------
    class GameRenderer implements GLSurfaceView.Renderer {

    // Faramecounter
    private int fps = 0;
    //private int lfps = 0;
    private long fpsTime = System.currentTimeMillis();
   
    private boolean stop = false;
   
    //Voreinstellungen für den Renderer
    public GameRenderer() {
Config.maxPolysVisible = 500;
Config.farPlane = 3000;
Config.glTransparencyMul = 0.1f;
Config.glTransparencyOffset = 0.1f;
Config.useVBO=true;

Texture.defaultToMipmapping(true);
Texture.defaultTo4bpp(true);
}
    public void stop() {
stop = true;
}
   
@Override
public void onDrawFrame(GL10 arg0) {

try {
if (!stop) {

//Block für das Gesamtrendering
fb.clear(fbBackgroundColor);


if (GameWorldVisible) {
GameWorld.renderScene(fb);
GameWorld.draw(fb);
}
if (EnvBoxWorldVisible) {
EnvBoxWorld.renderScene(fb);
EnvBoxWorld.draw(fb);
}
if (OverlayWorldVisible) {
OverlayWorld.renderScene(fb);
OverlayWorld.draw(fb);
}
if (SystemMessageWorldVisible) {
SystemMessageWorld.renderScene(fb);
SystemMessageWorld.draw(fb);
}
checkConnection();

//WorldModifier.checkAndExecute();


fb.display();
//Ende Block für das Gesamtrendering
} else {
if (fb != null) {
fb.dispose();
fb = null;
}
}
} catch (Exception e) {
e.printStackTrace();
Logger.log("Drawing thread terminated!", Logger.MESSAGE);
}

}

@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
if (fb != null) {
fb.dispose();
}
// Analyse der Displaygröße und übergabe an den Framebuffer
fb = new FrameBuffer (gl, width, height);
//fb = new FrameBuffer (gl, 800, 400);
}
...
...
...
...

I think setting the framebuffer size by hand is not the soultion....

Do you have any ideas?

Kind regards

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Aksing the framebuffer width and hight gives strange Values
« Reply #1 on: December 19, 2011, 11:00:47 pm »
That depends on your AndroidManifest.xml and the choosen target platform. Try to add

Code: [Select]
  <supports-screens
          android:largeScreens="true"
          android:normalScreens="true"
          android:smallScreens="true"
          android:anyDensity="true" />

to it to see if that helps.

Offline dandee

  • byte
  • *
  • Posts: 7
    • View Profile
Re: Aksing the framebuffer width and hight gives strange Values
« Reply #2 on: December 20, 2011, 11:28:29 pm »
Thank you for your help,

I think that did the job. At my Manifest I removed android:resizeable="true" . After that the resolution is correct.

Many thanks!!!