Hello Guest

glMultMatrix .. quiz: what's wrong

  • 2 Replies
  • 5627 Views
*

sys0r

glMultMatrix .. quiz: what's wrong
« on: March 03, 2005, 23:26:00 »
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...

*

Offline tomb

  • ***
  • 148
glMultMatrix .. quiz: what's wrong
« Reply #1 on: March 04, 2005, 01:26:59 »
When creating a direct buffer you need to specify the byte order:
Code: [Select]
ByteBuffer.allocateDirect(16*4).order(ByteOrder.nativeOrder()).asFloatBuffer();

Also make sure that popMatrix matches a pushMatrix.

*

sys0r

glMultMatrix .. quiz: what's wrong
« Reply #2 on: March 04, 2005, 10:29:04 »
thank you nativebyteorder is the solution