[Haskell-cafe] renderString problems
ninegua at gmail.com
Thu Aug 2 10:12:04 EDT 2007
Your code is not rendering stroke font, but bitmap. Use the following
code to render str at x and y position.
GL.currentRasterPosition $= vertex4 x y 0 1
GLUT.renderString GLUT.Fixed8By13 str
where vertex4 is defined as:
vertex4 :: Float -> Float -> Float -> Float -> GL.Vertex4 Float
vertex4 = GL.Vertex4
Note that the coordinate system for rasterization is different from
GL's transformation matrix.
If you really want the stroke font, you should use Roman or MonoRoman,
then you may transform your position using GL.translate (GL.Vector3 x
On 8/1/07, Dave Tapley <dukedave at gmail.com> 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
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe