glGenTextures and Java

Hi,

I don’t suppose there’s a way to get around having to call

eglCreateWindowSurface

and

eglMakeCurrent

before making any calls to

glGenTextures

in the Java implementation of OpenGLES is there? The main problem is that at the time I come to create the textures (loading scene graph from file) I don’t yet have access to the Graphics object being used (it’s a cross platform API… long story) and so I need to create the glTextures, but at this point have no Graphics object to use with eglCreateWindowSurface, to then use with eglMakeCurrent. So I’m getting an IllegalStateException with “no current context”. Is it possible to create an “empty” context to make these calls with?
Basically I don’t understand exactly why the Graphics object needs to be known at this point, I’m a little fuzzy on the ties between these function calls and the context. Are all textures created with a certain context set current only usable when that context is set current?

Er… ta in advance. And if it sounds like I don’t know what the chuff I’m talking about that’s probably true.

[QUOTE=sage12;43686]The main problem is that at the time I come to create the textures …
I need to create the glTextures, but at this point have no Graphics object to use with eglCreateWindowSurface, to then use with eglMakeCurrent.

Is it possible to create an “empty” context to make these calls with?[/quote]

If you don’t have a graphics context, you don’t need to create the GL textures yet (they’re the GPU-side representation of the texture data). Just packrat the texture data in CPU memory, and create the GL textures later when you have a graphics context.

There is this extension: EGL_KHR_surfaceless_context. But you probably don’t need this, even if your platform supports it.

Basically I don’t understand exactly why the Graphics object needs to be known at this point, …
Are all textures created with a certain context set current only usable when that context is set current?

A graphics context is your “window” to the GPU driver and the GPU. You need that to create resources in the GPU driver or on the GPU.

Suspect this is a bot post. Original here: glGenTextures and Java - OpenGL - Khronos Forums

Closing this thread.