java - glDrawBuffers should have flipped IntBuffer? -


i have following code:

  intbuffer drawbuffers = utils.createintbuffer(2);   int bfs[] = {gl30.gl_color_attachment0, gl30.gl_color_attachment1};   for(int = 0; < 2; i++)       drawbuffers.put(bfs[i]);   drawbuffers.flip();   gl20.gldrawbuffers(drawbuffers); 

if flip intbuffer int status = gl30.glcheckframebufferstatus(gl30.gl_framebuffer); don't equal gl_framebuffer_complete, if don't flip status right, black texture instead of desired texture, looked throught code on , on 2 days now, best bet part of code somehow wrong, rest seems ok.

should intbuffer flipped before using in gldrawbuffers(intbuffer) ?

yes, buffers should flipped before being passed lwjgl.

the underlying gl api expects array functions take java buffer. size of array parameter in gl's c language bindings, hidden in java because lwjgl calculates difference between current position , end position.

unless flip java.nio.buffer, sets "current" position beginning of buffer, current position going end position after calling put (...). thus, lwjgl passes array of size 0 c-based opengl api sits on top of. if call gldrawbuffers (...) size 0, sets gl_none, going produce behavior described.


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -