Login  Register

Uniform Buffers mapping and size

Posted by zzuegg on Jun 13, 2013; 2:06pm
URL: https://forum.jogamp.org/Uniform-Buffers-mapping-and-size-tp4029403.html

Hello, sorry for such a newby question but i have no clue how to map and bind a java object to a uniform buffer object.

For example:
JAVA:

public void GlobalGameInfo extends UniformBufferObject{
  long timeGlobal;
  float timePerFrame;
}

with the use of reflection i then get:

GLSL:
uniform GlobalGameInfo{
 long timeGlobal;
 float timePerFrame;
}inGlobalGameInfo;

This all works fine.
However, i don't know how to pass the data from the java object to the UBO creted with:
gl.getGL3().glGenBuffers(1, uniformBuffer, 0);
uniformObject.nativeId=uniformBuffer[0];
gl.getGL3().glBindBuffer(GL3.GL_UNIFORM_BUFFER, uniformObject.nativeId);
gl.getGL3().glBufferData(uniformObject.nativeId,?????, ??????, ?????);