
TextPrinter implementation [commited]
Posted Thursday, 13 March, 2008 - 09:14 by teichgraf inI read the code of the Utilities / TextPrinter, because I need a similar Begin() / End() state saving. In Begin() I see that you are calling:
//... GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); //...
I think this changes the current BlendFunc, which won't be reset afterwards in End()? Maybe it would be better to call
GL.PushAttrib(GL_COLOR_BUFFER_BIT);
before and GL.PopAttrib(GL_COLOR_BUFFER_BIT) in End().
See ManPage PushAttrib
And why is the viewport member defined to have the length 6? The viewport could only contain 4 floats or am I wrong?
See ManPage GlGet
Edit 04-07-2008:
Added tiny patch for TextPrinter:
GL.PushAttrib(AttribMask.TextureBit); GL.PushAttrib(AttribMask.EnableBit); GL.PushAttrib(AttribMask.ColorBufferBit);
changed to:
GL.PushAttrib(AttribMask.TextureBit | AttribMask.EnableBit | AttribMask.ColorBufferBit);
This reduces the 6 calls for push / pop to 2 calls. Not that much, but better than none.
| Attachment | Size |
|---|---|
| TextPrinter.zip | 411 bytes |


Comments
Re: TextPrinter implementation
Thanks, good catches. Fixed.
Re: TextPrinter implementation
I added a tiny patch to the first post (see above).
Re: TextPrinter implementation
Thanks, implemented. Every little bit helps :)
Re: TextPrinter implementation [commited]
You forgot to change the
TextPrinter.End()method fromto one Pop.
As a result I get a StackUnderflow OpenGLError, because we do just one
GL.PushAttrib(...);Re: TextPrinter implementation [commited]
Oops!
Re: TextPrinter implementation [commited]
Hi,
i've got a related issue
TextPrinter.End() leaves the MatrixMode at Projection, which i found very unexpected and it wreaked some havoc in my code :)
i think the pushes/pops should be reordered so the MatrixMode is left at Modelview.
Re: TextPrinter implementation [commited]
Thanks for catching this, it's a bug. Will fix!