TextPrinter implementation [commited]
Posted Thursday, 13 March, 2008 - 09:14 by teichgraf in
before and
See ManPage PushAttrib
I 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);
//...
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);
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
Mar 13
09:31:51Re: TextPrinter implementation
posted by the FiddlerThanks, good catches. Fixed.
Apr 08
07:05:19Re: TextPrinter implementation
posted by teichgrafI added a tiny patch to the first post (see above).
Apr 13
17:28:48Re: TextPrinter implementation
posted by the FiddlerThanks, implemented. Every little bit helps :)
Apr 14
06:46:18Re: TextPrinter implementation [commited]
posted by teichgrafYou forgot to change the
TextPrinter.End()method fromGL.PopAttrib();
GL.PopAttrib();
GL.PopAttrib();
...
to one Pop.
GL.PopAttrib();
...
As a result I get a StackUnderflow OpenGLError, because we do just one
GL.PushAttrib(...);Apr 14
08:55:20Re: TextPrinter implementation [commited]
posted by the FiddlerOops!