dimensions that OpenGL games implemented using GLSurfaceView are
supposed to draw themselves in are passed to the game's renderer in
this method:
http://developer.android.com/reference/android/opengl/GLSurfaceView.Renderer.html#onSurfaceChanged%28javax.microedition.khronos.opengles.GL10,%20int,%20int%29
Those values will have already had anything outside the viewable area
subtracted from them.
--
Lance Nanek - Software Developer
http://neatocode.com | http://twitter.com/LanceNanek |
http://www.youtube.com/user/lnanek
On May 28, 3:20 pm, Jason <jason.poli...@gmail.com> wrote:
> OK.. I tried replying to this thread:
>
> http://groups.google.com/group/android-developers/browse_thread/threa...
>
> But Google Groups seems to have lost that email :/, so trying a new
> post.
>
> In the afore-mentioned thread, Dianne talks about not using
> getHeight()/getWidth() for UI layout, which I'll assume is good
> advice, but my problem is bootstrapping an OpenGL surface view
> (specifically the viewport) and for that I NEED to know the height of
> the System Bar as it's currently throwing everything off. That is, in
> order to scale the scene to fit all devices I need to know the
> dimensions of the screen, but because the height is an (from
> DisplayMetrics) is an absolute height including the System Bar, all
> the graphics at the top of the scene are being truncated because the
> VIEWABLE area is not the same as the screen height.
>
> I have followed the advice of Chris Pruett here:http://youtu.be/cdvaPyq_eBU?t=8m48s,
> and here: http://code.google.com/p/replicaisland/source/browse/trunk/src/com/re...
> (line 128)
>
> And in so doing now need to be able to deduct the height of the system
> bar to be able to accurately scale the opengl scene to match the
> device.
>
> Anyone got any clue how I can determine the height (in pixels) of the
> System Bar? And if the answer is "you can't", that's fine but how do
> I then set the viewport in an opengl scene to the correct height?
> (understanding that I have to know the height BEFORE the viewport is
> set because I will have already computed the scale factors as per
> Chris Pruett's approach)
>
> Thanks!
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
No comments:
Post a Comment