[Haskell-cafe] Re: [HOpenGL] renderString problems

C Flynn scs4cajf at comp.leeds.ac.uk
Thu Aug 2 06:44:19 EDT 2007

On Wed, 1 Aug 2007, 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?
>  * Are there any good examples of (working) GLUT code available on
> the web, I'm finding it very hard to make any progress at the moment.
> Certainly not at Haskell speed :(
> I am using the following code:
>> import Graphics.UI.GLUT
>> main = do
>>     getArgsAndInitialize
>>     createWindow ""
>>     displayCallback $= update
>>     actionOnWindowClose $= ContinueExectuion
>>     mainLoop
>> update = do
>>     clear [ColorBuffer]
>>     renderString Fixed8By13 $ "Test string"
>>     flush
> Cheers,
> Dave
> _______________________________________________
> HOpenGL mailing list
> HOpenGL at haskell.org
> http://www.haskell.org/mailman/listinfo/hopengl

I had a similar problem with stroke fonts. Try scaling by a low number 
(such as 0.01) and see where that gets you. The problem was it was 
rendering them at a size much bigger than my coordinate space that I just 
couldn't see them. I'm not convinced you need that $ there either but I 
don't suppose it hurts.


More information about the Haskell-Cafe mailing list