Bug 84 - glReadPixels does not commit results
Summary: glReadPixels does not commit results
Status: VERIFIED FIXED
Alias: None
Product: Jogl
Classification: JogAmp
Component: core (show other bugs)
Version: 1
Hardware: All all
: P5 normal
Assignee: Sven Gothel
URL:
Depends on:
Blocks:
 
Reported: 2004-05-07 05:44 CEST by Sven Gothel
Modified: 2010-03-24 07:46 CET (History)
0 users

See Also:
Type: DEFECT
SCM Refs:
Workaround: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sven Gothel 2010-03-24 07:46:35 CET


---- Reported by petermantell 2004-05-07 05:44:57 ----

The native code for glReadPixels contains the following lines at the end of the 
function:

if (pixels != NULL)
{
  (*env)->ReleasePrimitiveArrayCritical(env, pixels, _ptr6, JNI_ABORT);
}

The use of JNI_ABORT signifies that the buffer will be freed but changes are 
not written back into the Java array. So the data that glReadPixels returns 
never ends up back in the Java array.

0 should be used instead of JNI_ABORT. See 
http://java.sun.com/j2se/1.4.2/docs/guide/jni/spec/functions.html#wp17440.



---- Additional Comments From kbr 2005-02-03 15:21:05 ----

While the submitter is correct, this is not a problem on Sun's JDK
implementation or any other JDK that I am aware of. GetPrimitiveArrayCritical
tends to return a pointer to the actual storage of the array rather than a copy.
I'm lowering the priority of this bug. For complete correctness, GlueGen would
probably use JNI_ABORT for outgoing const pointers and 0 for outgoing non-const
pointers.




---- Additional Comments From petermantell 2005-02-04 01:10:35 ----

With respect, it was a Sun JDK implementation that I was using at the time. 
This bug caused us lots of problems because it makes it almost impossible to 
get any data back from the buffer.



---- Additional Comments From kbr 2005-02-04 08:27:04 ----

What operating system, JDK version, and graphics card? Did you change the native
code, recompile, and see the problem disappear? Do you have a test case?

We are using glReadPixels in the core JOGL implementation with no problems. Is
it possible you were making the glReadPixels call while your GLEventListener was
not active?




---- Additional Comments From petermantell 2005-02-07 00:53:13 ----

Not sure of the answers to your questions - it was almost a year ago. I do 
remember trying it on different machines though, so can't have been a card 
specific issue.



---- Additional Comments From kbr 2006-01-11 00:05:08 ----

Changed use of JNI_ABORT to 0 in ReleasePrimitiveArrayCritical calls. This
should not change the behavior of the generated glue code in any way, at least
on the HotSpot JVM, but is being done for completeness of the GlueGen tool.




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

This bug was previously known as _bug_ 84 at https://jogl.dev.java.net/bugs/show_bug.cgi?id=84