[AD] OpenGL state

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


> In a GIT commit comment, SiegeLord said:
> Make ogl_flush_vertex_cache disable GL_TEXTURE_2D state.
> 
> Even though we don't necessarily care about what OpenGL state we leave
> after Allegro function calls, some Allegro functions nevertheless expect a
> particular state to be set. E.g. al_draw_pixel and the primitives addon
> expect GL_TEXTURE_2D to be disabled, which was the case in 5.0. In the
> future we probably want a concrete policy of how OpenGL state should be
> handled internally, as right now it's a hodge-podge of each function
> cleaning up some state, but leaving other state in an undefined state
> which can cause bugs to appear when those functions are used together.

Not having a unified policy of handling the OpenGL state also causes
confusion and hard to find issues for users (like me) who want to use
Allegro functions alongside directly accessing OpenGL because of
implicit state changes made by Allegro (and possibly also by gl state
changes made by the user when Allegro functions expect a different
state without setting it explicitly).

Might be worth investigating whether the following is feasible when
it comes to performance:
  Everytime an Allegro function calls a glEnable/glDisable, it calls 
  glGet  first to determine the current (user)state of that cap and
  then at the end of the function sets it back to that state.

If that's not possible, maybe there needs to be a table showing 
if/how each Allegro function call affects the gl state, so user gl 
code can be tailored to revert those changes manually.

(Unless of course it is a generally accepted common sense law in the
gl world that you should always explicitly set the state you need and
never assume a certain state.)

Dennis Busch
d_busch@xxxxxxxxxx




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/