glMultMatrix .. quiz: what's wrong

Started by sys0r, March 03, 2005, 23:26:00

Previous topic - Next topic

sys0r

The Code:

float bb[]=new float[]{
   1,0,0,0,
   0,1,0,0,
   0,0,1,0,
   0,0,0,1
   }; // NORMALMATRIX (=

FloatBuffer buffer = ByteBuffer.allocateDirect(16*4).asFloatBuffer();
buffer.put(bb);
buffer.rewind(); //  have i to rewind the buffer ?!?
GL11.glMultMatrix(buffer);
// Draw Something
GL11.glPopMatrix();


i'm not very good in math, but isn't:
MATRIX * NORMALMATRIX = MATRIX ?

why i get none my beautiful polygons on the screen if i use glMultMatrix ? if i remark glMultMatrix it works...

tomb

When creating a direct buffer you need to specify the byte order:
ByteBuffer.allocateDirect(16*4).order(ByteOrder.nativeOrder()).asFloatBuffer();


Also make sure that popMatrix matches a pushMatrix.

sys0r

thank you nativebyteorder is the solution