[Haskell-cafe] OpenGL Speed!

Vo Minh Thu noteed at gmail.com
Thu Jul 29 10:42:09 EDT 2010


If you still want to use glVertex with GL_POINTS, instead of a display
list, you'd better go with vertex array or VBO.

But still, if the implicit coordinates of a raster is assumed, pairing
the coordinates with their value is overkill.

Cheers,
Thu

2010/7/29 Job Vranish <job.vranish at gmail.com>:
> Yeah, using openGL Points to draw 2D images will probably be pretty slow.
> However, if you don't need to change your points every frame, a display list
> might improve the speed quite a bit (you could still transform the points as
> a whole).
>
> Also, you could try the SDL bindings for haskell:
> http://hackage.haskell.org/package/SDL
> SDL is better suited for 2D drawing (IMHO).
> http://www.libsdl.org/
>
>
> - Job
>
>
> On Thu, Jul 29, 2010 at 6:51 AM, Vo Minh Thu <noteed at gmail.com> wrote:
>>
>> 2010/7/29 Eitan Goldshtrom <thesourceofx at gmail.com>:
>> > 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.
>>
>> Hi,
>>
>> Although you can use Vertex* to put a single Point on the screen, it
>> is not meant to be used as some kind of setPixel function.
>>
>> If your goal is simply to set pixels' value of a raster, you can still
>> use OpenGL but should use a single textured quad (and thus manipulate
>> the texture's pixels).
>>
>> There other possibilities to deal with raster graphics:
>> - Use gtk; i.e. something like
>> http://hackage.haskell.org/package/AC-EasyRaster-GTK
>> - Output the data in some image format (if you want to do it yourself,
>> the most simple is PPM)
>> - Use X11 directly (if you're on unix)
>> - ...
>>
>> HTH,
>> Thu
>> _______________________________________________
>> 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