[Haskell-cafe] OpenGL Speed!

Luke Palmer lrpalmer at gmail.com
Thu Jul 29 13:30:37 EDT 2010

Yep, no surprise there.  I would suggest using bitmap[1] to construct
your bitmap, and bitmap-opengl to put it into an OpenGL texture and
draw it on a textured quad.  I think OpenGL is actually an OK choice
for this application, because it is the most portable graphics method
we have available.

If you are trying to redraw in realtime, eg. 30 FPS or so, I don't
think you're going to be able to.  There is just not enough GPU
bandwidth (and probably not enough CPU) for that (unless you write it
in a pixel shader, which IIRC haskell has some neat tools for, but I
don't remember).  If this is the case, see if you can boil down what
you have into something that doesn't require so much data, e.g.

[1] http://hackage.haskell.org/package/bitmap
[2] http://hackage.haskell.org/package/bitmap-opengl

On Thu, Jul 29, 2010 at 3:57 AM, Eitan Goldshtrom
<thesourceofx at gmail.com> wrote:
> I'm having an unusual problem with OpenGL. To be honest I probably shouldn't
> be using OpenGL for this, as I'm just doing 2D and only drawing Points, but
> I don't know about any other display packages, so I'm making due. If this is
> a problem because of OpenGL however, then I'll have to learn another
> package. The problem is speed. I have a list of points representing the
> color of 800x600 pixels. All I'm trying to do is display the pixels on the
> screen. I use the following:
> renderPrimitive Points $ mapM_ display list
> flush
> where
>   display [] = return ()
>   display ((x,y,i):n) = do
>     color $ Color3 i i i
>     vertex $ Vertex2 x y
>     display n
> But, for some reason this takes FOREVER. I don't know how to use debugging
> hooks yet without an IDE -- and I don't use an IDE -- but I used a cleverly
> placed putStrLn to see that it was actually working, just really really
> slowly. Is there a solution to this speed problem or should I use a package
> that's more suited to 2D applications like this? Also, if I should use
> another package, are there any suggestions for which to use? Thanks for any
> help.
> -Eitan
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list