summaryrefslogtreecommitdiffstats
path: root/src/demos/cg
diff options
context:
space:
mode:
Diffstat (limited to 'src/demos/cg')
-rw-r--r--src/demos/cg/runtime_ogl/cgGL_vertex_example.java9
-rw-r--r--src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java13
2 files changed, 12 insertions, 10 deletions
diff --git a/src/demos/cg/runtime_ogl/cgGL_vertex_example.java b/src/demos/cg/runtime_ogl/cgGL_vertex_example.java
index aded2d2..3a0504f 100644
--- a/src/demos/cg/runtime_ogl/cgGL_vertex_example.java
+++ b/src/demos/cg/runtime_ogl/cgGL_vertex_example.java
@@ -35,6 +35,7 @@ package demos.cg.runtime_ogl;
import com.sun.opengl.cg.*;
import javax.media.opengl.*;
+import javax.media.opengl.awt.*;
import javax.media.opengl.glu.*;
import java.awt.*;
@@ -103,7 +104,7 @@ public class cgGL_vertex_example implements GLEventListener
}
- private void DrawCube(GL gl)
+ private void DrawCube(GL2 gl)
{
int i;
@@ -131,7 +132,7 @@ public class cgGL_vertex_example implements GLEventListener
*/
for(i = 0; i < 6; i++)
{
- gl.glBegin(GL.GL_QUADS);
+ gl.glBegin(gl.GL_QUADS);
gl.glNormal3f(CubeNormals[i][0], CubeNormals[i][1], CubeNormals[i][0]);
CgGL.cgGLSetParameter3f(TestColorParam, 1.0f, 0.0f, 0.0f);
@@ -161,7 +162,7 @@ public class cgGL_vertex_example implements GLEventListener
public void display(GLAutoDrawable drawable)
{
- GL gl = drawable.getGL();
+ GL2 gl = drawable.getGL().getGL2();
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
DrawCube(gl);
//glutSwapBuffers();
@@ -227,7 +228,7 @@ public class cgGL_vertex_example implements GLEventListener
TestColorParam = CgGL.cgGetNamedParameter(Program, "IN.TestColor");
CheckCgError();
}
- GL gl = drawable.getGL();
+ GL2 gl = drawable.getGL().getGL2();
InitializeCube(CubeVertices);
diff --git a/src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java b/src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java
index 50cae18..98075d9 100644
--- a/src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java
+++ b/src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java
@@ -35,6 +35,7 @@ package demos.cg.runtime_ogl_vertex_fragment;
import com.sun.opengl.cg.*;
import javax.media.opengl.*;
+import javax.media.opengl.awt.*;
import javax.media.opengl.glu.*;
import com.sun.opengl.util.*;
import com.sun.opengl.util.*;
@@ -99,7 +100,7 @@ public class runtime_ogl_vertex_fragment implements GLEventListener
// Use debug pipeline
// drawable.setGL(new DebugGL(drawable.getGL()));
- GL gl = drawable.getGL();
+ GL2 gl = drawable.getGL().getGL2();
// Basic Cg setup; register a callback function for any errors
// and create an initial context
@@ -134,7 +135,7 @@ public class runtime_ogl_vertex_fragment implements GLEventListener
public void display(GLAutoDrawable drawable)
{
- GL gl = drawable.getGL();
+ GL2 gl = drawable.getGL().getGL2();
// The usual OpenGL stuff to clear the screen and set up viewing.
gl.glClearColor(.25f, .25f, .25f, 1.0f);
@@ -272,7 +273,7 @@ public class runtime_ogl_vertex_fragment implements GLEventListener
CgGL.cgGLLoadProgram(fragmentProgram);
}
- void LoadTextures(GL gl)
+ void LoadTextures(GL2 gl)
{
// There is only one texture needed here--we'll set up a basic
// checkerboard--which is used to modulate the diffuse channel in the
@@ -282,7 +283,7 @@ public class runtime_ogl_vertex_fragment implements GLEventListener
// Basic OpenGL texture state setup
gl.glBindTexture(GL.GL_TEXTURE_2D, handle[0]);
- gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_GENERATE_MIPMAP_SGIS, GL.GL_TRUE);
+ gl.glTexParameteri(GL.GL_TEXTURE_2D, gl.GL_GENERATE_MIPMAP, GL.GL_TRUE);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR_MIPMAP_LINEAR);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL.GL_CLAMP_TO_EDGE);
@@ -322,7 +323,7 @@ public class runtime_ogl_vertex_fragment implements GLEventListener
private static FloatBuffer P, N, uv;
private static IntBuffer indices;
- void DrawGeometry(GL gl)
+ void DrawGeometry(GL2 gl)
{
// Cache the sphere positions, normals, texture coordinates, and
// vertex indices in a local array; we only need to fill them in the
@@ -396,7 +397,7 @@ public class runtime_ogl_vertex_fragment implements GLEventListener
CgGL.cgGLEnableTextureParameter(param);
// And now, draw the geometry.
- gl.glDrawElements(GL.GL_TRIANGLES, 3*nTris, GL.GL_UNSIGNED_INT, indices);
+ gl.glDrawElements(GL.GL_TRIANGLES, 3*nTris, gl.GL_UNSIGNED_INT, indices);
// Be a good citizen and disable the various bindings we set up above.
param = CgGL.cgGetNamedParameter(vertexProgram, "Pobject");