Problems with glLoadMatrixf(FloatBuffer)

Started by Schmelly, September 12, 2003, 16:16:54

Previous topic - Next topic

Schmelly

greetings,

i have problems loading a matrix into OpenGL using glLoadMatrixf from org.lwjgl.opengl.coregl11. an native error occure in nvoglnt.dll

i tried it as follows:

.
.
.
FloatBuffer buffer = FloatBuffer.wrap(
    new float[]
    {
        1.0f, 0.0f, 0.0f, 0.0f,
        0.0f, 1.0f, 0.0f, 0.0f,
        0.0f, 0.0f, 1.0f, 0.0f,
        0.0f, 0.0f, 0.0f, 1.0f,
    });

GL.glLoadMatrixf(buffer);
.
.
.


im using lwjgl 0.7 and the java sdk 1.4.2 under win32

does anyone have an idea?


thx, Schmelly

cfmdobbie

I expect you need to use a direct buffer.  Try this:

FloatBuffer buffer = ByteBuffer.allocateDirect(4 * 4 * 4).order(ByteOrder.nativeOrder()).asFloatBuffer() ;
buffer.put(new float[]
    { 
        1.0f, 0.0f, 0.0f, 0.0f, 
        0.0f, 1.0f, 0.0f, 0.0f, 
        0.0f, 0.0f, 1.0f, 0.0f, 
        0.0f, 0.0f, 0.0f, 1.0f, 
    }) ;
buffer..flip() ;
GL.glLoadMatrixf(buffer);
ellomynameis Charlie Dobbie.

Schmelly