Bug 218

Summary: glGetFloatv() doesn't populate matrix return types
Product: [JogAmp] Jogl Reporter: Sven Gothel <sgothel>
Component: coreAssignee: Sven Gothel <sgothel>
Status: VERIFIED INVALID    
Severity: normal    
Priority: P3    
Version: 1   
Hardware: All   
OS: all   
Type: DEFECT SCM Refs:
Workaround: ---
Attachments: Working test case

Description Sven Gothel 2010-03-24 07:48:45 CET


---- Reported by luke_hutch 2006-04-26 14:21:13 ----

Calling glGetFloatv() with a matrix parameter like GL.GL_MODELVIEW should
populate the matrix parameter on exit.  It doesn't appear to do this.

For example, given the following code:

  gl.glMatrixMode(GL.GL_MODELVIEW);
  gl.glLoadIdentity();

  float[] f = new float[16];
  gl.glGetFloatv(GL.GL_MODELVIEW, f, 0);
  System.out.println("MV");
  for (int i = 0; i < 16; i++) {
    System.out.print(" " + f[i]);
    if (i % 4 == 3)
      System.out.println();
  }

  gl.glMatrixMode(GL.GL_PROJECTION);
  gl.glLoadIdentity();

  ByteBuffer buf = ByteBuffer.allocateDirect(16*4);
  buf.order(ByteOrder.nativeOrder());
  FloatBuffer fbuf = buf.asFloatBuffer();
  gl.glGetFloatv(GL.GL_PROJECTION, fbuf);  
  System.out.println("Proj");
  for (int i = 0; i < 16; i++) {
    System.out.print(" " + fbuf.get(i));
    if (i % 4 == 3)
      System.out.println();
  }

The output is:

MV
 2.0232286E-33 -8.61196E-8 -8.60764E-8 3.9E-44
 -1.0438452 4.3789212E-34 0.0 0.0
 -1.0439386 4.8735996E-34 -1.0439386 0.0
 0.0 1.3078195E-38 9.531687E-34 9.530306E-34
Proj
 0.0 0.0 0.0 0.0
 0.0 0.0 0.0 0.0
 0.0 0.0 0.0 0.0
 0.0 0.0 0.0 0.0

It appears the array is not being back-populated upon return by GlueGen.



---- Additional Comments From kbr 2006-04-27 14:28:11 ----

Created an attachment
Working test case




---- Additional Comments From kbr 2006-04-27 14:29:51 ----

The example code provided is buggy. The glGetFloatv should be getting
GL_MODELVIEW_MATRIX and GL_PROJECTION_MATRIX instead of GL_MODELVIEW and
GL_PROJECTION. The attached test case works properly on my machine. Please
reopen this bug if for some reason the test case doesn't work on yours.




---- Additional Comments From luke_hutch 2006-04-27 15:10:24 ----

Ah.  Yes, sorry for the mistake and thank you for your time in tracking down the
source of the problem.




--- Bug imported by sgothel@jausoft.com 2010-03-24 07:48 EDT  ---

This bug was previously known as _bug_ 218 at https://jogl.dev.java.net/bugs/show_bug.cgi?id=218
Imported an attachment (id=80)

The original submitter of attachment 80 [details] is unknown.
   Reassigning to the person who moved it here: sgothel@jausoft.com.