glGenTextures always returns 0

Hi,

I’m currently have problems with glGenTextures always returning a value of 0. After searching a lot of the Net, I found that the most common cause for this is not having a valid rendering context. However, using some println statements, I found that I’m calling glGenTexture after having created glCanvas, showing it, and having completed the init function from my GLEventListener. If I manually assign texture numbers, everything works fine. Oh, and I made sure that glGenTexture is not behind called between a glBegin and a glEnd statement.

Any hints on what could be causing glGenTextures to always return 0.

When using JOGL you must only make OpenGL calls from within the methods of your GLEventListener, which is the only time the library guarantees you have a valid OpenGL rendering context. See the JOGL demos’ source code for examples of texture mapping and other techniques. there are also other tutorials available like JOGL ports of the NeHe tutorials: see http://pepijn.fab4.be/nehe/ .

Wow, that simple statement about only GLEventListener having a valid context solved all my JOGL problems. Thanks!

BTW, I already knew about the excellent Nehe ressources. Almost everything was already working in my program, I just needed to fix that nasty glGen problem and a few bus errors I was getting on Mac.