aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes/com/sun
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2008-07-25 16:26:27 +0000
committerSven Gothel <[email protected]>2008-07-25 16:26:27 +0000
commitdb40249b86a14c2178be8a2f61dc97f4ac1f1424 (patch)
treec570b317b13c11bf2e6b1c79d157aac24df32409 /src/classes/com/sun
parent4ce0d2396726dcd285f753fcacd0acc4e2b60469 (diff)
../jogl.log
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1735 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/classes/com/sun')
-rwxr-xr-xsrc/classes/com/sun/opengl/impl/ProjectFloat.java58
-rwxr-xr-xsrc/classes/com/sun/opengl/impl/egl/EGLDrawable.java2
-rwxr-xr-xsrc/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java40
-rw-r--r--src/classes/com/sun/opengl/impl/es2/FixedFuncShader.java246
-rw-r--r--src/classes/com/sun/opengl/impl/es2/FixedFuncShaderVertexColor.java57
-rw-r--r--src/classes/com/sun/opengl/impl/es2/FixedFuncShaderVertexColorTexture.java60
-rw-r--r--src/classes/com/sun/opengl/impl/es2/ShaderData.java60
-rw-r--r--src/classes/com/sun/opengl/impl/es2/VBOBufferDrawGLES2.java70
-rw-r--r--src/classes/com/sun/opengl/impl/gl2es1/VBOBufferDrawGL2ES1.java70
-rw-r--r--src/classes/com/sun/opengl/impl/glu/GLUquadricImpl.java70
10 files changed, 654 insertions, 79 deletions
diff --git a/src/classes/com/sun/opengl/impl/ProjectFloat.java b/src/classes/com/sun/opengl/impl/ProjectFloat.java
index 4e6c4ac85..637377237 100755
--- a/src/classes/com/sun/opengl/impl/ProjectFloat.java
+++ b/src/classes/com/sun/opengl/impl/ProjectFloat.java
@@ -136,6 +136,13 @@ public class ProjectFloat {
0.0f, 0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f };
+ private static final float[] ZERO_MATRIX =
+ new float[] {
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f };
+
// Note that we have cloned parts of the implementation in order to
// support incoming Buffers. The reason for this is to avoid loading
// non-direct buffer subclasses unnecessarily, because doing so can
@@ -201,16 +208,25 @@ public class ProjectFloat {
/**
* Make matrix an identity matrix
*/
- private void __gluMakeIdentityf(FloatBuffer m) {
+ public static void gluMakeIdentityf(FloatBuffer m) {
int oldPos = m.position();
m.put(IDENTITY_MATRIX);
m.position(oldPos);
}
/**
+ * Make matrix an zero matrix
+ */
+ public static void gluMakeZero(FloatBuffer m) {
+ int oldPos = m.position();
+ m.put(ZERO_MATRIX);
+ m.position(oldPos);
+ }
+
+ /**
* Make matrix an identity matrix
*/
- private void __gluMakeIdentityf(float[] m) {
+ private void gluMakeIdentityf(float[] m) {
for (int i = 0; i < 16; i++) {
m[i] = IDENTITY_MATRIX[i];
}
@@ -269,7 +285,7 @@ public class ProjectFloat {
temp[i][j] = src[i*4+j];
}
}
- __gluMakeIdentityf(inverse);
+ gluMakeIdentityf(inverse);
for (i = 0; i < 4; i++) {
//
@@ -343,7 +359,7 @@ public class ProjectFloat {
temp.put(i*4+j, src.get(i*4+j + srcPos));
}
}
- __gluMakeIdentityf(inverse);
+ gluMakeIdentityf(inverse);
for (i = 0; i < 4; i++) {
//
@@ -403,7 +419,7 @@ public class ProjectFloat {
* @param b
* @param r
*/
- private void __gluMultMatricesf(float[] a, int a_offset, float[] b, int b_offset, float[] r) {
+ private void gluMultMatricesf(float[] a, int a_offset, float[] b, int b_offset, float[] r) {
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
r[i*4+j] =
@@ -421,7 +437,7 @@ public class ProjectFloat {
* @param b
* @param r
*/
- private void __gluMultMatricesf(FloatBuffer a, FloatBuffer b, FloatBuffer r) {
+ public static void gluMultMatricesf(FloatBuffer a, FloatBuffer b, FloatBuffer r) {
int aPos = a.position();
int bPos = b.position();
int rPos = r.position();
@@ -442,11 +458,11 @@ public class ProjectFloat {
*
* @param v
*/
- private static void normalize(float[] v) {
+ public static void normalize(float[] v) {
float r;
r = (float) Math.sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
- if ( r == 0.0 )
+ if ( r == 0.0 || r == 1.0)
return;
r = 1.0f / r;
@@ -463,7 +479,7 @@ public class ProjectFloat {
*
* @param v
*/
- private static void normalize(FloatBuffer v) {
+ public static void normalize(FloatBuffer v) {
float r;
int vPos = v.position();
@@ -471,7 +487,7 @@ public class ProjectFloat {
r = (float) Math.sqrt(v.get(0+vPos) * v.get(0+vPos) +
v.get(1+vPos) * v.get(1+vPos) +
v.get(2+vPos) * v.get(2+vPos));
- if ( r == 0.0 )
+ if ( r == 0.0 || r == 1.0)
return;
r = 1.0f / r;
@@ -522,7 +538,7 @@ public class ProjectFloat {
* @param bottom
* @param top
*/
- public void gluOrtho2D(GL2ES1 gl, float left, float right, float bottom, float top) {
+ public void gluOrtho2D(GL gl, float left, float right, float bottom, float top) {
gl.glOrthof(left, right, bottom, top, -1, 1);
}
@@ -534,7 +550,7 @@ public class ProjectFloat {
* @param zNear
* @param zFar
*/
- public void gluPerspective(GL2ES1 gl, float fovy, float aspect, float zNear, float zFar) {
+ public void gluPerspective(GL gl, float fovy, float aspect, float zNear, float zFar) {
float sine, cotangent, deltaZ;
float radians = fovy / 2 * (float) Math.PI / 180;
@@ -547,7 +563,7 @@ public class ProjectFloat {
cotangent = (float) Math.cos(radians) / sine;
- __gluMakeIdentityf(matrixBuf);
+ gluMakeIdentityf(matrixBuf);
matrixBuf.put(0 * 4 + 0, cotangent / aspect);
matrixBuf.put(1 * 4 + 1, cotangent);
@@ -572,7 +588,7 @@ public class ProjectFloat {
* @param upy
* @param upz
*/
- public void gluLookAt(GL2ES1 gl,
+ public void gluLookAt(GL gl,
float eyex,
float eyey,
float eyez,
@@ -603,7 +619,7 @@ public class ProjectFloat {
/* Recompute up as: up = side x forward */
cross(side, forward, up);
- __gluMakeIdentityf(matrixBuf);
+ gluMakeIdentityf(matrixBuf);
matrixBuf.put(0 * 4 + 0, side.get(0));
matrixBuf.put(1 * 4 + 0, side.get(1));
matrixBuf.put(2 * 4 + 0, side.get(2));
@@ -754,7 +770,7 @@ public class ProjectFloat {
float[] in = this.in;
float[] out = this.out;
- __gluMultMatricesf(modelMatrix, modelMatrix_offset, projMatrix, projMatrix_offset, matrix);
+ gluMultMatricesf(modelMatrix, modelMatrix_offset, projMatrix, projMatrix_offset, matrix);
if (!__gluInvertMatrixf(matrix, matrix))
return false;
@@ -811,7 +827,7 @@ public class ProjectFloat {
FloatBuffer in = this.inBuf;
FloatBuffer out = this.outBuf;
- __gluMultMatricesf(modelMatrix, projMatrix, matrixBuf);
+ gluMultMatricesf(modelMatrix, projMatrix, matrixBuf);
if (!__gluInvertMatrixf(matrixBuf, matrixBuf))
return false;
@@ -880,7 +896,7 @@ public class ProjectFloat {
float[] in = this.in;
float[] out = this.out;
- __gluMultMatricesf(modelMatrix, modelMatrix_offset, projMatrix, projMatrix_offset, matrix);
+ gluMultMatricesf(modelMatrix, modelMatrix_offset, projMatrix, projMatrix_offset, matrix);
if (!__gluInvertMatrixf(matrix, matrix))
return false;
@@ -941,7 +957,7 @@ public class ProjectFloat {
FloatBuffer in = this.inBuf;
FloatBuffer out = this.outBuf;
- __gluMultMatricesf(modelMatrix, projMatrix, matrixBuf);
+ gluMultMatricesf(modelMatrix, projMatrix, matrixBuf);
if (!__gluInvertMatrixf(matrixBuf, matrixBuf))
return false;
@@ -985,7 +1001,7 @@ public class ProjectFloat {
* @param deltaY
* @param viewport
*/
- public void gluPickMatrix(GL2ES1 gl,
+ public void gluPickMatrix(GL gl,
float x,
float y,
float deltaX,
@@ -1013,7 +1029,7 @@ public class ProjectFloat {
* @param viewport
* @param viewport_offset
*/
- public void gluPickMatrix(GL2ES1 gl,
+ public void gluPickMatrix(GL gl,
float x,
float y,
float deltaX,
diff --git a/src/classes/com/sun/opengl/impl/egl/EGLDrawable.java b/src/classes/com/sun/opengl/impl/egl/EGLDrawable.java
index 061a3eb38..60aed64be 100755
--- a/src/classes/com/sun/opengl/impl/egl/EGLDrawable.java
+++ b/src/classes/com/sun/opengl/impl/egl/EGLDrawable.java
@@ -55,7 +55,7 @@ public class EGLDrawable extends GLDrawableImpl {
this.chooser = chooser;
surface=EGL.EGL_NO_SURFACE;
- display = EGL.eglGetDisplay((component.getDisplayHandle()>0)?component.getDisplayHandle():EGL.EGL_DEFAULT_DISPLAY);
+ display = EGL.eglGetDisplay((0!=component.getDisplayHandle())?component.getDisplayHandle():EGL.EGL_DEFAULT_DISPLAY);
if (display == EGL.EGL_NO_DISPLAY) {
throw new GLException("eglGetDisplay failed");
}
diff --git a/src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java b/src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java
index 9f6d6b789..9ff4b7eac 100755
--- a/src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java
+++ b/src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java
@@ -79,6 +79,11 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
throw new GLException("Invalid GL Profile for EGL: "+GLProfile.getProfile());
}
+ // EGL Unix
+ glesLibNames.add("libEGL");
+ // EGL Windows
+ glesLibNames.add("EGL");
+
ClassLoader loader = getClass().getClassLoader();
for (Iterator iter = glesLibNames.iterator(); iter.hasNext(); ) {
NativeLibrary lib = NativeLibrary.open((String) iter.next(), loader);
@@ -92,11 +97,6 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
throw new GLException("Unable to dynamically load OpenGL ES library for profile \"" + GLProfile.getProfile() + "\"");
}
- // On the NVidia APX 2500 we need to separately load the EGL library
- NativeLibrary eglLib = NativeLibrary.open("libEGL", loader);
- if (eglLib != null) {
- libs.add(eglLib);
- }
glesLibraries = libs;
if (GLProfile.isGLES2()) {
@@ -175,24 +175,20 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
public int[] glCapabilities2AttribList(GLCapabilities caps) {
int[] attrs = new int[] {
- EGL.EGL_DEPTH_SIZE, caps.getDepthBits(),
- // FIXME: does this need to be configurable?
- EGL.EGL_SURFACE_TYPE, EGL.EGL_WINDOW_BIT,
- EGL.EGL_RED_SIZE, caps.getRedBits(),
- EGL.EGL_GREEN_SIZE, caps.getGreenBits(),
- EGL.EGL_BLUE_SIZE, caps.getBlueBits(),
- EGL.EGL_ALPHA_SIZE, (caps.getAlphaBits() > 0 ? caps.getAlphaBits() : EGL.EGL_DONT_CARE),
- EGL.EGL_STENCIL_SIZE, (caps.getStencilBits() > 0 ? caps.getStencilBits() : EGL.EGL_DONT_CARE),
- EGL.EGL_NONE, EGL.EGL_NONE,
- EGL.EGL_NONE
- };
-
- // FIXME: we need to query the EGL version to determine
- // whether we are allowed to specify the renderable type
-
+ EGL.EGL_RENDERABLE_TYPE, EGL.EGL_OPENGL_ES_BIT,
+ // FIXME: does this need to be configurable?
+ EGL.EGL_SURFACE_TYPE, EGL.EGL_WINDOW_BIT,
+ EGL.EGL_RED_SIZE, caps.getRedBits(),
+ EGL.EGL_GREEN_SIZE, caps.getGreenBits(),
+ EGL.EGL_BLUE_SIZE, caps.getBlueBits(),
+ EGL.EGL_ALPHA_SIZE, (caps.getAlphaBits() > 0 ? caps.getAlphaBits() : EGL.EGL_DONT_CARE),
+ EGL.EGL_STENCIL_SIZE, (caps.getStencilBits() > 0 ? caps.getStencilBits() : EGL.EGL_DONT_CARE),
+ EGL.EGL_DEPTH_SIZE, caps.getDepthBits(),
+ EGL.EGL_NONE
+ };
if (GLProfile.isGLES2()) {
- attrs[attrs.length - 3] = EGL.EGL_RENDERABLE_TYPE;
- attrs[attrs.length - 2] = EGL.EGL_OPENGL_ES2_BIT;
+ // ES 2
+ attrs[1] = EGL.EGL_OPENGL_ES2_BIT;
}
return attrs;
diff --git a/src/classes/com/sun/opengl/impl/es2/FixedFuncShader.java b/src/classes/com/sun/opengl/impl/es2/FixedFuncShader.java
new file mode 100644
index 000000000..b0fe47b11
--- /dev/null
+++ b/src/classes/com/sun/opengl/impl/es2/FixedFuncShader.java
@@ -0,0 +1,246 @@
+
+package com.sun.opengl.impl.es2;
+
+import javax.media.opengl.util.*;
+import javax.media.opengl.*;
+import java.nio.*;
+
+public class FixedFuncShader {
+ public FixedFuncShader(GL2ES2 gl, PMVMatrix pmvMatrix, ShaderData shaderData) {
+ init(gl, pmvMatrix, shaderData);
+ }
+
+ public boolean isShaderDataValid() {
+ return shaderData.isValid();
+ }
+ public boolean isValid() {
+ return shaderData.isValid() && shaderOk;
+ }
+
+ public void glUseProgram(GL2ES2 gl, boolean on) {
+ if(shaderInUse==on) return;
+ if(!shaderOk) return;
+ gl.glUseProgram(on?shaderProgram:0);
+ shaderInUse = on;
+ }
+
+ public void release(GL2ES2 gl) {
+ glUseProgram(gl, false);
+ gl.glDetachShader(shaderProgram, shaderData.vertexShader());
+ gl.glDetachShader(shaderProgram, shaderData.fragmentShader());
+ gl.glDeleteProgram(shaderProgram);
+ }
+
+ public void syncUniforms(GL2ES2 gl) {
+ if(!shaderOk) return;
+ if(pmvMatrix.isDirty()) {
+ glUseProgram(gl, true);
+ gl.glUniformMatrix4fv(shaderPMVMatrix, 2, false, pmvMatrix.glGetPMVMatrixf());
+ pmvMatrix.clear();
+ }
+ }
+
+ public int glArrayName2AttribName(int glName) {
+ switch(glName) {
+ case GL.GL_VERTEX_ARRAY:
+ return VERTEX_ARRAY;
+ case GL.GL_COLOR_ARRAY:
+ return COLOR_ARRAY;
+ case GL.GL_NORMAL_ARRAY:
+ return NORMAL_ARRAY;
+ case GL.GL_TEXTURE_COORD_ARRAY:
+ return TEXCOORD_ARRAY;
+ }
+ return -1;
+ }
+
+ public void glEnableClientState(GL2ES2 gl, int glArrayName) {
+ if(!shaderOk) return;
+ int attribName = glArrayName2AttribName(glArrayName);
+ if(attribName>=0) {
+ glUseProgram(gl, true);
+ arrayInUse |= (1<<attribName);
+ gl.glEnableVertexAttribArray(attribName);
+ }
+ }
+
+ public void glDisableClientState(GL2ES2 gl, int glArrayName) {
+ if(!shaderOk) return;
+ int attribName = glArrayName2AttribName(glArrayName);
+ if(attribName>=0) {
+ glUseProgram(gl, true);
+ gl.glDisableVertexAttribArray(attribName);
+ arrayInUse &= ~(1<<attribName);
+ if(0==arrayInUse) {
+ glUseProgram(gl, false);
+ }
+ }
+ }
+
+ public void glVertexPointer(GL2ES2 gl, int size, int type, int stride, Buffer data ) {
+ if(!shaderOk) return;
+ glUseProgram(gl, true);
+ gl.glVertexAttribPointer(VERTEX_ARRAY, size, type, false, stride, data);
+ }
+
+ public void glVertexPointer(GL2ES2 gl, int size, int type, int stride, long offset ) {
+ if(!shaderOk) return;
+ glUseProgram(gl, true);
+ gl.glVertexAttribPointer(VERTEX_ARRAY, size, type, false, stride, offset);
+ }
+
+ public void glColorPointer(GL2ES2 gl, int size, int type, int stride, Buffer data ) {
+ if(!shaderOk) return;
+ glUseProgram(gl, true);
+ gl.glVertexAttribPointer(COLOR_ARRAY, size, type, false, stride, data);
+ }
+
+ public void glColorPointer(GL2ES2 gl, int size, int type, int stride, long offset ) {
+ if(!shaderOk) return;
+ glUseProgram(gl, true);
+ gl.glVertexAttribPointer(COLOR_ARRAY, size, type, false, stride, offset);
+ }
+
+ public void glColor4fv(GL2ES2 gl, FloatBuffer data ) {
+ glColorPointer(gl, 4, gl.GL_FLOAT, 0, data);
+ }
+
+ public void glNormalPointer(GL2ES2 gl, int type, int stride, Buffer data ) {
+ if(!shaderOk) return;
+ glUseProgram(gl, true);
+ gl.glVertexAttribPointer(NORMAL_ARRAY, 3, type, false, stride, data);
+ }
+
+ public void glNormalPointer(GL2ES2 gl, int type, int stride, long offset ) {
+ if(!shaderOk) return;
+ glUseProgram(gl, true);
+ gl.glVertexAttribPointer(NORMAL_ARRAY, 3, type, false, stride, offset);
+ }
+
+ public void glTexCoordPointer(GL2ES2 gl, int size, int type, int stride, Buffer data ) {
+ if(!shaderOk) return;
+ glUseProgram(gl, true);
+ gl.glVertexAttribPointer(TEXCOORD_ARRAY, size, type, false, stride, data);
+ }
+
+ public void glTexCoordPointer(GL2ES2 gl, int size, int type, int stride, long offset ) {
+ if(!shaderOk) return;
+ glUseProgram(gl, true);
+ gl.glVertexAttribPointer(TEXCOORD_ARRAY, size, type, false, stride, offset);
+ }
+
+ public void setVertexAttribPointer(GL2ES2 gl, int glArrayName, int size, int type, int stride, Buffer data ) {
+ int attribName = glArrayName2AttribName(glArrayName);
+ if(!shaderOk || attribName<0) return;
+ glUseProgram(gl, true);
+ gl.glEnableVertexAttribArray(attribName);
+ gl.glVertexAttribPointer(attribName, size, type, false, stride, data);
+ }
+
+ public void setVertexAttribPointer(GL2ES2 gl, int glArrayName, int size, int type, int stride, long offset ) {
+ int attribName = glArrayName2AttribName(glArrayName);
+ if(!shaderOk || attribName<0) return;
+ glUseProgram(gl, true);
+ gl.glEnableVertexAttribArray(attribName);
+ gl.glVertexAttribPointer(attribName, size, type, false, stride, offset);
+ }
+
+ public void glLightfv(GL2ES2 gl, int light, int pname, java.nio.FloatBuffer params) {
+ if(!shaderOk) return;
+ light -=GL.GL_LIGHT0;
+ if(0 <= light && light <= 7 && 0<=shaderLightsPos[light] ) {
+ glUseProgram(gl, true);
+ gl.glUniform4fv(shaderLightsPos[light], 1, params);
+ if(0<=shaderLightsSrc[light]) {
+ gl.glUniform1i(shaderLightsSrc[light], pname);
+ }
+ }
+ }
+
+ public void glShadeModel(GL2ES2 gl, int mode) {
+ if(!shaderOk || 0>shaderShadeModel) return;
+ glUseProgram(gl, true);
+ gl.glUniform1i(shaderShadeModel, mode);
+ }
+
+ protected void init(GL2ES2 gl, PMVMatrix pmvMatrix, ShaderData shaderData) {
+ if(shaderOk) return;
+
+ if(null==pmvMatrix) {
+ throw new GLException("PMVMatrix is null");
+ }
+ this.pmvMatrix=pmvMatrix;
+ this.shaderData=shaderData;
+
+ if(!shaderData.createAndCompile(gl)) {
+ return;
+ }
+
+ // Create the shader program
+ shaderProgram = gl.glCreateProgram();
+
+ // Attach the fragment and vertex shaders to it
+ gl.glAttachShader(shaderProgram, shaderData.vertexShader());
+ gl.glAttachShader(shaderProgram, shaderData.fragmentShader());
+
+ gl.glBindAttribLocation(shaderProgram, VERTEX_ARRAY, "mgl_Vertex");
+ gl.glBindAttribLocation(shaderProgram, COLOR_ARRAY, "mgl_Color");
+ gl.glBindAttribLocation(shaderProgram, TEXCOORD_ARRAY, "mgl_MultiTexCoord0");
+
+ // Link the program
+ gl.glLinkProgram(shaderProgram);
+
+ if ( ! gl.glIsProgramValid(shaderProgram, System.err) ) {
+ return;
+ }
+
+ gl.glUseProgram(shaderProgram);
+
+ shaderPMVMatrix = gl.glGetUniformLocation(shaderProgram, "mgl_PMVMatrix");
+ if(0<=shaderPMVMatrix) {
+ gl.glUniformMatrix4fv(shaderPMVMatrix, 2, false, pmvMatrix.glGetPMVMatrixf());
+ pmvMatrix.clear();
+ shaderOk = true;
+ } else {
+ System.err.println("could not get uniform mgl_PMVMatrix: "+shaderPMVMatrix);
+ }
+
+ // optional parameter ..
+ for(int i=0; i<7; i++) {
+ shaderLightsPos[i] = gl.glGetUniformLocation(shaderProgram, "mgl_LightPos"+i);
+ shaderLightsSrc[i] = gl.glGetUniformLocation(shaderProgram, "mgl_LightSrc"+i);
+ }
+ shaderShadeModel = gl.glGetUniformLocation(shaderProgram, "mgl_ShadeModel");
+
+ shaderActiveTexture = gl.glGetUniformLocation(shaderProgram, "mgl_activeTexture");
+ if(0<=shaderActiveTexture) {
+ gl.glUniform1i(shaderActiveTexture, 0);
+ }
+
+ gl.glUseProgram(0);
+ shaderInUse = false;
+ }
+
+ protected PMVMatrix pmvMatrix;
+ protected ShaderData shaderData;
+
+ protected boolean shaderOk = false;
+ protected boolean shaderInUse = false;
+ protected int arrayInUse = 0;
+ protected int shaderProgram=-1;
+
+ // attributes
+ protected static final int VERTEX_ARRAY = 0; // mgl_Vertex
+ protected static final int COLOR_ARRAY = 1; // mgl_Color
+ protected static final int NORMAL_ARRAY = 2; // ?
+ protected static final int TEXCOORD_ARRAY = 3; // mgl_MultiTexCoord0
+
+ // uniforms ..
+ protected int shaderPMVMatrix=-1;
+ protected int[] shaderLightsPos = new int[] { -1, -1, -1, -1, -1, -1, -1 };
+ protected int[] shaderLightsSrc = new int[] { -1, -1, -1, -1, -1, -1, -1 };
+ protected int shaderShadeModel = -1;
+ protected int shaderActiveTexture = -1;
+
+}
+
diff --git a/src/classes/com/sun/opengl/impl/es2/FixedFuncShaderVertexColor.java b/src/classes/com/sun/opengl/impl/es2/FixedFuncShaderVertexColor.java
new file mode 100644
index 000000000..e3900d0b4
--- /dev/null
+++ b/src/classes/com/sun/opengl/impl/es2/FixedFuncShaderVertexColor.java
@@ -0,0 +1,57 @@
+
+package com.sun.opengl.impl.es2;
+
+import javax.media.opengl.util.*;
+import javax.media.opengl.*;
+import java.nio.*;
+
+public class FixedFuncShaderVertexColor extends ShaderData {
+
+ public static final String[][] vertShaderSource = new String[][] { {
+ "#ifdef GL_ES\n"+
+ " #define MEDIUMP mediump\n"+
+ " #define HIGHP highp\n"+
+ "#else\n"+
+ " #define MEDIUMP\n"+
+ " #define HIGHP\n"+
+ "#endif\n"+
+ "\n"+
+ "uniform MEDIUMP mat4 mgl_PMVMatrix[2];\n"+
+ "attribute HIGHP vec4 mgl_Vertex;\n"+
+ "attribute HIGHP vec4 mgl_Color;\n"+
+ "varying HIGHP vec4 frontColor;\n"+
+ "void main(void)\n"+
+ "{\n"+
+ " frontColor=mgl_Color;\n"+
+ " gl_Position = mgl_PMVMatrix[0] * mgl_PMVMatrix[1] * mgl_Vertex;\n"+
+ "}\n" } } ;
+
+ public static final String[][] fragShaderSource = new String[][] { {
+ "#ifdef GL_ES\n"+
+ " #define MEDIUMP mediump\n"+
+ " #define HIGHP highp\n"+
+ "#else\n"+
+ " #define MEDIUMP\n"+
+ " #define HIGHP\n"+
+ "#endif\n"+
+ "\n"+
+ "varying HIGHP vec4 frontColor;\n"+
+ "void main (void)\n"+
+ "{\n"+
+ " gl_FragColor = frontColor;\n"+
+ "}\n" } } ;
+
+
+ public FixedFuncShaderVertexColor() {
+ super(1, 1);
+ }
+
+ public int vertexShaderBinaryFormat() { return 0; }
+ public Buffer vertexShaderBinary() { return null; }
+ public String[][] vertexShaderSource() { return vertShaderSource; }
+
+ public int fragmentShaderBinaryFormat() { return 0; }
+ public Buffer fragmentShaderBinary() { return null; }
+ public String[][] fragmentShaderSource() { return fragShaderSource; }
+}
+
diff --git a/src/classes/com/sun/opengl/impl/es2/FixedFuncShaderVertexColorTexture.java b/src/classes/com/sun/opengl/impl/es2/FixedFuncShaderVertexColorTexture.java
new file mode 100644
index 000000000..039479c78
--- /dev/null
+++ b/src/classes/com/sun/opengl/impl/es2/FixedFuncShaderVertexColorTexture.java
@@ -0,0 +1,60 @@
+
+package com.sun.opengl.impl.es2;
+
+import javax.media.opengl.util.*;
+import javax.media.opengl.*;
+import java.nio.*;
+
+public class FixedFuncShaderVertexColorTexture extends ShaderData {
+
+ public static final String[][] vertShaderSource = new String[][] { {
+ "#ifdef GL_ES\n"+
+ " #define MEDIUMP mediump\n"+
+ " #define HIGHP highp\n"+
+ "#else\n"+
+ " #define MEDIUMP\n"+
+ " #define HIGHP\n"+
+ "#endif\n"+
+ "\n"+
+ "uniform MEDIUMP mat4 mgl_PMVMatrix[2];\n"+
+ "attribute HIGHP vec4 mgl_Vertex;\n"+
+ "attribute HIGHP vec4 mgl_Color;\n"+
+ "attribute HIGHP vec4 gl_MultiTexCoord0;\n"+
+ "varying HIGHP vec4 frontColor;\n"+
+ "void main(void)\n"+
+ "{\n"+
+ " frontColor=mgl_Color;\n"+
+ " gl_TexCoord[0] = gl_MultiTexCoord0;\n"+
+ " gl_Position = mgl_PMVMatrix[0] * mgl_PMVMatrix[1] * mgl_Vertex;\n"+
+ "}\n" } } ;
+
+ public static final String[][] fragShaderSource = new String[][] { {
+ "#ifdef GL_ES\n"+
+ " #define MEDIUMP mediump\n"+
+ " #define HIGHP highp\n"+
+ "#else\n"+
+ " #define MEDIUMP\n"+
+ " #define HIGHP\n"+
+ "#endif\n"+
+ "\n"+
+ "uniform HIGHP sampler2D mgl_activeTexture;\n"+
+ "varying HIGHP vec4 frontColor;\n"+
+ "void main (void)\n"+
+ "{\n"+
+ " vec4 texColor = texture2D(mgl_activeTexture,gl_TexCoord[0].st);\n"+
+ " gl_FragColor = frontColor+texColor;\n"+
+ "}\n" } } ;
+
+ public FixedFuncShaderVertexColorTexture() {
+ super(1, 1);
+ }
+
+ public int vertexShaderBinaryFormat() { return 0; }
+ public Buffer vertexShaderBinary() { return null; }
+ public String[][] vertexShaderSource() { return vertShaderSource; }
+
+ public int fragmentShaderBinaryFormat() { return 0; }
+ public Buffer fragmentShaderBinary() { return null; }
+ public String[][] fragmentShaderSource() { return fragShaderSource; }
+}
+
diff --git a/src/classes/com/sun/opengl/impl/es2/ShaderData.java b/src/classes/com/sun/opengl/impl/es2/ShaderData.java
new file mode 100644
index 000000000..3a3c17811
--- /dev/null
+++ b/src/classes/com/sun/opengl/impl/es2/ShaderData.java
@@ -0,0 +1,60 @@
+
+package com.sun.opengl.impl.es2;
+
+import javax.media.opengl.util.*;
+import javax.media.opengl.*;
+import java.nio.*;
+
+public abstract class ShaderData {
+ public abstract int vertexShaderBinaryFormat();
+ public abstract Buffer vertexShaderBinary();
+ public abstract String[][] vertexShaderSource();
+
+ public abstract int fragmentShaderBinaryFormat();
+ public abstract Buffer fragmentShaderBinary();
+ public abstract String[][] fragmentShaderSource();
+
+ public boolean isValid() { return valid; }
+ public void setValid(boolean val) { valid=val; }
+
+ public ShaderData(int numVertexShader, int numFragmentShader) {
+ vertShader = BufferUtil.newIntBuffer(numVertexShader);
+ fragShader = BufferUtil.newIntBuffer(numFragmentShader);
+ }
+
+ public IntBuffer vertexShader() { return vertShader; }
+ public IntBuffer fragmentShader() { return fragShader; }
+
+ public boolean createAndCompile(GL2ES2 gl) {
+ if(isValid()) return true;
+ boolean res;
+
+ // Create & Compile the vertex/fragment shader objects
+ res=gl.glCreateCompileShader(vertexShader(), gl.GL_VERTEX_SHADER,
+ vertexShaderBinaryFormat(), vertexShaderBinary(),
+ vertexShaderSource(), System.err);
+ if(!res) return false;
+
+ res=gl.glCreateCompileShader(fragmentShader(), gl.GL_FRAGMENT_SHADER,
+ fragmentShaderBinaryFormat(), fragmentShaderBinary(),
+ fragmentShaderSource(), System.err);
+ if(!res) return false;
+
+ setValid(true);
+ return true;
+ }
+
+ public void release(GL2ES2 gl) {
+ if(isValid()) {
+ gl.glDeleteShader(fragmentShader());
+ gl.glDeleteShader(vertexShader());
+ setValid(false);
+ }
+ }
+
+ protected IntBuffer vertShader = null;
+ protected IntBuffer fragShader = null;
+
+ protected boolean valid=false;
+}
+
diff --git a/src/classes/com/sun/opengl/impl/es2/VBOBufferDrawGLES2.java b/src/classes/com/sun/opengl/impl/es2/VBOBufferDrawGLES2.java
new file mode 100644
index 000000000..30cf7e327
--- /dev/null
+++ b/src/classes/com/sun/opengl/impl/es2/VBOBufferDrawGLES2.java
@@ -0,0 +1,70 @@
+
+package com.sun.opengl.impl.es2;
+
+import javax.media.opengl.util.VBOBufferDraw;
+import javax.media.opengl.*;
+import java.nio.*;
+
+public class VBOBufferDrawGLES2 extends VBOBufferDraw {
+
+ public VBOBufferDrawGLES2(int glArrayType, int glDataType, int glBufferUsage, int comps, int initialSize) {
+ init(glArrayType, glDataType, glBufferUsage, comps, initialSize);
+ setVBOUsage(false);
+ //System.err.println("new VBOBufferDrawGLES2: "+this);
+ }
+
+ protected void enableBufferGLImpl(GL gl, boolean newData) {
+ if(!bufferEnabled && null!=buffer) {
+ gl.glEnableClientState(glArrayType);
+ if(vboUsage) {
+ gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vboName);
+ if(newData) {
+ gl.glBufferData(GL.GL_ARRAY_BUFFER, buffer.limit() * getBufferCompSize(), buffer, glBufferUsage);
+ }
+ switch(glArrayType) {
+ case GL.GL_VERTEX_ARRAY:
+ gl.glVertexPointer(components, glDataType, 0, 0);
+ break;
+ case GL.GL_NORMAL_ARRAY:
+ gl.glNormalPointer(glDataType, 0, 0);
+ break;
+ case GL.GL_COLOR_ARRAY:
+ gl.glColorPointer(components, glDataType, 0, 0);
+ break;
+ case GL.GL_TEXTURE_COORD_ARRAY:
+ gl.glTexCoordPointer(components, glDataType, 0, 0);
+ break;
+ default:
+ throw new GLException("invalid glArrayType: "+glArrayType+":\n\t"+this);
+ }
+ } else {
+ switch(glArrayType) {
+ case GL.GL_VERTEX_ARRAY:
+ gl.glVertexPointer(components, glDataType, 0, buffer);
+ break;
+ case GL.GL_NORMAL_ARRAY:
+ gl.glNormalPointer(glDataType, 0, buffer);
+ break;
+ case GL.GL_COLOR_ARRAY:
+ gl.glColorPointer(components, glDataType, 0, buffer);
+ break;
+ case GL.GL_TEXTURE_COORD_ARRAY:
+ gl.glTexCoordPointer(components, glDataType, 0, buffer);
+ break;
+ default:
+ throw new GLException("invalid glArrayType: "+glArrayType+":\n\t"+this);
+ }
+ }
+ bufferEnabled = true;
+ }
+ }
+
+ protected void disableBufferGLImpl(GL gl) {
+ if(bufferEnabled && null!=buffer) {
+ gl.glDisableClientState(glArrayType);
+ bufferEnabled = false;
+ }
+ }
+
+}
+
diff --git a/src/classes/com/sun/opengl/impl/gl2es1/VBOBufferDrawGL2ES1.java b/src/classes/com/sun/opengl/impl/gl2es1/VBOBufferDrawGL2ES1.java
new file mode 100644
index 000000000..5897b9a79
--- /dev/null
+++ b/src/classes/com/sun/opengl/impl/gl2es1/VBOBufferDrawGL2ES1.java
@@ -0,0 +1,70 @@
+
+package com.sun.opengl.impl.gl2es1;
+
+import javax.media.opengl.util.VBOBufferDraw;
+import javax.media.opengl.*;
+import java.nio.*;
+
+public class VBOBufferDrawGL2ES1 extends VBOBufferDraw {
+
+ public VBOBufferDrawGL2ES1(int glArrayType, int glDataType, int glBufferUsage, int comps, int initialSize) {
+ init(glArrayType, glDataType, glBufferUsage, comps, initialSize);
+ setVBOUsage(false);
+ //System.err.println("new VBOBufferDrawGL2ES1: "+this);
+ }
+
+ protected void enableBufferGLImpl(GL gl, boolean newData) {
+ if(!bufferEnabled && null!=buffer) {
+ gl.glEnableClientState(glArrayType);
+ if(vboUsage) {
+ gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vboName);
+ if(newData) {
+ gl.glBufferData(GL.GL_ARRAY_BUFFER, buffer.limit() * getBufferCompSize(), buffer, glBufferUsage);
+ }
+ switch(glArrayType) {
+ case GL.GL_VERTEX_ARRAY:
+ gl.glVertexPointer(components, glDataType, 0, 0);
+ break;
+ case GL.GL_NORMAL_ARRAY:
+ gl.glNormalPointer(glDataType, 0, 0);
+ break;
+ case GL.GL_COLOR_ARRAY:
+ gl.glColorPointer(components, glDataType, 0, 0);
+ break;
+ case GL.GL_TEXTURE_COORD_ARRAY:
+ gl.glTexCoordPointer(components, glDataType, 0, 0);
+ break;
+ default:
+ throw new GLException("invalid glArrayType: "+glArrayType+":\n\t"+this);
+ }
+ } else {
+ switch(glArrayType) {
+ case GL.GL_VERTEX_ARRAY:
+ gl.glVertexPointer(components, glDataType, 0, buffer);
+ break;
+ case GL.GL_NORMAL_ARRAY:
+ gl.glNormalPointer(glDataType, 0, buffer);
+ break;
+ case GL.GL_COLOR_ARRAY:
+ gl.glColorPointer(components, glDataType, 0, buffer);
+ break;
+ case GL.GL_TEXTURE_COORD_ARRAY:
+ gl.glTexCoordPointer(components, glDataType, 0, buffer);
+ break;
+ default:
+ throw new GLException("invalid glArrayType: "+glArrayType+":\n\t"+this);
+ }
+ }
+ bufferEnabled = true;
+ }
+ }
+
+ protected void disableBufferGLImpl(GL gl) {
+ if(bufferEnabled && null!=buffer) {
+ gl.glDisableClientState(glArrayType);
+ bufferEnabled = false;
+ }
+ }
+
+}
+
diff --git a/src/classes/com/sun/opengl/impl/glu/GLUquadricImpl.java b/src/classes/com/sun/opengl/impl/glu/GLUquadricImpl.java
index 667a4c780..8c2a4eef2 100644
--- a/src/classes/com/sun/opengl/impl/glu/GLUquadricImpl.java
+++ b/src/classes/com/sun/opengl/impl/glu/GLUquadricImpl.java
@@ -191,7 +191,7 @@ public class GLUquadricImpl implements GLUquadric {
return res;
}
- public void resetImmModeSink(GL2ES1 gl) {
+ public void resetImmModeSink(GL gl) {
if(immModeSinkEnabled) {
immModeSink.reset(gl);
}
@@ -326,7 +326,7 @@ public class GLUquadricImpl implements GLUquadric {
* @param slices Specifies the number of subdivisions around the z axis.
* @param stacks Specifies the number of subdivisions along the z axis.
*/
- public void drawCylinder(GL2ES1 gl, float baseRadius, float topRadius, float height, int slices, int stacks) {
+ public void drawCylinder(GL gl, float baseRadius, float topRadius, float height, int slices, int stacks) {
float da, r, dr, dz;
float x, y, z, nz, nsign;
@@ -345,7 +345,7 @@ public class GLUquadricImpl implements GLUquadric {
// Z component of normal vectors
if (drawStyle == GLU.GLU_POINT) {
- glBegin(gl, GL2ES1.GL_POINTS);
+ glBegin(gl, GL.GL_POINTS);
for (i = 0; i < slices; i++) {
x = cos((i * da));
y = sin((i * da));
@@ -368,7 +368,7 @@ public class GLUquadricImpl implements GLUquadric {
z = 0.0f;
r = baseRadius;
for (j = 0; j <= stacks; j++) {
- glBegin(gl, GL2ES1.GL_LINE_LOOP);
+ glBegin(gl, GL.GL_LINE_LOOP);
for (i = 0; i < slices; i++) {
x = cos((i * da));
y = sin((i * da));
@@ -384,7 +384,7 @@ public class GLUquadricImpl implements GLUquadric {
} else {
// draw one ring at each end
if (baseRadius != 0.0) {
- glBegin(gl, GL2ES1.GL_LINE_LOOP);
+ glBegin(gl, GL.GL_LINE_LOOP);
for (i = 0; i < slices; i++) {
x = cos((i * da));
y = sin((i * da));
@@ -394,7 +394,7 @@ public class GLUquadricImpl implements GLUquadric {
glVertex3f(gl, (x * baseRadius), (y * baseRadius), 0.0f);
}
glEnd(gl);
- glBegin(gl, GL2ES1.GL_LINE_LOOP);
+ glBegin(gl, GL.GL_LINE_LOOP);
for (i = 0; i < slices; i++) {
x = cos((i * da));
y = sin((i * da));
@@ -407,7 +407,7 @@ public class GLUquadricImpl implements GLUquadric {
}
}
// draw length lines
- glBegin(gl, GL2ES1.GL_LINES);
+ glBegin(gl, GL.GL_LINES);
for (i = 0; i < slices; i++) {
x = cos((i * da));
y = sin((i * da));
@@ -486,7 +486,7 @@ public class GLUquadricImpl implements GLUquadric {
* (1, 0.5), at (0, r, 0) it is (0.5, 1), at (-r, 0, 0) it is (0, 0.5), and at
* (0, -r, 0) it is (0.5, 0).
*/
- public void drawDisk(GL2ES1 gl, float innerRadius, float outerRadius, int slices, int loops)
+ public void drawDisk(GL gl, float innerRadius, float outerRadius, int slices, int loops)
{
float da, dr;
@@ -562,7 +562,7 @@ public class GLUquadricImpl implements GLUquadric {
/* draw loops */
for (l = 0; l <= loops; l++) {
float r = innerRadius + l * dr;
- glBegin(gl, GL2ES1.GL_LINE_LOOP);
+ glBegin(gl, GL.GL_LINE_LOOP);
for (s = 0; s < slices; s++) {
float a = s * da;
glVertex2f(gl, r * sin(a), r * cos(a));
@@ -574,7 +574,7 @@ public class GLUquadricImpl implements GLUquadric {
float a = s * da;
float x = sin(a);
float y = cos(a);
- glBegin(gl, GL2ES1.GL_LINE_STRIP);
+ glBegin(gl, GL.GL_LINE_STRIP);
for (l = 0; l <= loops; l++) {
float r = innerRadius + l * dr;
glVertex2f(gl, r * x, r * y);
@@ -586,7 +586,7 @@ public class GLUquadricImpl implements GLUquadric {
case GLU.GLU_POINT:
{
int s;
- glBegin(gl, GL2ES1.GL_POINTS);
+ glBegin(gl, GL.GL_POINTS);
for (s = 0; s < slices; s++) {
float a = s * da;
float x = sin(a);
@@ -604,7 +604,7 @@ public class GLUquadricImpl implements GLUquadric {
{
if (innerRadius != 0.0) {
float a;
- glBegin(gl, GL2ES1.GL_LINE_LOOP);
+ glBegin(gl, GL.GL_LINE_LOOP);
for (a = 0.0f; a < 2.0 * PI; a += da) {
float x = innerRadius * sin(a);
float y = innerRadius * cos(a);
@@ -614,7 +614,7 @@ public class GLUquadricImpl implements GLUquadric {
}
{
float a;
- glBegin(gl, GL2ES1.GL_LINE_LOOP);
+ glBegin(gl, GL.GL_LINE_LOOP);
for (a = 0; a < 2.0f * PI; a += da) {
float x = outerRadius * sin(a);
float y = outerRadius * cos(a);
@@ -652,7 +652,7 @@ public class GLUquadricImpl implements GLUquadric {
* is (1, 0.5), at (0, r, 0) it is (0.5, 1), at (-r, 0, 0) it is (0, 0.5),
* and at (0, -r, 0) it is (0.5, 0).
*/
- public void drawPartialDisk(GL2ES1 gl,
+ public void drawPartialDisk(GL gl,
float innerRadius,
float outerRadius,
int slices,
@@ -735,7 +735,7 @@ public class GLUquadricImpl implements GLUquadric {
if (innerRadius == .0f) {
finish = loops - 1;
/* Triangle strip for inner polygons */
- glBegin(gl, GL2ES1.GL_TRIANGLE_FAN);
+ glBegin(gl, GL.GL_TRIANGLE_FAN);
if (textureFlag) {
glTexCoord2f(gl, 0.5f, 0.5f);
}
@@ -810,7 +810,7 @@ public class GLUquadricImpl implements GLUquadric {
}
break;
case GLU.GLU_POINT :
- glBegin(gl, GL2ES1.GL_POINTS);
+ glBegin(gl, GL.GL_POINTS);
for (i = 0; i < slices2; i++) {
sintemp = sinCache[i];
costemp = cosCache[i];
@@ -830,7 +830,7 @@ public class GLUquadricImpl implements GLUquadric {
break;
case GLU.GLU_LINE :
if (innerRadius == outerRadius) {
- glBegin(gl, GL2ES1.GL_LINE_STRIP);
+ glBegin(gl, GL.GL_LINE_STRIP);
for (i = 0; i <= slices; i++) {
if (textureFlag) {
@@ -847,7 +847,7 @@ public class GLUquadricImpl implements GLUquadric {
texLow = radiusLow / outerRadius / 2;
}
- glBegin(gl, GL2ES1.GL_LINE_STRIP);
+ glBegin(gl, GL.GL_LINE_STRIP);
for (i = 0; i <= slices; i++) {
if (textureFlag) {
glTexCoord2f(gl, texLow * sinCache[i] + 0.5f,
@@ -860,7 +860,7 @@ public class GLUquadricImpl implements GLUquadric {
for (i = 0; i < slices2; i++) {
sintemp = sinCache[i];
costemp = cosCache[i];
- glBegin(gl, GL2ES1.GL_LINE_STRIP);
+ glBegin(gl, GL.GL_LINE_STRIP);
for (j = 0; j <= loops; j++) {
radiusLow = outerRadius - deltaRadius * ((float) j / loops);
if (textureFlag) {
@@ -881,7 +881,7 @@ public class GLUquadricImpl implements GLUquadric {
for (i = 0; i <= slices; i += slices) {
sintemp = sinCache[i];
costemp = cosCache[i];
- glBegin(gl, GL2ES1.GL_LINE_STRIP);
+ glBegin(gl, GL.GL_LINE_STRIP);
for (j = 0; j <= loops; j++) {
radiusLow = outerRadius - deltaRadius * ((float) j / loops);
@@ -901,7 +901,7 @@ public class GLUquadricImpl implements GLUquadric {
texLow = radiusLow / outerRadius / 2;
}
- glBegin(gl, GL2ES1.GL_LINE_STRIP);
+ glBegin(gl, GL.GL_LINE_STRIP);
for (i = 0; i <= slices; i++) {
if (textureFlag) {
glTexCoord2f(gl, texLow * sinCache[i] + 0.5f,
@@ -934,7 +934,7 @@ public class GLUquadricImpl implements GLUquadric {
* 0.0 at the +y axis, to 0.25 at the +x axis, to 0.5 at the -y axis, to 0.75
* at the -x axis, and back to 1.0 at the +y axis.
*/
- public void drawSphere(GL2ES1 gl, float radius, int slices, int stacks) {
+ public void drawSphere(GL gl, float radius, int slices, int stacks) {
// TODO
float rho, drho, theta, dtheta;
@@ -958,7 +958,7 @@ public class GLUquadricImpl implements GLUquadric {
if (drawStyle == GLU.GLU_FILL) {
if (!textureFlag) {
// draw +Z end as a triangle fan
- glBegin(gl, GL2ES1.GL_TRIANGLE_FAN);
+ glBegin(gl, GL.GL_TRIANGLE_FAN);
if(USE_NORM_TXT) {
glNormal3f(gl, 0.0f, 0.0f, 1.0f);
}
@@ -1024,7 +1024,7 @@ public class GLUquadricImpl implements GLUquadric {
if (!textureFlag) {
// draw -Z end as a triangle fan
- glBegin(gl, GL2ES1.GL_TRIANGLE_FAN);
+ glBegin(gl, GL.GL_TRIANGLE_FAN);
if(USE_NORM_TXT) {
glNormal3f(gl, 0.0f, 0.0f, -1.0f);
}
@@ -1053,7 +1053,7 @@ public class GLUquadricImpl implements GLUquadric {
i < stacks;
i++) { // stack line at i==stacks-1 was missing here
rho = i * drho;
- glBegin(gl, GL2ES1.GL_LINE_LOOP);
+ glBegin(gl, GL.GL_LINE_LOOP);
for (j = 0; j < slices; j++) {
theta = j * dtheta;
x = cos(theta) * sin(rho);
@@ -1068,7 +1068,7 @@ public class GLUquadricImpl implements GLUquadric {
// draw slice lines
for (j = 0; j < slices; j++) {
theta = j * dtheta;
- glBegin(gl, GL2ES1.GL_LINE_STRIP);
+ glBegin(gl, GL.GL_LINE_STRIP);
for (i = 0; i <= stacks; i++) {
rho = i * drho;
x = cos(theta) * sin(rho);
@@ -1082,7 +1082,7 @@ public class GLUquadricImpl implements GLUquadric {
}
} else if (drawStyle == GLU.GLU_POINT) {
// top and bottom-most points
- glBegin(gl, GL2ES1.GL_POINTS);
+ glBegin(gl, GL.GL_POINTS);
if (normals)
glNormal3f(gl, 0.0f, 0.0f, nsign);
glVertex3f(gl, 0.0f, 0.0f, radius);
@@ -1115,7 +1115,7 @@ public class GLUquadricImpl implements GLUquadric {
private static final float PI = (float)Math.PI;
private static final int CACHE_SIZE = 240;
- private final void glBegin(GL2ES1 gl, int mode) {
+ private final void glBegin(GL gl, int mode) {
if(immModeSinkEnabled) {
immModeSink.glBegin(mode);
} else {
@@ -1123,7 +1123,7 @@ public class GLUquadricImpl implements GLUquadric {
}
}
- private final void glEnd(GL2ES1 gl) {
+ private final void glEnd(GL gl) {
if(immModeSinkEnabled) {
immModeSink.glEnd(gl, immModeSinkImmediate);
} else {
@@ -1131,7 +1131,7 @@ public class GLUquadricImpl implements GLUquadric {
}
}
- private final void glVertex2f(GL2ES1 gl, float x, float y) {
+ private final void glVertex2f(GL gl, float x, float y) {
if(immModeSinkEnabled) {
immModeSink.glVertex2f(x, y);
} else {
@@ -1139,7 +1139,7 @@ public class GLUquadricImpl implements GLUquadric {
}
}
- private final void glVertex3f(GL2ES1 gl, float x, float y, float z) {
+ private final void glVertex3f(GL gl, float x, float y, float z) {
if(immModeSinkEnabled) {
immModeSink.glVertex3f(x, y, z);
} else {
@@ -1147,7 +1147,7 @@ public class GLUquadricImpl implements GLUquadric {
}
}
- private final void glNormal3f(GL2ES1 gl, float x, float y, float z) {
+ private final void glNormal3f(GL gl, float x, float y, float z) {
if(immModeSinkEnabled) {
immModeSink.glNormal3f(x, y, z);
} else {
@@ -1155,7 +1155,7 @@ public class GLUquadricImpl implements GLUquadric {
}
}
- private final void glTexCoord2f(GL2ES1 gl, float x, float y) {
+ private final void glTexCoord2f(GL gl, float x, float y) {
if(immModeSinkEnabled) {
immModeSink.glTexCoord2f(x, y);
} else {
@@ -1170,7 +1170,7 @@ public class GLUquadricImpl implements GLUquadric {
* @param y
* @param z
*/
- private void normal3f(GL2ES1 gl, float x, float y, float z) {
+ private void normal3f(GL gl, float x, float y, float z) {
float mag;
mag = (float)Math.sqrt(x * x + y * y + z * z);
@@ -1186,7 +1186,7 @@ public class GLUquadricImpl implements GLUquadric {
}
}
- private final void TXTR_COORD(GL2ES1 gl, float x, float y) {
+ private final void TXTR_COORD(GL gl, float x, float y) {
if (textureFlag) glTexCoord2f(gl, x,y);
}