开发者

problems passing gl with Android

开发者 https://www.devze.com 2023-02-05 11:02 出处:网络
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

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.

0

精彩评论

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