chili-epfl / libgdx-sample

Sample libgdx project to get familiar with libgdx integration with Chilitags, camera etc.
GNU Lesser General Public License v3.0
5 stars 1 forks source link

Exception when passing ByteBuffer to texture #1

Open ayberkozgur opened 10 years ago

ayberkozgur commented 10 years ago

In the desktop application, when passing the ByteBuffer that contains the camera image to the Texture, the following exception occurs:

Exception in thread "LWJGL Application" java.lang.IllegalArgumentException: Number of remaining buffer elements is 921600, must be at least 921600. Because at most 921600 elements can be returned, a buffer with at least 921600 elements is required, regardless of actual returned element count
    at org.lwjgl.BufferChecks.throwBufferSizeException(BufferChecks.java:162)
    at org.lwjgl.BufferChecks.checkBufferSize(BufferChecks.java:189)
    at org.lwjgl.BufferChecks.checkBuffer(BufferChecks.java:230)
    at org.lwjgl.opengl.GL11.glTexImage2D(GL11.java:2855)
    at com.badlogic.gdx.backends.lwjgl.LwjglGL20.glTexImage2D(LwjglGL20.java:540)
    at ch.epfl.chili.libgdx_sample.desktop.DesktopCameraController.renderBackground(DesktopCameraController.java:110)
    at ch.epfl.chili.libgdx_sample.LibgdxSample.render(LibgdxSample.java:170)
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:206)
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:114)

It may be an out of memory issue or a lock issue with the ByteBuffer. Will see if mutexing the ByteBuffer solves the issue.