Summary: | Texture Buffer Size | ||
---|---|---|---|
Product: | [JogAmp] Jogl | Reporter: | Guilherme Amorim <seu.gui.x> |
Component: | opengl | Assignee: | Sven Gothel <sgothel> |
Status: | VERIFIED INVALID | ||
Severity: | major | ||
Priority: | --- | ||
Version: | 2 | ||
Hardware: | pc_x86_64 | ||
OS: | windows | ||
Type: | --- | SCM Refs: | |
Workaround: | --- | ||
Attachments: |
Zip containing code that throws the exception and the Image file
Exception Description |
Description
Guilherme Amorim
2010-07-04 18:42:11 CEST
Created attachment 145 [details]
Zip containing code that throws the exception and the Image file
Created attachment 146 [details]
Exception Description
After minor test case fixes to allow it to run under JOGL2, plus adding trace and debug pipeline, the output is: +++ Info: XInitThreads() called for concurrent Thread support glGenTextures(<int> 0x1, <[I>, <int> 0x0) glBindTexture(<int> 0xDE1, <int> 0x1) glTexImage2D(<int> 0xDE1, <int> 0x0, <int> 0x3, <int> 0x100, <int> 0x100, <int> 0x0, <int> 0x1907, <int> 0x1401, <java.nio.Buffer> java.nio.DirectByteBuffer[pos=196608 lim=196608 cap=196608])Exception in thread "Timer-0" javax.media.opengl.GLException: java.lang.IndexOutOfBoundsException: Required 196608 remaining bytes in buffer, only had 0 +++ As you can see, we calculate the proper byte size of 196608, which is to be expected, but you buffer can't offer any - since it's position is at it's limit. A simple "buffer.rewind()" before passing it to the GL texture funtion solves your bug, so we can read all required bytes, Now the output is: +++ Info: XInitThreads() called for concurrent Thread support glGenTextures(<int> 0x1, <[I>, <int> 0x0) glBindTexture(<int> 0xDE1, <int> 0x1) glTexImage2D(<int> 0xDE1, <int> 0x0, <int> 0x3, <int> 0x100, <int> 0x100, <int> 0x0, <int> 0x1907, <int> 0x1401, <java.nio.Buffer> java.nio.DirectByteBuffer[pos=0 lim=196608 cap=196608]) glTexParameteri(<int> 0xDE1, <int> 0x2801, <int> 0x2601) glTexParameteri(<int> 0xDE1, <int> 0x2800, <int> 0x2600) glShadeModel(<int> 0x1D01) ... +++ And the cube is no more yellow :) |