Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have gotten texture's to load along with shader's however it seems that I can only create shaders and textures in onSurfaceCreated in my implementation of the render interface. Is this truly the only place one can create shaders, textures, ...?

share|improve this question
    
See the below anser it is mostly correct just mentioning that you can only create textures, shaders, meshs on the renderer's thread thus use GLSurfaceView's queueEvent function passing it an implementation of Runnable that handles the loading. –  leonmajere Nov 18 '11 at 19:58
add comment

1 Answer

up vote 1 down vote accepted

No you don't need to compile your shader in there, but you need to do it after the creation of the GLSurface, because you need an active OpenGL Context to be present.

Usually, I have a separate thread that I use to setup all my 3D scene, thene when all objects are created, I load my textures, meshes and shaders into opengl.

share|improve this answer
    
I was doing at after the creation of the surface, so I assume that I have to call that OpenGL code from a specific thread. –  leonmajere Nov 18 '11 at 19:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.