I have a button class thats created from within the onSurfaceCreated method in my glSurfaceView; It takes gl as one of its parameters so it开发者_JAVA技巧 can properly draw. Im having an issue passing gl to an overlay class, which looks like a pin in the google maps app. If i call makeOverlay() in my button's constructor it draws perfectly, if i call it anywhere else all i get is a white square. They are all on the same drawing thread. Anyone know what im missing? Thanks.
Probably the GL context is not made current outside of those methods.
You can just make a abstract representation of your object and draw it in your onDrawFrame method. That's what you should be doing anyways.
You could store the GL context inside a static variable to be able to access it from anywhere within your code.
精彩评论