Texture Constructor always throws GLException

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Texture Constructor always throws GLException

Bertrahm
Im currently working on a basic game engine in java and im currently stuck on image loading, I want to do this with BufferedImages for consistancy with older versions of the engine (and backwards compability). I am using the TextureIO#newTexture(GL, TextureData) method for this, and I always  get this exception:

I already made out the reason, which is that it automatically assigns it the texID of 0,  but no way to change this/obtain a lvalid tex id. Is there any way to obtain a valid texID or do I have to keep track of them myself?
Wir sind Schaufensterpuppen|Twitter
Reply | Threaded
Open this post in threaded view
|

Re: Texture Constructor always throws GLException

gouessej
Administrator
Please post a SSCCE. If we can't reproduce your bug, we won't be able to help you. A stack trace isn't enough.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Texture Constructor always throws GLException

gouessej
Administrator
In reply to this post by Bertrahm
There's a public Texture constructor that takes a texture identifier as first parameter, it should do the trick in your case but it's harder to use, don't forget to update the image.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Texture Constructor always throws GLException

Bertrahm
In reply to this post by Bertrahm
Sorry for not attaching code, but soon after this post I found out why it didnt work and didnt think to update here, I basically just forgot to make my GLCanvas context current.
Wir sind Schaufensterpuppen|Twitter
Reply | Threaded
Open this post in threaded view
|

Re: Texture Constructor always throws GLException

gouessej
Administrator
Be careful, there are plenty of ways to obtain bad performance. Several years ago, I found that Ardor3D was explicitly making contexts current whereas it wasn't necessary in some cases and our first attempt of using JOGL in JMonkeyEngine 2 managed the OpenGL context very badly. I advise you to look at the existing engines, see them as sources of inspiration.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Texture Constructor always throws GLException

Bertrahm
Thank you very much for your advise.
Wir sind Schaufensterpuppen|Twitter