opengl - how can glFlush() affect rendering correctness? -
opengl - how can glFlush() affect rendering correctness? -
upon noticing there unexpected artefacts in other opengl programs, did digging , discovered can upgrade opengl stack on ubuntu: https://launchpad.net/~xorg-edgers/+archive/ppa
after updating, gl rendering faster (my test programs below doubled in speed!) , without artefacts.
so reply own question: how can glflush() impact rendering correctness? when drivers buggy.
=== original question ===
or, more correctly, fundamental bug classic untrendy non-shader-vbo-stuff?
cdef struct xyz: float x, y, z cdef inline void _normal(xyz b,xyz a): glnormal3f(a.x-b.x,a.y-b.y,a.z-b.z) cdef inline void _draw_quad(xyz a,xyz b,xyz c,xyz d): glvertex3f(a.x,a.y,a.z) glvertex3f(b.x,b.y,b.z) glvertex3f(c.x,c.y,c.z) glvertex3f(d.x,d.y,d.z) cdef void _draw_grid(xyz a,xyz b,xyz c,xyz d): glbegin(gl_line_loop) _draw_quad(a,b,c,d) glend() .... # main loop goes through info array issuing appropriate functions while self._buf.remaining() > 0: op = self._buf.read_char() if op == _color: col = self._buf.read_rgb() #print col glcolor3f(col.r,col.g,col.b) elif op in (_box,_grid): tl,tr,br,bl,trb,brb,tlb,blb = self._buf.read_xyz(),self._buf.read_xyz(),\ self._buf.read_xyz(),self._buf.read_xyz(),\ self._buf.read_xyz(),self._buf.read_xyz(),\ self._buf.read_xyz(),self._buf.read_xyz() if op == _box: #print "box",col glbegin(gl_quads) func = _draw_quad else: #print "grid",col func = _draw_grid _normal(tlb,tl) func(tl,tr,br,bl) _normal(tl,tr) func(tr,trb,brb,br) _normal(tr,tl) func(tl,tlb,blb,bl) _normal(tr,tl) func(tl,tlb,trb,tr) _normal(tl,tr) func(bl,blb,brb,br) _normal(tl,tlb) func(tlb,trb,brb,blb) if op == _box: glend() #glflush() else: raise exception("corrupt serialisation; got %x"%op)
if flush after each cube or wireframe, correct rendering:
if omit flush - , don't want flushing, if not treading optimal opengl path - incorrect rendering, , bug don't understand:
for curious, here how glutsolidcube
, wires it: http://www.google.com/codesearch/p?hl=en#xbii4fg5bfw/trunk/fds/trunk/smv_5/source/glut-3.7.6/glut_shapes.c&q=glutsolidcube%20lang:c&sa=n&cd=4&ct=rc
i can't exactly why not calling glflush()
causes undesired results, may want take @ question difference between glflush advertisement glfinish asked time ago. may have useful info.
as solutions, perhaps seek putting glflush()
after you're done rendering entire scene, opposed each cube.
opengl cython
Comments
Post a Comment