From c6555b09c455d0db238e4cf57ee3efd4e426f215 Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Fri, 23 Aug 2013 00:33:38 +0200
Subject: Texture: Add 'toString()' and 'getTextureObject()' w/o GL instance to
 read existing object name.

---
 .../com/jogamp/opengl/util/texture/Texture.java      | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

(limited to 'src/jogl')

diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java b/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java
index f2ef3ac25..496836d3c 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java
@@ -187,6 +187,12 @@ public class Texture {
 
     /** The texture coordinates corresponding to the entire image. */
     private TextureCoords coords;
+    
+    public String toString() { 
+        return "Texture[target 0x"+Integer.toHexString(target)+", name "+texID+", "+
+                imgWidth+"/"+texWidth+" x "+imgHeight+"/"+texHeight+", y-flip "+mustFlipVertically+
+                ", "+estimatedMemorySize+" bytes]";
+    }
 
     /** An estimate of the amount of texture memory this texture consumes. */
     private int estimatedMemorySize;
@@ -858,12 +864,26 @@ public class Texture {
      * </p>
      * @param gl required to be valid and current in case the texture object has not been generated yet,
      *           otherwise it may be <code>null</code>.
+     * @see #getTextureObject()
      */
     public int getTextureObject(GL gl) {
         validateTexID(gl, false);
         return texID;
     }
 
+    /**
+     * Returns the underlying OpenGL texture object for this texture, 
+     * maybe <code>0</code> if not yet generated.
+     * <p>
+     * Most applications will not need to access this, since it is
+     * handled automatically by the bind(GL) and destroy(GL) APIs.
+     * </p>
+     * @see #getTextureObject(GL)
+     */
+    public int getTextureObject() {
+        return texID;
+    }
+
     /** Returns an estimate of the amount of texture memory in bytes
         this Texture consumes. It should only be treated as an estimate;
         most applications should not need to query this but instead let
-- 
cgit v1.2.3