Reputation: 7686
Can anyone tell me why glGenTextures()
isn't working in my constructor?
Here is how my project is setup:
.draw
on the current active stage.Global.activeStage
..draw
on the currently active stage which reference is kept inside Global.activeStage
..draw
is called there is no problem.glGenTextures()
- it creates a zero value rather than 1..2..3 and so on.GL10
reference is used rather than the one .draw
gets, so it's not the problem.It seems as if everything works ONLY if there is already a reference to the current stage I'm using (if the stage is created e.g. the constructor has already run).
I am not sure if it is related, but the stage is created in a Thread after onCreateSurface
ends.
I could post some of the code if you say which parts would be relevant.
Upvotes: 1
Views: 788
Reputation: 31846
I am quite sure you have to run all openGL
operations on the Thread
associated with openGL
. This is why it works when called from your draw()
method called from the renderer (which runs on the GL-Thread) but not from the constructor (which runs on another Thread as you say).
Upvotes: 5