From 14a2ea2a7eb093ff3fb5322ace1a6f8767401f3d Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 3 Oct 2009 22:55:14 -0700 Subject: Texture: Relax/Pending creation of texture ID, no context must be current --- .../com/sun/opengl/util/texture/Texture.java | 42 +++++++++++++--------- 1 file changed, 25 insertions(+), 17 deletions(-) (limited to 'src/jogl/classes/com/sun/opengl') diff --git a/src/jogl/classes/com/sun/opengl/util/texture/Texture.java b/src/jogl/classes/com/sun/opengl/util/texture/Texture.java index 87f045a6d..3a2799cf3 100755 --- a/src/jogl/classes/com/sun/opengl/util/texture/Texture.java +++ b/src/jogl/classes/com/sun/opengl/util/texture/Texture.java @@ -179,17 +179,14 @@ public class Texture { private static final boolean disableTexRect = Debug.isPropertyDefined("jogl.texture.notexrect", true, localACC); public Texture(TextureData data) throws GLException { - GL gl = GLContext.getCurrentGL(); - texID = createTextureID(gl); - + texID = 0; updateImage(data); } // Constructor for use when creating e.g. cube maps, where there is // no initial texture data public Texture(int target) throws GLException { - GL gl = GLContext.getCurrentGL(); - texID = createTextureID(gl); + texID = 0; this.target = target; } @@ -260,6 +257,7 @@ public class Texture { * OpenGL-related errors occurred */ public void bind() throws GLException { + validateTexID(null, true); GLContext.getCurrentGL().glBindTexture(target, texID); } @@ -290,8 +288,10 @@ public class Texture { * @throws GLException if any OpenGL-related errors occurred */ public void destroy(GL gl) throws GLException { - gl.glDeleteTextures(1, new int[] {texID}, 0); - texID = 0; + if(0