1
\$\begingroup\$

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, ...?

\$\endgroup\$
1
  • \$\begingroup\$ 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. \$\endgroup\$
    – leonmajere
    Nov 18, 2011 at 19:58

1 Answer 1

1
\$\begingroup\$

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.

\$\endgroup\$
1
  • \$\begingroup\$ 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. \$\endgroup\$
    – leonmajere
    Nov 18, 2011 at 19:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .