Login  Register

Re: Uniform Buffers mapping and size

Posted by Sven Gothel on Jun 13, 2013; 6:05pm
URL: https://forum.jogamp.org/Uniform-Buffers-mapping-and-size-tp4029403p4029405.html

On 06/13/2013 07:56 PM, jmaasing [via jogamp] wrote:
> A simple workaround for me was to not use structs in the shader but use simple
> types, being a newbie I didn't want to tangle with using buffers for the
> uniforms.
>
> like shader: uniform float time ;
> and then: gl.glUniform1f(uniformId, time);
>
> But I'd be interested to learn how to do that struct/buffer thingy :-)

Discrete r/w access is possible via:

http://jogamp.org/git/?p=jogl.git;a=blob;f=src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/shaders/mgl_lightdef.glsl;hb=HEAD

http://jogamp.org/git/?p=jogl.git;a=blob;f=src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java;hb=HEAD#l445

However, that is ofc not optimal to burst a bunch of data.
For the latter I usually use arrays.
Maybe there is said 'buffer' solution available as well,
but above example is restricted to ES2.

~Sven



signature.asc (911 bytes) Download Attachment