Hi,
I'm trying to set up a shader in jogl but with little success.
What I'm stuck at is the function glShaderSource, which Java can't find.
This is the code I'm using to set it up. Stole it from another website ^^
gl.glShadeModel(GL.GL_SMOOTH);
gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
gl.glClearDepth(1.0f);
gl.glEnable(GL.GL_DEPTH_TEST);
gl.glDepthFunc(GL.GL_LEQUAL);
gl.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST);
gLDrawable.addKeyListener(this);
int v = gl.glCreateShader(GL.GL_VERTEX_SHADER);
int f = gl.glCreateShader(GL.GL_FRAGMENT_SHADER);
BufferedReader brv = new BufferedReader(new FileReader("./shader/vertex.shader"));
String vsrc = "";
String line;
while ((line=brv.readLine()) != null) {
vsrc += line + "\n";
}
gl.glShaderSource(v, 1, vsrc, (int[])null);
gl.glCompileShader(v);
BufferedReader brf = new BufferedReader(new FileReader("./shader/fragment.shader"));
String fsrc = "";
while ((line=brf.readLine()) != null) {
fsrc += line + "\n";
}
gl.glShaderSource(f, 1, fsrc, (int[])null);
gl.glCompileShader(f);
int shaderprogram = gl.glCreateProgram();
gl.glAttachShader(shaderprogram, v);
gl.glAttachShader(shaderprogram, f);
gl.glLinkProgram(shaderprogram);
gl.glValidateProgram(shaderprogram);
gl.glUseProgram(shaderprogram);
So it finds everything else but the glShaderSource.
I looked at the examples @ jogl homepage but I think they�re using a different method or something.
Would be greatful for any help/tips!
[EDIT] The function I've seen being used is glShaderSourceARB. But I have a graphiccard that supports OpenGL 2.0 so I should not use them right?
/Yooni
Message was edited by:
Yooni