开发者

Android OpenGL viewport Problem on Tablet

开发者 https://www.devze.com 2023-03-22 11:29 出处:网络
I am developing an opengl app on android. I have tried the basic tutorials before starting this. I tested my app on phone and tablet. On phone the viewport is setup to fill the screen but on tablet 开

I am developing an opengl app on android. I have tried the basic tutorials before starting this.

I tested my app on phone and tablet. On phone the viewport is setup to fill the screen but on tablet 开发者_如何学JAVAit takes the space same as that on phone. Earlier samples seem to render porperly on tablet.

I debugged the app and found that the method onSurfaceChanged() gets wrong values of width and height.

Can anybody suggest me what I may be doing wrong?


Do you build your sources using the version 8 of the SDK ?

Otherwhise, try to add this in your AndroidManifest.xml :

<uses-sdk android:minSdkVersion="8"></uses-sdk>


It seems that this function doesn't pass the actual width and height of the device screen. It passes some sort of approximation of it. On my HTC those values are something around 320x533 and the actual resolution of the device is 480x800. Take a notice that the ratio in both cases is something around 0.6 (320 divided by 533 and 480 divided by 800).

0

精彩评论

暂无评论...
验证码 换一张
取 消