summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/demos/vertexProgRefract/VertexProgRefract.java18
-rw-r--r--www/index.html65
-rwxr-xr-xwww/jrefract_sm.jpgbin0 -> 6139 bytes
-rwxr-xr-xwww/webstart/JRefract.jnlp24
4 files changed, 106 insertions, 1 deletions
diff --git a/src/demos/vertexProgRefract/VertexProgRefract.java b/src/demos/vertexProgRefract/VertexProgRefract.java
index cee2054..9698413 100644
--- a/src/demos/vertexProgRefract/VertexProgRefract.java
+++ b/src/demos/vertexProgRefract/VertexProgRefract.java
@@ -508,6 +508,7 @@ public class VertexProgRefract {
private void makeRGBTexture(GL gl, GLU glu, BufferedImage img, int target, boolean mipmapped) {
ByteBuffer dest = null;
+
switch (img.getType()) {
case BufferedImage.TYPE_3BYTE_BGR:
case BufferedImage.TYPE_CUSTOM: {
@@ -530,9 +531,24 @@ public class VertexProgRefract {
throw new RuntimeException("Unsupported image type " + img.getType());
}
+
+ // ByteBuffer destScaled = ByteBuffer.allocateDirect(dest.capacity() / 4);
+ ByteBuffer destScaled = ByteBuffer.allocateDirect(dest.capacity());
+ destScaled.order(ByteOrder.nativeOrder());
+ int res = glu.gluScaleImage(GL.GL_RGB,
+ img.getWidth(), img.getHeight(), GL.GL_UNSIGNED_BYTE, dest,
+ img.getWidth(), img.getHeight(), GL.GL_UNSIGNED_BYTE, destScaled);
+ // System.out.println("gluScaleImage: result = " + res);
+
+
+
+
if (mipmapped) {
+ // glu.gluBuild2DMipmaps(target, GL.GL_RGB8, img.getWidth(), img.getHeight(), GL.GL_RGB,
+ // GL.GL_UNSIGNED_BYTE, dest);
+
glu.gluBuild2DMipmaps(target, GL.GL_RGB8, img.getWidth(), img.getHeight(), GL.GL_RGB,
- GL.GL_UNSIGNED_BYTE, dest);
+ GL.GL_UNSIGNED_BYTE, destScaled);
} else {
gl.glTexImage2D(target, 0, GL.GL_RGB, img.getWidth(), img.getHeight(), 0,
GL.GL_RGB, GL.GL_UNSIGNED_BYTE, dest);
diff --git a/www/index.html b/www/index.html
index 9791e46..269afcb 100644
--- a/www/index.html
+++ b/www/index.html
@@ -343,6 +343,71 @@ technique of infinite shadow volumes. <a
+ <div align="left"><font color="#ffffff"><strong>JRefract</strong></font></div>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" bgcolor="#ffffff">
+
+
+ <table border="0" cellpadding="5" cellspacing="1"
+ width="100%">
+ <tbody>
+ <tr>
+ <td width="25%"> <br>
+ </td>
+ <td width="45%"> <strong>Description</strong>
+ </td>
+ <td width="5%"><br>
+ </td>
+ <td width="25%"> <strong>Requirements</strong>
+ </td>
+ </tr>
+ <tr>
+ <td width="25%"> <a
+ href="https://jogl-demos.dev.java.net/webstart/JRefract.jnlp">
+ <img src="jrefract_sm.jpg" width="160" height="120"
+ alt="Launch JRefract demo">
+ </a> </td>
+ <td width="45%"> Variant of NVidia's vtxprog_refract demo showcasing JOGL's hardware-accelerated Swing component. <a
+ href="vtxprog_warp.zip">Original
+ source code</a> supplied in NVidia's <a href="http://developer.nvidia.com/object/sdk_home.html">SDK</a>.</td>
+ <td width="5%"><br>
+ </td>
+ <td width="25%"> pbuffer support, ARB_vertex_program </td>
+ </tr>
+ <tr>
+ </tr>
+
+
+ </tbody>
+
+ </table>
+ </td>
+ </tr>
+
+ </tbody>
+
+
+ </table>
+ </td>
+ </tr>
+
+ </tbody>
+</table>
+
+<table border="0" cellpadding="5" cellspacing="1" width="100%">
+ <tbody>
+ <tr>
+ <td>
+ <table bgcolor="#990000" border="0" cellpadding="5"
+ cellspacing="1" width="100%">
+ <tbody>
+ <tr>
+ <td bgcolor="#990000" valign="top">
+
+
+
<div align="left"><font color="#ffffff"><strong>Vertex Program
Warp</strong></font></div>
</td>
diff --git a/www/jrefract_sm.jpg b/www/jrefract_sm.jpg
new file mode 100755
index 0000000..e6d1ca1
--- /dev/null
+++ b/www/jrefract_sm.jpg
Binary files differ
diff --git a/www/webstart/JRefract.jnlp b/www/webstart/JRefract.jnlp
new file mode 100755
index 0000000..11edcc8
--- /dev/null
+++ b/www/webstart/JRefract.jnlp
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<jnlp spec="1.0"
+ codebase="https://jogl-demos.dev.java.net/webstart/"
+ href="JRefract.jnlp">
+ <information>
+ <title>JOGL JRefract Demo</title>
+ <vendor>Sun Microsystems, Inc.</vendor>
+ <homepage href="http://jogl-demos.dev.java.net/"/>
+ <description>JRefract Demo</description>
+ <description kind="short">Variant of NVidia's vtxprog_refract demo illustrating JOGL's hardware-accelerated Swing component.</description>
+ <offline-allowed/>
+ </information>
+
+ <resources>
+ <j2se href="http://java.sun.com/products/autodl/j2se" version="1.4+"/>
+ <property name="sun.java2d.noddraw" value="true"/>
+ <jar href="jogl-demos.jar" main="true"/>
+ <jar href="jogl-demos-util.jar" />
+ <jar href="jogl-demos-data.jar" />
+ <extension name="jogl" href="https://jogl.dev.java.net/webstart/jogl.jnlp" />
+ </resources>
+
+ <application-desc main-class="demos.jrefract.JRefract"/>
+</jnlp>