Hey everyone, i am trying to use multitexture in JOGL and keep getting a compilation error. For some reason the program doesnt not understand what GL.GL_MAX_TEXTURE_UNITS_ARB and what GL.GL_TEXTURE0_ARB are. I have had no other issues with my program except these. I have the following imports and my code is also below. I really appreciate the help and what to thank everyone in advance.
import javax.media.opengl.GL;
import javax.vecmath.Point3f;
public void draw (GL gl)
{
gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT);
for(int i = 0; i < getNumFaces(); i++)
{
LevelFace face = getLevelFace(i);
if(face.getType() != 1)
continue;
gl.glActiveTextureARB(GL.GL_TEXTURE0_ARB);
gl.glEnable(gl.GL_TEXTURE_2D);
gl.glBindTexture(gl.GL_TEXTURE_2D, m_textures[pFace->texID].ID);
gl.glPolygonMode(gl.GL_FRONT_AND_BACK, gl.GL_LINE);
gl.glBegin(gl.GL_TRIANGLE_FAN);
for(int j = face.getStartVertexIndex(); j < face.getStartVertexIndex() + face.getTotalVertices(); j++)
{
Point3f vertex = getVertex(j);
gl.glVertex3f(vertex.x, vertex.y, vertex.z);
}// for
gl.glEnd();
gl.glPolygonMode(gl.GL_FRONT_AND_BACK, gl.GL_FILL);
}// for
}// draw
The other file
import java.awt.*;
import java.awt.event.*;
import javax.media.opengl.*;
import javax.media.opengl.glu.GLU;
import Level.*;
import LevelLoader.LevelLoader;
import com.sun.opengl.util.*;
public static void main(String[] args) {
Frame frame = new Frame("Counter Strike");
GLCanvas canvas = new GLCanvas();
canvas.addGLEventListener(new WarthogStrike());
frame.add(canvas);
frame.setSize(800, 600);
// Creates a thread that calls the display function for that drawable object
final Animator animator = new Animator(canvas);
...
}
public void init(GLAutoDrawable drawable) {
// Use debug pipeline
// drawable.setGL(new DebugGL(drawable.getGL()));
fpsDisplay = new DisplayFPS (drawable);
GL gl = drawable.getGL();
String extensions = gl.glGetString(GL.GL_EXTENSIONS);
boolean bMultiTexturing = (extensions.indexOf("GL_ARB_multitexture") !=-1);
if (!bMultiTexturing)
System.err.println("MultiTexturing Disabled");
int[] maxTextureUnits = new int[1];
gl.glGetIntegerv(gl.GL_MAX_TEXTURE_UNITS_ARB, maxTextureUnits);
int nbTextureUnits = maxTextureUnits[0];
System.out.println("Texture Units available = " + nbTextureUnits);
System.err.println("INIT GL IS: " + gl.getClass().getName());
System.err.println("Chosen GLCapabilities: " + drawable.getChosenGLCapabilities());
gl.setSwapInterval(1);
gl.glEnable(GL.GL_DEPTH_TEST);
drawable.addMouseListener(mouseEvents);
drawable.addMouseMotionListener(mouseEvents);
drawable.addKeyListener(keyEvents);
LevelLoader loader = new LevelLoader();
loader.loadLevel("src/LevelFiles/level2.bsp");
currentLevel = loader.getLevel();
camera = new Camera();
camera.setCamera(0, 800, -150, 0, 150, -149, 0, 1, 0);
}