i am tring to add a light. but when i try to modify the position netbeans highlights the gl.glLightfv method. its not just with the position its with diffuse and ambient too… what i am do wrong… here is my code.
all the hits say that:
no suitable method found for glLightfv(int,int,float[])
method javax.media.opengl.GL.glLightfv(int,int,float[],int) is not applicable
(actual and formal argument lists differ in length)
method javax.media.opengl.GL.glLightfv(int,int,java.nio.FloatBuffer) is not applicable
(actual argument float[] cannot be converted to java.nio.FloatBuffer by method invocation conversion)
float pos[] = {-2.0f, 2.0f, -3.0f, 1.0f };
gl.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, pos); //underlinded red:
float dif[] = {1.0f,1.0f,1.0f,1.0f};
gl.glLightfv(GL.GL_LIGHT0, GL.GL_DIFFUSE, dif); //underlinded red:
float amb[] = {0.2f,0.2f, 0.2f, 1.0f};
gl.glLightfv(GL.GL_LIGHT0, GL.GL_AMBIENT, amb); //underlinded red:
If you want to use
float arrayinstead ofFloatBufferclass, you’ll have to add one more parameter, which says where (in the array) should OpenGL start look for your parameters -> array index offset value..In your case