将float []作为FloatBuffer类

时间:2013-09-20 13:40:18

标签: java opengl jogl floatbuffer

拥有float[]并且我想将其作为glLoadMatrixf(FloatBuffer m)的参数(GLMatrixFunc的接口)。

我怎样才能将float[]作为FloatBuffer

代码是 -

float[] currentMatrix = {.....} ;
gl.glLoadMatrixd(currentMatrix ); 

以上提示 - The method glLoadMatrixf(FloatBuffer) in the type GL is not applicable for the arguments (float[])

1 个答案:

答案 0 :(得分:3)

float[] floatArray = ...;
FloatBuffer floatBuffer = FloatBuffer.wrap(floatArray);
相关问题