edu.stanford.rsl.konrad.cuda
Class JCudaDriverTextureSample

java.lang.Object
  extended by edu.stanford.rsl.konrad.cuda.JCudaDriverTextureSample
All Implemented Interfaces:
java.util.EventListener, javax.media.opengl.GLEventListener
Direct Known Subclasses:
ImagePlusVolumeRenderer

public class JCudaDriverTextureSample
extends java.lang.Object
implements javax.media.opengl.GLEventListener

A sample illustrating how to use textures with JCuda. This program uses the CUBIN file that is created by the "volumeRender" program from the NVIDIA CUDA samples web site.

The program loads an 8 bit RAW volume data set and copies it into a 3D texture. The texture is accessed by the kernel to render an image of the volume data. The resulting image is written into a pixel buffer object (PBO) which is then displayed using JOGL.


Constructor Summary
JCudaDriverTextureSample(byte[] volumeData, int sizeX, int sizeY, int sizeZ, boolean stereoMode)
          Creates a new JCudaTextureSample that displays the given volume data, which has the specified size.
 
Method Summary
 void display(javax.media.opengl.GLAutoDrawable drawable)
          Implementation of GLEventListener: Called when the given GLAutoDrawable is to be displayed.
 void displayChanged(javax.media.opengl.GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged)
          Implementation of GLEventListener - not used
 void init(javax.media.opengl.GLAutoDrawable drawable)
          Implementation of GLEventListener: Called to initialize the GLAutoDrawable.
static void main(java.lang.String[] args)
          Entry point for this sample.
 void reshape(javax.media.opengl.GLAutoDrawable drawable, int x, int y, int width, int height)
          Implementation of GLEventListener: Called then the GLAutoDrawable was reshaped
 void start()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JCudaDriverTextureSample

public JCudaDriverTextureSample(byte[] volumeData,
                                int sizeX,
                                int sizeY,
                                int sizeZ,
                                boolean stereoMode)
Creates a new JCudaTextureSample that displays the given volume data, which has the specified size.

Parameters:
volumeData - The volume data
sizeX - The size of the data set in X direction
sizeY - The size of the data set in Y direction
sizeZ - The size of the data set in Z direction
stereoMode - Whether stereo mode should be used
Method Detail

main

public static void main(java.lang.String[] args)
Entry point for this sample.

Parameters:
args - not used

start

public void start()

init

public void init(javax.media.opengl.GLAutoDrawable drawable)
Implementation of GLEventListener: Called to initialize the GLAutoDrawable. This method will initialize the JCudaDriver and cause the initialization of CUDA and the OpenGL PBO.

Specified by:
init in interface javax.media.opengl.GLEventListener

display

public void display(javax.media.opengl.GLAutoDrawable drawable)
Implementation of GLEventListener: Called when the given GLAutoDrawable is to be displayed.

Specified by:
display in interface javax.media.opengl.GLEventListener

reshape

public void reshape(javax.media.opengl.GLAutoDrawable drawable,
                    int x,
                    int y,
                    int width,
                    int height)
Implementation of GLEventListener: Called then the GLAutoDrawable was reshaped

Specified by:
reshape in interface javax.media.opengl.GLEventListener

displayChanged

public void displayChanged(javax.media.opengl.GLAutoDrawable drawable,
                           boolean modeChanged,
                           boolean deviceChanged)
Implementation of GLEventListener - not used

Specified by:
displayChanged in interface javax.media.opengl.GLEventListener