gzz.gfx.gl
Class GL.ByteVector

java.lang.Object
  |
  +--gzz.vob.Vob
        |
        +--gzz.gfx.gl.GL.JavaObject
              |
              +--gzz.gfx.gl.GL.NonRenderableJavaObject
                    |
                    +--gzz.gfx.gl.GL.ByteVector
All Implemented Interfaces:
GLDeletable
Enclosing class:
GL

public static class GL.ByteVector
extends GL.NonRenderableJavaObject

A vector of bytes stored in C++ space.


Nested Class Summary
 
Nested classes inherited from class gzz.vob.Vob
Vob.RenderInfo
 
Field Summary
 
Fields inherited from class gzz.vob.Vob
dbg, rcsid
 
Method Summary
protected  void deleteObj()
           
 void drawPixels(GL.Window win, int x, int y, float z, int width, int height, java.lang.String format, java.lang.String type)
           
 byte[] get()
          Get the values from the vector as an array of bytes.
 int get(int ind)
          Get a value from this byte vector.
 int[] getInts()
          Get the values from the vector as an array of ints.
 void readFromBuffer(GL.RenderingSurface win, java.lang.String buffer, int x, int y, int width, int height, java.lang.String format, java.lang.String type)
          Read pixels from an OpenGL buffer into this bytevector.
 int shade(int w, int h, int d, int comps, java.lang.String shaderName, java.lang.String[] params)
          Shade the given Texture into this bytevector, using 32-bit floats.
 
Methods inherited from class gzz.gfx.gl.GL.JavaObject
deleteObject, finalize, getId, render
 
Methods inherited from class gzz.vob.Vob
addToListGL, addToListGL, intersect, putGL, putGL, putGL, putGL
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

deleteObj

protected void deleteObj()
Specified by:
deleteObj in class GL.JavaObject

get

public int get(int ind)
Get a value from this byte vector.

Parameters:
ind - The index of the value to get.

readFromBuffer

public void readFromBuffer(GL.RenderingSurface win,
                           java.lang.String buffer,
                           int x,
                           int y,
                           int width,
                           int height,
                           java.lang.String format,
                           java.lang.String type)
Read pixels from an OpenGL buffer into this bytevector.

Parameters:
win - The window to read from
buffer - The OpenGL buffer to read from, e.g. "FRONT", "BACK"
x - The x coordinate to read from
y - The y coordinate to read from - note that this uses OpenGL's default coordinate system which is the opposite of ours in the y direction.
format - The format which to store in the vector, e.g. "RGB", "RGBA"
type - The type to read to, e.g. "FLOAT" or "UNSIGNED_BYTE"

drawPixels

public void drawPixels(GL.Window win,
                       int x,
                       int y,
                       float z,
                       int width,
                       int height,
                       java.lang.String format,
                       java.lang.String type)

get

public byte[] get()
Get the values from the vector as an array of bytes. Not sure if this is good since bytes are signed in Java. XXX Same for shorts?


getInts

public int[] getInts()
Get the values from the vector as an array of ints. Each integer is formed by packing 4 bytes.


shade

public int shade(int w,
                 int h,
                 int d,
                 int comps,
                 java.lang.String shaderName,
                 java.lang.String[] params)
Shade the given Texture into this bytevector, using 32-bit floats. Sets the bytevector length to w*h*(d > 0?d : 1) * comps * 4