In Java Android OpenGL ES, my extended GLSurfaceView sees getHeight()/getWidth() as 0
Well, the title/subject pretty much covers the issue. Using various examples and and the API on googlecode, it seems like my extended GLSurfaceView class ought to be a good place to work my onTouchEvent inputs but when I try to set variables involving getHeight() and getWidth() when I make the call to my "where did the user touch class", the getHeight() and getWidth() are zero. I have verfied this by telling the class method to return the getHeight() or getWidth() int I passed it and it comes back as zero.
I am using an extended SpriteTextRenderer to display the values from my "where did the user touch class", and I know that it is working well because because I can change the other method to return event.getX() or event.getY() and those values display and update just fine.
My question is, is the 开发者_高级运维extended GLSurfaceView class the place where I should be asking to get the getHeight() and getWidth() values?
You can get height and width of GLSurfaceView
from parameters in onSurfaceChanged
and store them in private fields.
精彩评论