opengl - Transform feedback without a framebuffer? -
i'm interested in using vertex shader process buffer without producing rendered output. here's relevant snippet:
gluseprogram(program); gluint tfoutputbuffer; glgenbuffers(1, &tfoutputbuffer); glbindbuffer(gl_array_buffer, tfoutputbuffer); glbufferdata(gl_array_buffer, sizeof(double)*4*3, null, gl_static_read); glenable(gl_rasterizer_discard_ext); glbindbufferbase(gl_transform_feedback_buffer, 0, tfoutputbuffer); glbegintransformfeedbackext(gl_triangles); glbindbuffer(gl_array_buffer, positionbuffer); glenablevertexattribarray(positionattribute); glvertexattribpointer(positionattribute, 4, gl_float, gl_false, sizeof(double)*4, 0); glbindbuffer(gl_element_array_buffer, elementbuffer); gldrawelements(gl_triangles, 1, gl_unsigned_int, 0);
this works fine until gldrawelements()
call, results in gl_invalid_framebuffer_operation
. , glcheckframebufferstatusext(gl_framebuffer_ext);
returns gl_framebuffer_undefined
.
i presume because gl context not have default framebuffer, , have not bound fbo. but, since don't care rendered output , i've enabled gl_rasterizer_discard_ext
, thought framebuffer shouldn't necessary.
so, there way use transform feedback without framebuffer, or need generate , bind framebuffer though don't care contents?
this valid behavior, as-per specification.
opengl 4.4 core specification - 9.4.4 effects of framebuffer completeness on framebuffer operations
a
gl_invalid_framebuffer_operation
error generated attempts render or read framebuffer is not framebuffer complete. error generated regardless of whether fragments read or written framebuffer. example, generated when rendering command called , framebuffer incomplete, even ifgl_rasterizer_discard
enabled.
what need work around create fbo 1 pixel color attachment , bind that. must have complete fbo bound or gl_invalid_framebuffer_operation
, 1 of rules completeness @ least 1 complete image attached.
opengl 4.3 allows skirt around issue defining fbo no attachments of sort (see: gl_arb_framebuffer_no_attachments
). however, because using ext form of fbos , transform feedback, doubt have 4.3 implementation.
Comments
Post a Comment