summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2009-05-20 21:48:09 +0000
committerKenneth Russel <[email protected]>2009-05-20 21:48:09 +0000
commita2891274a4160062cea7a649a321f798216a1587 (patch)
tree89e1a6edf0e08d645175dffcebb7673a7fb05fe7
parentca57e7dd0d9f2502cbc606d177929d36d3501fe1 (diff)
Recently code (UnifiedName, GLUnifiedName) was added to GlueGen to
automatically detect duplicate constant and function definitions between vendor and ARB extensions and the OpenGL core, and to remove the suffixes of ARB extensions. This code has helped automate the process of discovering extensions that were promoted into the OpenGL core. While this code has saved some manual effort, it has also caused several problems: 1. It causes obsolete ARB extensions to be incorrectly moved into the core OpenGL namespace. GL_ARB_texture_rectangle, GL_ARB_vertex_blend, and GL_ARB_matrix_palette are examples of extensions that should not have their ARB suffixes removed because they are dead-end extensions. Definitions which are explicitly specified that they will change, such as those in the EGL_KHR_sync extension, were also incorrectly moved into the core namespace. 2. It has caused certain OpenGL ES-specific definitions to accidentally be promoted into the core OpenGL namespace: for example, the constants associated with the GL_OES_point_size_array extension, which were incorrectly placed into the GL2ES1 interface. 3. It causes namespace collisions between certain ARB extensions that are only accessible via their ARB entry points and core OpenGL routines: specifically GL_ARB_vertex_program and GL_ARB_fragment program. Based on tests on NVIDIA's drivers, when a developer wants to use the earlier ARB_vertex_program and ARB_fragment_program semantics rather than GLSL, it is mandatory to use the ARB entry points rather than the core OpenGL entry points. 4. It is not easy to configure the behavior of this automatic merging, nor easy to see how it would be extended to be configurable. 5. It does not address the problem of detecting which extensions are common between desktop OpenGL and OpenGL ES. A different algorithm would be needed to solve that problem. 6. It has a high degree of functional overlap to the IgnoreExtension directive which has previously been used to ignore ARB extensions that were promoted into the OpenGL core. There were already IgnoreExtension directives in place for all of the OpenGL extensions subsumed in OpenGL 1.1 through 1.3. 7. It has been the cause of several bugs and unexpected interactions with the Ignore and ForceProcAddressGen directives. After careful consideration, it appears that the problems with this code outweigh the benefits and it has been removed. The run-time code which attempts to find extension variants of core entry points has been retained, however. To reduce the amount of subsequent manual work, the following additions have been made: 1. A generic SymbolFilter mechanism has been added to GlueGen, which can be used to pre-process the entire set of constant and function definitions at any time during glue code generation (although it is recommended to do so at the beginning of processing, i.e., in GlueEmitter.beginEmission()). 2. The RenameJavaMethod directive has been generalized to RenameJavaSymbol, and can now work on constant definitions. 3. A ConstantDefinition class has been added. 4. A RenameExtensionIntoCore directive has been added to the GLEmitter which will rename all constant definitions and entry points associated with a particular OpenGL extension into the core namespace, i.e., stripping off any ARB or similar suffixes. 5. An AutoUnifyExtensions directive has been added which is disabled by default but which will automatically ignore any OpenGL extension which has been completely subsumed into the OpenGL core and, if not, print out the first declaration in that extension which caused it to fail to be ignored. The extensions common between OpenGL ES and desktop OpenGL have now largely been moved into the core namespace using the RenameExtensionIntoCore directive. A couple of these extensions had slight differences between desktop OpenGL and OpenGL ES; the common declarations were renamed manually. IgnoreExtension directives have been added for those ARB extensions promoted into the OpenGL core up to OpenGL 2.1. A few extensions which were either silently promoted into the core specification (GL_EXT_paletted_texture) or are obsolete (GL_EXT_multisample, GL_EXT_point_parameters) were also ignored. The GlueGen runtime code which looks up extension versions of core APIs via GLExtensionNames makes this possible without breaking compatibility on older machines that do not support OpenGL 2.1 directly. With these changes, the same effect as the automatic extension unification mechanism has been achieved, with much more explainable and controllable results. Before-and-after versions of all of the public interfaces (GL, GL2ES1, GL2ES2, GLES1, GLES2, and GL2) have been compared by hand to ensure that the results are as expected and desired. Bugs in BuildStaticGLInfo were fixed which were preventing the extension associations in the OpenGL ES headers from being discovered. getExtensions() was added to be able to enumerate the discovered extensions. Most .cfg files were changed to parse both the desktop OpenGL and the OpenGL ES headers using the GLHeaders directive so that the extension associations are known for both sets of APIs. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/jogl-demos/branches/JOGL_2_SANDBOX@334 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4
-rw-r--r--src/demos/proceduralTexturePhysics/Water.java158
-rw-r--r--src/demos/vertexProgRefract/VertexProgRefract.java42
-rw-r--r--src/demos/vertexProgWarp/VertexProgWarp.java36
3 files changed, 118 insertions, 118 deletions
diff --git a/src/demos/proceduralTexturePhysics/Water.java b/src/demos/proceduralTexturePhysics/Water.java
index 12d339c..d2c068f 100644
--- a/src/demos/proceduralTexturePhysics/Water.java
+++ b/src/demos/proceduralTexturePhysics/Water.java
@@ -308,7 +308,7 @@ public class Water {
gl.glEnd();
cubemap.disable();
- gl.glDisable(GL2.GL_FRAGMENT_PROGRAM);
+ gl.glDisable(GL2.GL_FRAGMENT_PROGRAM_ARB);
break;
}
@@ -537,9 +537,9 @@ public class Water {
///////////////////////////////////////////////////////////////////////////
int[] tmpInt = new int[1];
- gl.glGenPrograms(1, tmpInt, 0);
+ gl.glGenProgramsARB(1, tmpInt, 0);
vertexProgramID = tmpInt[0];
- gl.glBindProgram(GL2.GL_VERTEX_PROGRAM, vertexProgramID);
+ gl.glBindProgramARB(GL2.GL_VERTEX_PROGRAM_ARB, vertexProgramID);
String programBuffer =
"!!ARBvp1.0\n" +
@@ -617,9 +617,9 @@ public class Water {
// set up constants (not currently used in the vertex program, though)
float[] rCVConsts = new float[] { 0, 0.5f, 1.0f, 2.0f };
- gl.glProgramEnvParameter4fv(GL2.GL_VERTEX_PROGRAM, CV_CONSTS_1, rCVConsts, 0);
+ gl.glProgramEnvParameter4fvARB(GL2.GL_VERTEX_PROGRAM_ARB, CV_CONSTS_1, rCVConsts, 0);
- loadProgram(gl, GL2.GL_VERTEX_PROGRAM, programBuffer);
+ loadProgram(gl, GL2.GL_VERTEX_PROGRAM_ARB, programBuffer);
///////////////////////////////////////////////////////////////////////////
// fragment program setup for equal weight combination of texels
@@ -762,16 +762,16 @@ public class Water {
gl.glDisable(GL2.GL_BLEND);
// render using offset 1 (type 1 -- center + 3 of 4 nearest neighbors).
- gl.glProgramEnvParameter4f(GL2.GL_VERTEX_PROGRAM, CV_UV_OFFSET_TO_USE, 1, 0, 0, 0);
+ gl.glProgramEnvParameter4fARB(GL2.GL_VERTEX_PROGRAM_ARB, CV_UV_OFFSET_TO_USE, 1, 0, 0, 0);
// bind the vertex program to be used for this step and the next one.
- gl.glBindProgram(GL2.GL_VERTEX_PROGRAM, vertexProgramID);
- gl.glEnable(GL2.GL_VERTEX_PROGRAM);
+ gl.glBindProgramARB(GL2.GL_VERTEX_PROGRAM_ARB, vertexProgramID);
+ gl.glEnable(GL2.GL_VERTEX_PROGRAM_ARB);
// render a screen quad. with texture coords doing difference of nearby texels for force calc.
gl.glCallList(displayListIDs[CA_DRAW_SCREEN_QUAD]);
- gl.glDisable(GL2.GL_FRAGMENT_PROGRAM);
+ gl.glDisable(GL2.GL_FRAGMENT_PROGRAM_ARB);
// Now we need to copy the resulting pixels into the intermediate force field texture
gl.glActiveTexture(GL2.GL_TEXTURE2);
@@ -808,12 +808,12 @@ public class Water {
// vertex program already bound.
// render using offset 2 (type 2 -- final nearest neighbor plus center of previous result).
- gl.glProgramEnvParameter4f(GL2.GL_VERTEX_PROGRAM, CV_UV_OFFSET_TO_USE, 2, 0, 0, 0);
+ gl.glProgramEnvParameter4fARB(GL2.GL_VERTEX_PROGRAM_ARB, CV_UV_OFFSET_TO_USE, 2, 0, 0, 0);
// render a screen quad
gl.glCallList(displayListIDs[CA_DRAW_SCREEN_QUAD]);
- gl.glDisable(GL2.GL_FRAGMENT_PROGRAM);
+ gl.glDisable(GL2.GL_FRAGMENT_PROGRAM_ARB);
// Now we need to copy the resulting pixels into the intermediate force field texture
gl.glActiveTexture(GL2.GL_TEXTURE1);
@@ -829,7 +829,7 @@ public class Water {
gl.glCallList(displayListIDs[CA_FRAGMENT_PROGRAM_APPLY_FORCE]);
// use offsets of zero
- gl.glProgramEnvParameter4f(GL2.GL_VERTEX_PROGRAM, CV_UV_OFFSET_TO_USE, 0, 0, 0, 0);
+ gl.glProgramEnvParameter4fARB(GL2.GL_VERTEX_PROGRAM_ARB, CV_UV_OFFSET_TO_USE, 0, 0, 0, 0);
// bind the vertex program to be used for this step and the next one.
@@ -845,7 +845,7 @@ public class Water {
// Draw the quad to add in force.
gl.glCallList(displayListIDs[CA_DRAW_SCREEN_QUAD]);
- gl.glDisable(GL2.GL_FRAGMENT_PROGRAM);
+ gl.glDisable(GL2.GL_FRAGMENT_PROGRAM_ARB);
///////////////////////////////////////////////////////////////////
// With velocity texture selected, render new excitation droplets
@@ -877,7 +877,7 @@ public class Water {
//////////////////////////////////////////////////////////////////////
// Apply velocity to position
gl.glCallList(displayListIDs[CA_FRAGMENT_PROGRAM_APPLY_VELOCITY]);
- gl.glEnable(GL2.GL_VERTEX_PROGRAM);
+ gl.glEnable(GL2.GL_VERTEX_PROGRAM_ARB);
gl.glActiveTexture(GL2.GL_TEXTURE0);
gl.glBindTexture(GL2.GL_TEXTURE_2D, texHeightInput);
@@ -885,12 +885,12 @@ public class Water {
gl.glEnable(GL2.GL_TEXTURE_2D);
// use offsets of zero
- gl.glProgramEnvParameter4f(GL2.GL_VERTEX_PROGRAM, CV_UV_OFFSET_TO_USE, 0, 0, 0, 0);
+ gl.glProgramEnvParameter4fARB(GL2.GL_VERTEX_PROGRAM_ARB, CV_UV_OFFSET_TO_USE, 0, 0, 0, 0);
// Draw the quad to add in force.
gl.glCallList(displayListIDs[CA_DRAW_SCREEN_QUAD]);
- gl.glDisable(GL2.GL_FRAGMENT_PROGRAM);
+ gl.glDisable(GL2.GL_FRAGMENT_PROGRAM_ARB);
// Now we need to copy the resulting pixels into the input height texture
gl.glActiveTexture(GL2.GL_TEXTURE0);
@@ -911,16 +911,16 @@ public class Water {
}
// use offsets of 3
- gl.glProgramEnvParameter4f(GL2.GL_VERTEX_PROGRAM, CV_UV_OFFSET_TO_USE, 3, 0, 0, 0);
+ gl.glProgramEnvParameter4fARB(GL2.GL_VERTEX_PROGRAM_ARB, CV_UV_OFFSET_TO_USE, 3, 0, 0, 0);
gl.glCallList(displayListIDs[CA_FRAGMENT_PROGRAM_EQ_WEIGHT_COMBINE]);
gl.glCallList(displayListIDs[CA_DRAW_SCREEN_QUAD]);
- gl.glDisable(GL2.GL_FRAGMENT_PROGRAM);
+ gl.glDisable(GL2.GL_FRAGMENT_PROGRAM_ARB);
// Draw the logo in the water.
if (applyInteriorBoundaries) {
- gl.glDisable(GL2.GL_VERTEX_PROGRAM);
+ gl.glDisable(GL2.GL_VERTEX_PROGRAM_ARB);
drawInteriorBoundaryObjects(gl);
}
@@ -965,22 +965,22 @@ public class Water {
// Red mask first
float[] pixMasks = new float[] { normalSTScale, 0.0f, 0.0f, 0.0f };
- gl.glProgramEnvParameter4fv(GL2.GL_FRAGMENT_PROGRAM, 0, pixMasks, 0);
+ gl.glProgramEnvParameter4fvARB(GL2.GL_FRAGMENT_PROGRAM_ARB, 0, pixMasks, 0);
// Now green mask & scale:
pixMasks[0] = 0.0f;
pixMasks[1] = normalSTScale;
- gl.glProgramEnvParameter4fv(GL2.GL_FRAGMENT_PROGRAM, 1, pixMasks, 0);
+ gl.glProgramEnvParameter4fvARB(GL2.GL_FRAGMENT_PROGRAM_ARB, 1, pixMasks, 0);
gl.glCallList(displayListIDs[CA_FRAGMENT_PROGRAM_CREATE_NORMAL_MAP]);
// set vp offsets to nearest neighbors
- gl.glProgramEnvParameter4f(GL2.GL_VERTEX_PROGRAM, CV_UV_OFFSET_TO_USE, 4, 0, 0, 0);
- gl.glEnable(GL2.GL_VERTEX_PROGRAM);
+ gl.glProgramEnvParameter4fARB(GL2.GL_VERTEX_PROGRAM_ARB, CV_UV_OFFSET_TO_USE, 4, 0, 0, 0);
+ gl.glEnable(GL2.GL_VERTEX_PROGRAM_ARB);
gl.glCallList(displayListIDs[CA_DRAW_SCREEN_QUAD]);
- gl.glDisable(GL2.GL_FRAGMENT_PROGRAM);
+ gl.glDisable(GL2.GL_FRAGMENT_PROGRAM_ARB);
// Now we need to copy the resulting pixels into the normal map
gl.glActiveTexture(GL2.GL_TEXTURE0);
@@ -1121,10 +1121,10 @@ public class Water {
float type2Offset[] = { type2OffsetX[i], type2OffsetY[i], 0.0f, 0.0f };
float type4Offset[] = { type4OffsetX[i], type4OffsetY[i], 0.0f, 0.0f };
- gl.glProgramEnvParameter4fv(GL2.GL_VERTEX_PROGRAM, CV_UV_T0_NO_OFFSET + 5 * i, noOffset, 0);
- gl.glProgramEnvParameter4fv(GL2.GL_VERTEX_PROGRAM, CV_UV_T0_TYPE1 + 5 * i, type1Offset, 0);
- gl.glProgramEnvParameter4fv(GL2.GL_VERTEX_PROGRAM, CV_UV_T0_TYPE2 + 5 * i, type2Offset, 0);
- gl.glProgramEnvParameter4fv(GL2.GL_VERTEX_PROGRAM, CV_UV_T0_TYPE4 + 5 * i, type4Offset, 0);
+ gl.glProgramEnvParameter4fvARB(GL2.GL_VERTEX_PROGRAM_ARB, CV_UV_T0_NO_OFFSET + 5 * i, noOffset, 0);
+ gl.glProgramEnvParameter4fvARB(GL2.GL_VERTEX_PROGRAM_ARB, CV_UV_T0_TYPE1 + 5 * i, type1Offset, 0);
+ gl.glProgramEnvParameter4fvARB(GL2.GL_VERTEX_PROGRAM_ARB, CV_UV_T0_TYPE2 + 5 * i, type2Offset, 0);
+ gl.glProgramEnvParameter4fvARB(GL2.GL_VERTEX_PROGRAM_ARB, CV_UV_T0_TYPE4 + 5 * i, type4Offset, 0);
}
}
@@ -1144,13 +1144,13 @@ public class Water {
for (int i = 0; i < 4; ++i) {
offsets[0] = blurDist * ( type3OffsetX[i]);
offsets[1] = blurDist * ( type3OffsetY[i]);
- gl.glProgramEnvParameter4fv(GL2.GL_VERTEX_PROGRAM, CV_UV_T0_TYPE3 + 5 * i, offsets, 0);
+ gl.glProgramEnvParameter4fvARB(GL2.GL_VERTEX_PROGRAM_ARB, CV_UV_T0_TYPE3 + 5 * i, offsets, 0);
}
}
private synchronized void drawDroplets(GL2 gl) {
- gl.glDisable(GL2.GL_FRAGMENT_PROGRAM);
- gl.glDisable(GL2.GL_VERTEX_PROGRAM);
+ gl.glDisable(GL2.GL_FRAGMENT_PROGRAM_ARB);
+ gl.glDisable(GL2.GL_VERTEX_PROGRAM_ARB);
gl.glActiveTexture(GL2.GL_TEXTURE0);
dropletTex.bind();
@@ -1228,9 +1228,9 @@ public class Water {
float[] const0 = new float[] { 0.5f, 0.5f, 0.5f, 1.0f };
int[] tmpInt = new int[1];
- gl.glGenPrograms(1, tmpInt, 0);
+ gl.glGenProgramsARB(1, tmpInt, 0);
int fragProg = tmpInt[0];
- gl.glBindProgram(GL2.GL_FRAGMENT_PROGRAM, fragProg);
+ gl.glBindProgramARB(GL2.GL_FRAGMENT_PROGRAM_ARB, fragProg);
String program =
"!!ARBfp1.0\n" +
@@ -1252,12 +1252,12 @@ public class Water {
"\n" +
"END\n";
- loadProgram(gl, GL2.GL_FRAGMENT_PROGRAM, program);
+ loadProgram(gl, GL2.GL_FRAGMENT_PROGRAM_ARB, program);
gl.glNewList(displayListID, GL2.GL_COMPILE);
- gl.glProgramEnvParameter4fv(GL2.GL_FRAGMENT_PROGRAM, 0, const0, 0);
- gl.glBindProgram(GL2.GL_FRAGMENT_PROGRAM, fragProg);
- gl.glEnable(GL2.GL_FRAGMENT_PROGRAM);
+ gl.glProgramEnvParameter4fvARB(GL2.GL_FRAGMENT_PROGRAM_ARB, 0, const0, 0);
+ gl.glBindProgramARB(GL2.GL_FRAGMENT_PROGRAM_ARB, fragProg);
+ gl.glEnable(GL2.GL_FRAGMENT_PROGRAM_ARB);
gl.glEndList();
}
@@ -1355,9 +1355,9 @@ public class Water {
float[] const0 = new float[] { 0.5f, 0.5f, 0.5f, 1.0f };
int[] tmpInt = new int[1];
- gl.glGenPrograms(1, tmpInt, 0);
+ gl.glGenProgramsARB(1, tmpInt, 0);
int fragProg = tmpInt[0];
- gl.glBindProgram(GL2.GL_FRAGMENT_PROGRAM, fragProg);
+ gl.glBindProgramARB(GL2.GL_FRAGMENT_PROGRAM_ARB, fragProg);
String program =
"!!ARBfp1.0\n" +
@@ -1396,12 +1396,12 @@ public class Water {
"\n" +
"END\n";
- loadProgram(gl, GL2.GL_FRAGMENT_PROGRAM, program);
+ loadProgram(gl, GL2.GL_FRAGMENT_PROGRAM_ARB, program);
gl.glNewList(displayListID, GL2.GL_COMPILE);
- gl.glProgramEnvParameter4fv(GL2.GL_FRAGMENT_PROGRAM, 0, const0, 0);
- gl.glBindProgram(GL2.GL_FRAGMENT_PROGRAM, fragProg);
- gl.glEnable(GL2.GL_FRAGMENT_PROGRAM);
+ gl.glProgramEnvParameter4fvARB(GL2.GL_FRAGMENT_PROGRAM_ARB, 0, const0, 0);
+ gl.glBindProgramARB(GL2.GL_FRAGMENT_PROGRAM_ARB, fragProg);
+ gl.glEnable(GL2.GL_FRAGMENT_PROGRAM_ARB);
gl.glEndList();
}
@@ -1442,9 +1442,9 @@ public class Water {
// }
int[] tmpInt = new int[1];
- gl.glGenPrograms(1, tmpInt, 0);
+ gl.glGenProgramsARB(1, tmpInt, 0);
int fragProg = tmpInt[0];
- gl.glBindProgram(GL2.GL_FRAGMENT_PROGRAM, fragProg);
+ gl.glBindProgramARB(GL2.GL_FRAGMENT_PROGRAM_ARB, fragProg);
String program =
"!!ARBfp1.0\n" +
@@ -1460,11 +1460,11 @@ public class Water {
"\n" +
"END\n";
- loadProgram(gl, GL2.GL_FRAGMENT_PROGRAM, program);
+ loadProgram(gl, GL2.GL_FRAGMENT_PROGRAM_ARB, program);
gl.glNewList(displayListID, GL2.GL_COMPILE);
- gl.glBindProgram(GL2.GL_FRAGMENT_PROGRAM, fragProg);
- gl.glEnable(GL2.GL_FRAGMENT_PROGRAM);
+ gl.glBindProgramARB(GL2.GL_FRAGMENT_PROGRAM_ARB, fragProg);
+ gl.glEnable(GL2.GL_FRAGMENT_PROGRAM_ARB);
gl.glEndList();
}
@@ -1514,9 +1514,9 @@ public class Water {
float[] const1 = new float[] { 0.5f, 0.5f, 0.5f, 1.0f };
int[] tmpInt = new int[1];
- gl.glGenPrograms(1, tmpInt, 0);
+ gl.glGenProgramsARB(1, tmpInt, 0);
int fragProg = tmpInt[0];
- gl.glBindProgram(GL2.GL_FRAGMENT_PROGRAM, fragProg);
+ gl.glBindProgramARB(GL2.GL_FRAGMENT_PROGRAM_ARB, fragProg);
String program =
"!!ARBfp1.0\n" +
@@ -1537,13 +1537,13 @@ public class Water {
"\n" +
"END\n";
- loadProgram(gl, GL2.GL_FRAGMENT_PROGRAM, program);
+ loadProgram(gl, GL2.GL_FRAGMENT_PROGRAM_ARB, program);
gl.glNewList(displayListID, GL2.GL_COMPILE);
- gl.glProgramEnvParameter4fv(GL2.GL_FRAGMENT_PROGRAM, 0, const0, 0);
- gl.glProgramEnvParameter4fv(GL2.GL_FRAGMENT_PROGRAM, 1, const1, 0);
- gl.glBindProgram(GL2.GL_FRAGMENT_PROGRAM, fragProg);
- gl.glEnable(GL2.GL_FRAGMENT_PROGRAM);
+ gl.glProgramEnvParameter4fvARB(GL2.GL_FRAGMENT_PROGRAM_ARB, 0, const0, 0);
+ gl.glProgramEnvParameter4fvARB(GL2.GL_FRAGMENT_PROGRAM_ARB, 1, const1, 0);
+ gl.glBindProgramARB(GL2.GL_FRAGMENT_PROGRAM_ARB, fragProg);
+ gl.glEnable(GL2.GL_FRAGMENT_PROGRAM_ARB);
gl.glEndList();
}
@@ -1593,9 +1593,9 @@ public class Water {
float[] const0 = new float[] { 0.5f, 0.5f, 0.5f, 1.0f };
int[] tmpInt = new int[1];
- gl.glGenPrograms(1, tmpInt, 0);
+ gl.glGenProgramsARB(1, tmpInt, 0);
int fragProg = tmpInt[0];
- gl.glBindProgram(GL2.GL_FRAGMENT_PROGRAM, fragProg);
+ gl.glBindProgramARB(GL2.GL_FRAGMENT_PROGRAM_ARB, fragProg);
String program =
"!!ARBfp1.0\n" +
@@ -1615,12 +1615,12 @@ public class Water {
"\n" +
"END\n";
- loadProgram(gl, GL2.GL_FRAGMENT_PROGRAM, program);
+ loadProgram(gl, GL2.GL_FRAGMENT_PROGRAM_ARB, program);
gl.glNewList(displayListID, GL2.GL_COMPILE);
- gl.glProgramEnvParameter4fv(GL2.GL_FRAGMENT_PROGRAM, 0, const0, 0);
- gl.glBindProgram(GL2.GL_FRAGMENT_PROGRAM, fragProg);
- gl.glEnable(GL2.GL_FRAGMENT_PROGRAM);
+ gl.glProgramEnvParameter4fvARB(GL2.GL_FRAGMENT_PROGRAM_ARB, 0, const0, 0);
+ gl.glBindProgramARB(GL2.GL_FRAGMENT_PROGRAM_ARB, fragProg);
+ gl.glEnable(GL2.GL_FRAGMENT_PROGRAM_ARB);
gl.glEndList();
}
@@ -1710,9 +1710,9 @@ public class Water {
float[] const0 = new float[] { 0.5f, 0.5f, 0.5f, 1.0f };
int[] tmpInt = new int[1];
- gl.glGenPrograms(1, tmpInt, 0);
+ gl.glGenProgramsARB(1, tmpInt, 0);
int fragProg = tmpInt[0];
- gl.glBindProgram(GL2.GL_FRAGMENT_PROGRAM, fragProg);
+ gl.glBindProgramARB(GL2.GL_FRAGMENT_PROGRAM_ARB, fragProg);
String program =
"!!ARBfp1.0\n" +
@@ -1746,11 +1746,11 @@ public class Water {
"\n" +
"END\n";
- loadProgram(gl, GL2.GL_FRAGMENT_PROGRAM, program);
+ loadProgram(gl, GL2.GL_FRAGMENT_PROGRAM_ARB, program);
gl.glNewList(displayListID, GL2.GL_COMPILE);
- gl.glBindProgram(GL2.GL_FRAGMENT_PROGRAM, fragProg);
- gl.glEnable(GL2.GL_FRAGMENT_PROGRAM);
+ gl.glBindProgramARB(GL2.GL_FRAGMENT_PROGRAM_ARB, fragProg);
+ gl.glEnable(GL2.GL_FRAGMENT_PROGRAM_ARB);
gl.glEndList();
}
@@ -1785,9 +1785,9 @@ public class Water {
// of a visual difference so they are skipped as well.
int[] tmpInt = new int[1];
- gl.glGenPrograms(1, tmpInt, 0);
+ gl.glGenProgramsARB(1, tmpInt, 0);
int fragProg = tmpInt[0];
- gl.glBindProgram(GL2.GL_FRAGMENT_PROGRAM, fragProg);
+ gl.glBindProgramARB(GL2.GL_FRAGMENT_PROGRAM_ARB, fragProg);
String program =
"!!ARBfp1.0\n" +
@@ -1809,11 +1809,11 @@ public class Water {
"\n" +
"END";
- loadProgram(gl, GL2.GL_FRAGMENT_PROGRAM, program);
+ loadProgram(gl, GL2.GL_FRAGMENT_PROGRAM_ARB, program);
gl.glNewList(displayListID, GL2.GL_COMPILE);
- gl.glBindProgram(GL2.GL_FRAGMENT_PROGRAM, fragProg);
- gl.glEnable(GL2.GL_FRAGMENT_PROGRAM);
+ gl.glBindProgramARB(GL2.GL_FRAGMENT_PROGRAM_ARB, fragProg);
+ gl.glEnable(GL2.GL_FRAGMENT_PROGRAM_ARB);
gl.glEndList();
}
@@ -1821,19 +1821,19 @@ public class Water {
int target,
String programBuffer) {
- gl.glProgramString(target, GL2.GL_PROGRAM_FORMAT_ASCII, programBuffer.length(), programBuffer);
+ gl.glProgramStringARB(target, GL2.GL_PROGRAM_FORMAT_ASCII_ARB, programBuffer.length(), programBuffer);
int[] errPos = new int[1];
- gl.glGetIntegerv(GL2.GL_PROGRAM_ERROR_POSITION, errPos, 0);
+ gl.glGetIntegerv(GL2.GL_PROGRAM_ERROR_POSITION_ARB, errPos, 0);
if (errPos[0] >= 0) {
String kind = "Program";
- if (target == GL2.GL_VERTEX_PROGRAM) {
+ if (target == GL2.GL_VERTEX_PROGRAM_ARB) {
kind = "Vertex program";
- } else if (target == GL2.GL_FRAGMENT_PROGRAM) {
+ } else if (target == GL2.GL_FRAGMENT_PROGRAM_ARB) {
kind = "Fragment program";
}
System.out.println(kind + " failed to load:");
- String errMsg = gl.glGetString(GL2.GL_PROGRAM_ERROR_STRING);
+ String errMsg = gl.glGetString(GL2.GL_PROGRAM_ERROR_STRING_ARB);
if (errMsg == null) {
System.out.println("[No error message available]");
} else {
@@ -1847,10 +1847,10 @@ public class Water {
System.out.println(programBuffer.substring(errPos[0], endPos));
throw new GLException("Error loading " + kind);
} else {
- if (target == GL2.GL_FRAGMENT_PROGRAM) {
+ if (target == GL2.GL_FRAGMENT_PROGRAM_ARB) {
int[] isNative = new int[1];
- gl.glGetProgramiv(GL2.GL_FRAGMENT_PROGRAM,
- GL2.GL_PROGRAM_UNDER_NATIVE_LIMITS,
+ gl.glGetProgramivARB(GL2.GL_FRAGMENT_PROGRAM_ARB,
+ GL2.GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB,
isNative, 0);
if (isNative[0] != 1) {
System.out.println("WARNING: fragment program is over native resource limits");
diff --git a/src/demos/vertexProgRefract/VertexProgRefract.java b/src/demos/vertexProgRefract/VertexProgRefract.java
index 16ecaa5..edbef87 100644
--- a/src/demos/vertexProgRefract/VertexProgRefract.java
+++ b/src/demos/vertexProgRefract/VertexProgRefract.java
@@ -281,18 +281,18 @@ public class VertexProgRefract extends Demo {
b[' '] = true; // animate by default
int[] vtxProgTmp = new int[1];
- gl.glGenPrograms(1, vtxProgTmp, 0);
+ gl.glGenProgramsARB(1, vtxProgTmp, 0);
vtxProg = vtxProgTmp[0];
- gl.glBindProgram(GL2.GL_VERTEX_PROGRAM, vtxProg);
- gl.glProgramString(GL2.GL_VERTEX_PROGRAM, GL2.GL_PROGRAM_FORMAT_ASCII, transformRefract.length(),
- transformRefract);
+ gl.glBindProgramARB(GL2.GL_VERTEX_PROGRAM_ARB, vtxProg);
+ gl.glProgramStringARB(GL2.GL_VERTEX_PROGRAM_ARB, GL2.GL_PROGRAM_FORMAT_ASCII_ARB, transformRefract.length(),
+ transformRefract);
- gl.glProgramEnvParameter4f(GL2.GL_VERTEX_PROGRAM, 0, 0.0f, 0.0f, 0.0f, 1.0f); // eye position
+ gl.glProgramEnvParameter4fARB(GL2.GL_VERTEX_PROGRAM_ARB, 0, 0.0f, 0.0f, 0.0f, 1.0f); // eye position
- gl.glProgramEnvParameter4f(GL2.GL_VERTEX_PROGRAM, 1, fresnel, fresnel, fresnel, 1.0f); // fresnel multiplier
+ gl.glProgramEnvParameter4fARB(GL2.GL_VERTEX_PROGRAM_ARB, 1, fresnel, fresnel, fresnel, 1.0f); // fresnel multiplier
- gl.glProgramEnvParameter4f(GL2.GL_VERTEX_PROGRAM, 2, 1.0f, -1.0f, 1.0f, 0.0f); // texture scale
- gl.glProgramEnvParameter4f(GL2.GL_VERTEX_PROGRAM, 3, 0.0f, 1.0f, 2.0f, 3.0f); // misc constants
+ gl.glProgramEnvParameter4fARB(GL2.GL_VERTEX_PROGRAM_ARB, 2, 1.0f, -1.0f, 1.0f, 0.0f); // texture scale
+ gl.glProgramEnvParameter4fARB(GL2.GL_VERTEX_PROGRAM_ARB, 3, 0.0f, 1.0f, 2.0f, 3.0f); // misc constants
try {
cubemap = Cubemap.loadFromStreams(getClass().getClassLoader(),
@@ -391,10 +391,10 @@ public class VertexProgRefract extends Demo {
ManipManager.getManipManager().updateCameraParameters((AWTGLAutoDrawable) drawable, viewer.getCameraParameters());
ManipManager.getManipManager().render((AWTGLAutoDrawable) drawable, gl);
- gl.glBindProgram(GL2.GL_VERTEX_PROGRAM, vtxProg);
+ gl.glBindProgramARB(GL2.GL_VERTEX_PROGRAM_ARB, vtxProg);
- gl.glEnable(GL2.GL_VERTEX_PROGRAM);
- gl.glProgramEnvParameter4f(GL2.GL_VERTEX_PROGRAM, 62, fresnel, fresnel, fresnel, 1.0f);
+ gl.glEnable(GL2.GL_VERTEX_PROGRAM_ARB);
+ gl.glProgramEnvParameter4fARB(GL2.GL_VERTEX_PROGRAM_ARB, 62, fresnel, fresnel, fresnel, 1.0f);
// set texture transforms
gl.glActiveTexture(GL.GL_TEXTURE0);
@@ -414,8 +414,8 @@ public class VertexProgRefract extends Demo {
// if (useRegisterCombiners) {
// gl.glEnable(GL2.GL_REGISTER_COMBINERS_NV);
// } else {
- gl.glBindProgram(GL2.GL_FRAGMENT_PROGRAM, fragProg);
- gl.glEnable(GL2.GL_FRAGMENT_PROGRAM);
+ gl.glBindProgramARB(GL2.GL_FRAGMENT_PROGRAM_ARB, fragProg);
+ gl.glEnable(GL2.GL_FRAGMENT_PROGRAM_ARB);
// }
gl.glColor3f(1.0f, 1.0f, 1.0f);
@@ -452,9 +452,9 @@ public class VertexProgRefract extends Demo {
// if (useRegisterCombiners) {
// gl.glDisable(GL2.GL_REGISTER_COMBINERS_NV);
// } else {
- gl.glDisable(GL2.GL_FRAGMENT_PROGRAM);
+ gl.glDisable(GL2.GL_FRAGMENT_PROGRAM_ARB);
// }
- gl.glDisable(GL2.GL_VERTEX_PROGRAM);
+ gl.glDisable(GL2.GL_VERTEX_PROGRAM_ARB);
gl.glMatrixMode(GL2ES1.GL_MODELVIEW);
gl.glPopMatrix();
@@ -564,7 +564,7 @@ public class VertexProgRefract extends Demo {
private void initFragmentProgram(GL2 gl) {
int[] fragProgTmp = new int[1];
- gl.glGenPrograms(1, fragProgTmp, 0);
+ gl.glGenProgramsARB(1, fragProgTmp, 0);
fragProg = fragProgTmp[0];
String combineFragProg =
"!!ARBfp1.0\n" +
@@ -581,14 +581,14 @@ public class VertexProgRefract extends Demo {
"MOV result.color, texSamp0;\n" +
"END";
- gl.glBindProgram(GL2.GL_FRAGMENT_PROGRAM, fragProg);
- gl.glProgramString(GL2.GL_FRAGMENT_PROGRAM, GL2.GL_PROGRAM_FORMAT_ASCII,
+ gl.glBindProgramARB(GL2.GL_FRAGMENT_PROGRAM_ARB, fragProg);
+ gl.glProgramStringARB(GL2.GL_FRAGMENT_PROGRAM_ARB, GL2.GL_PROGRAM_FORMAT_ASCII_ARB,
combineFragProg.length(), combineFragProg);
int[] errPos = new int[1];
- gl.glGetIntegerv(GL2.GL_PROGRAM_ERROR_POSITION, errPos, 0);
+ gl.glGetIntegerv(GL2.GL_PROGRAM_ERROR_POSITION_ARB, errPos, 0);
if (errPos[0] >= 0) {
System.out.println("Fragment program failed to load:");
- String errMsg = gl.glGetString(GL2.GL_PROGRAM_ERROR_STRING);
+ String errMsg = gl.glGetString(GL2.GL_PROGRAM_ERROR_STRING_ARB);
if (errMsg == null) {
System.out.println("[No error message available]");
} else {
@@ -669,7 +669,7 @@ public class VertexProgRefract extends Demo {
}
private void setRefraction(GL2 gl, float index) {
- gl.glProgramEnvParameter4f(GL2.GL_VERTEX_PROGRAM, 4, index, index*index, 0.0f, 0.0f);
+ gl.glProgramEnvParameter4fARB(GL2.GL_VERTEX_PROGRAM_ARB, 4, index, index*index, 0.0f, 0.0f);
}
// draw square subdivided into quad strips
diff --git a/src/demos/vertexProgWarp/VertexProgWarp.java b/src/demos/vertexProgWarp/VertexProgWarp.java
index 0cb707f..e6dbca7 100644
--- a/src/demos/vertexProgWarp/VertexProgWarp.java
+++ b/src/demos/vertexProgWarp/VertexProgWarp.java
@@ -193,32 +193,32 @@ public class VertexProgWarp extends Demo {
for(int i=0; i<NUM_PROGS; i++) {
int[] vtxProgTmp = new int[1];
- gl.glGenPrograms(1, vtxProgTmp, 0);
+ gl.glGenProgramsARB(1, vtxProgTmp, 0);
programs[i] = vtxProgTmp[0];
- gl.glBindProgram(GL2.GL_VERTEX_PROGRAM, programs[i]);
- gl.glProgramString(GL2.GL_VERTEX_PROGRAM, GL2.GL_PROGRAM_FORMAT_ASCII, programTexts[i].length(),
+ gl.glBindProgramARB(GL2.GL_VERTEX_PROGRAM_ARB, programs[i]);
+ gl.glProgramStringARB(GL2.GL_VERTEX_PROGRAM_ARB, GL2.GL_PROGRAM_FORMAT_ASCII_ARB, programTexts[i].length(),
programTexts[i]);
}
- gl.glProgramEnvParameter4f(GL2.GL_VERTEX_PROGRAM, 0, 0.0f, 0.0f, 1.0f, 0.0f); // light position/direction
- gl.glProgramEnvParameter4f(GL2.GL_VERTEX_PROGRAM, 1, 0.0f, 1.0f, 0.0f, 0.0f); // diffuse color
- gl.glProgramEnvParameter4f(GL2.GL_VERTEX_PROGRAM, 2, 1.0f, 1.0f, 1.0f, 0.0f); // specular color
+ gl.glProgramEnvParameter4fARB(GL2.GL_VERTEX_PROGRAM_ARB, 0, 0.0f, 0.0f, 1.0f, 0.0f); // light position/direction
+ gl.glProgramEnvParameter4fARB(GL2.GL_VERTEX_PROGRAM_ARB, 1, 0.0f, 1.0f, 0.0f, 0.0f); // diffuse color
+ gl.glProgramEnvParameter4fARB(GL2.GL_VERTEX_PROGRAM_ARB, 2, 1.0f, 1.0f, 1.0f, 0.0f); // specular color
- gl.glProgramEnvParameter4f(GL2.GL_VERTEX_PROGRAM, 3, 0.0f, 1.0f, 2.0f, 3.0f); // smoothstep constants
+ gl.glProgramEnvParameter4fARB(GL2.GL_VERTEX_PROGRAM_ARB, 3, 0.0f, 1.0f, 2.0f, 3.0f); // smoothstep constants
// sin Taylor series constants - 1, 1/3!, 1/5!, 1/7!
- gl.glProgramEnvParameter4f(GL2.GL_VERTEX_PROGRAM, 4, 1.0f, 1.0f / (3*2), 1.0f / (5*4*3*2), 1.0f / (7*6*5*4*3*2));
+ gl.glProgramEnvParameter4fARB(GL2.GL_VERTEX_PROGRAM_ARB, 4, 1.0f, 1.0f / (3*2), 1.0f / (5*4*3*2), 1.0f / (7*6*5*4*3*2));
- gl.glProgramEnvParameter4f(GL2.GL_VERTEX_PROGRAM, 5, 1.0f / (2.0f * SIN_PERIOD), 2.0f * SIN_PERIOD, SIN_PERIOD, SIN_PERIOD/2.0f);
+ gl.glProgramEnvParameter4fARB(GL2.GL_VERTEX_PROGRAM_ARB, 5, 1.0f / (2.0f * SIN_PERIOD), 2.0f * SIN_PERIOD, SIN_PERIOD, SIN_PERIOD/2.0f);
// sin wave frequency, amplitude
- gl.glProgramEnvParameter4f(GL2.GL_VERTEX_PROGRAM, 6, 1.0f, 0.2f, 0.0f, 0.0f);
+ gl.glProgramEnvParameter4fARB(GL2.GL_VERTEX_PROGRAM_ARB, 6, 1.0f, 0.2f, 0.0f, 0.0f);
// phase animation
- gl.glProgramEnvParameter4f(GL2.GL_VERTEX_PROGRAM, 7, 0.0f, 0.0f, 0.0f, 0.0f);
+ gl.glProgramEnvParameter4fARB(GL2.GL_VERTEX_PROGRAM_ARB, 7, 0.0f, 0.0f, 0.0f, 0.0f);
// fisheye sphere radius
- gl.glProgramEnvParameter4f(GL2.GL_VERTEX_PROGRAM, 8, 1.0f, 0.0f, 0.0f, 0.0f);
+ gl.glProgramEnvParameter4fARB(GL2.GL_VERTEX_PROGRAM_ARB, 8, 1.0f, 0.0f, 0.0f, 0.0f);
setWindowTitle();
@@ -296,21 +296,21 @@ public class VertexProgWarp extends Demo {
ManipManager.getManipManager().updateCameraParameters((AWTGLAutoDrawable) drawable, viewer.getCameraParameters());
ManipManager.getManipManager().render((AWTGLAutoDrawable) drawable, gl);
- gl.glBindProgram(GL2.GL_VERTEX_PROGRAM, programs[program]);
- gl.glProgramEnvParameter4f(GL2.GL_VERTEX_PROGRAM, 7, anim, 0.0f, 0.0f, 0.0f);
+ gl.glBindProgramARB(GL2.GL_VERTEX_PROGRAM_ARB, programs[program]);
+ gl.glProgramEnvParameter4fARB(GL2.GL_VERTEX_PROGRAM_ARB, 7, anim, 0.0f, 0.0f, 0.0f);
if (program==6)
- gl.glProgramEnvParameter4f(GL2.GL_VERTEX_PROGRAM, 6, (float) Math.sin(anim)*amp*50.0f, 0.0f, 0.0f, 0.0f);
+ gl.glProgramEnvParameter4fARB(GL2.GL_VERTEX_PROGRAM_ARB, 6, (float) Math.sin(anim)*amp*50.0f, 0.0f, 0.0f, 0.0f);
else
- gl.glProgramEnvParameter4f(GL2.GL_VERTEX_PROGRAM, 6, freq, amp, d, d+1);
+ gl.glProgramEnvParameter4fARB(GL2.GL_VERTEX_PROGRAM_ARB, 6, freq, amp, d, d+1);
if (b['p'])
- gl.glEnable(GL2.GL_VERTEX_PROGRAM);
+ gl.glEnable(GL2.GL_VERTEX_PROGRAM_ARB);
gl.glDisable(GL.GL_TEXTURE_2D);
gl.glCallList(obj+1);
- gl.glDisable(GL2.GL_VERTEX_PROGRAM);
+ gl.glDisable(GL2.GL_VERTEX_PROGRAM_ARB);
gl.glPopMatrix();
}