[Haskell-cafe] renderString problems

Claude Heiland-Allen claudiusmaximus at goto10.org
Thu Aug 2 09:07:58 EDT 2007


Hi Dave, everyone...

Dave Tapley wrote:
> Hi all,
> 
> I'm having a lot of trouble using renderString from Graphics.UI.GLUT.Fonts.
> All my attempts to render a StrokeFont have so far failed.
> Using a BitmapFont I can get strings to appear but they demonstrate
> the odd behaviour of translating themselves a distance equal to their
> length every time my displayCallback function is evaluated.
> 
> My requests are:
>   * Does anyone know how to keep the position fixed?

One way is to wrap the drawing action with preservingMatrix :

http://cvs.haskell.org/Hugs/pages/libraries/OpenGL/Graphics-Rendering-OpenGL-GL-CoordTrans.html#v%3ApreservingMatrix

(re-exported from the main GLUT module, if I read the docs correctly)

This pushes the transformation state to a stack, executes the action, 
and restores the transformation state from the stack.

More useful when you have complex scenes/subscenes/subsubscenes etc, but 
should work here too.

 > [snip]


Claude
-- 
http://claudiusmaximus.goto10.org



More information about the Haskell-Cafe mailing list