Discussion:
[haskell-art] draw 2D pixel array
Miguel Negrao
2013-02-27 12:07:36 UTC
Permalink
Hi,

I would like to draw in Haskel simulations of turing patterns, cellular automata, etc. Basically I will only need to take an array of pixels and draw it to the screen directly. What is the best Haskel graphic library and functions to do this ?

best,
Miguel
http://www.friendlyvirus.org/miguelnegrao/
Stefan Kersten
2013-02-27 14:58:09 UTC
Permalink
hi miguel,
Post by Miguel Negrao
I would like to draw in Haskel simulations of turing patterns, cellular automata, etc. Basically I will only need to take an array of pixels and draw it to the screen directly. What is the best Haskel graphic library and functions to do this ?
i've been using diagrams [1] lately --there's also an animation package [2]-- but maybe it's too slow for realtime. imo opengl would be a good option if you're already familiar with it ...

sk

[1] http://projects.haskell.org/diagrams/
[2] http://hackage.haskell.org/package/active
Miguel Negrao
2013-02-27 17:13:29 UTC
Permalink
Post by Stefan Kersten
hi miguel,
Post by Miguel Negrao
I would like to draw in Haskel simulations of turing patterns, cellular automata, etc. Basically I will only need to take an array of pixels and draw it to the screen directly. What is the best Haskel graphic library and functions to do this ?
i've been using diagrams [1] lately --there's also an animation package [2]-- but maybe it's too slow for realtime. imo opengl would be a good option if you're already familiar with it ...
I know diagrams but it is more suited for working with primitives then with direct pixel manipulation. I already have some opengl experience in Haskell, but since it’s for 3D stuff I assumed it would be overkill. Would the Haskell SDL bindings be a better option then opengl, or should I go with opengl ?

best,
Miguel
Stefan Kersten
2013-02-27 17:22:34 UTC
Permalink
Post by Miguel Negrao
I know diagrams but it is more suited for working with primitives then with direct pixel manipulation. I already have some opengl experience in Haskell, but since it’s for 3D stuff I assumed it would be overkill. Would the Haskell SDL bindings be a better option then opengl, or should I go with opengl ?
i don't have experience with the SDL bindings, but with opengl it's just a matter of configuring the projection for 2D, right?

sk
Brent Yorgey
2013-02-27 18:27:31 UTC
Permalink
Post by Miguel Negrao
Post by Stefan Kersten
hi miguel,
Post by Miguel Negrao
I would like to draw in Haskel simulations of turing patterns, cellular automata, etc. Basically I will only need to take an array of pixels and draw it to the screen directly. What is the best Haskel graphic library and functions to do this ?
i've been using diagrams [1] lately --there's also an animation package [2]-- but maybe it's too slow for realtime. imo opengl would be a good option if you're already familiar with it ...
I know diagrams but it is more suited for working with primitives then with direct pixel manipulation. I already have some opengl experience in Haskell, but since it’s for 3D stuff I assumed it would be overkill. Would the Haskell SDL bindings be a better option then opengl, or should I go with opengl ?
Indeed, diagrams is not very well suited for drawing pixel arrays.
Have you looked at gloss [1] and gloss-raster [2] ? IIRC gloss-raster
has some impressive examples rendering real-time pixel-array based
animations. It's built on top of opengl but lets you work at a higher
level. It sounds like it might be perfect for what you want.

-Brent

[1] http://hackage.haskell.org/package/gloss
[2] http://hackage.haskell.org/package/gloss-raster
Miguel Negrao
2013-02-28 08:22:39 UTC
Permalink
Post by Brent Yorgey
Post by Miguel Negrao
Post by Stefan Kersten
hi miguel,
Post by Miguel Negrao
I would like to draw in Haskel simulations of turing patterns, cellular automata, etc. Basically I will only need to take an array of pixels and draw it to the screen directly. What is the best Haskel graphic library and functions to do this ?
i've been using diagrams [1] lately --there's also an animation package [2]-- but maybe it's too slow for realtime. imo opengl would be a good option if you're already familiar with it ...
I know diagrams but it is more suited for working with primitives then with direct pixel manipulation. I already have some opengl experience in Haskell, but since it’s for 3D stuff I assumed it would be overkill. Would the Haskell SDL bindings be a better option then opengl, or should I go with opengl ?
Indeed, diagrams is not very well suited for drawing pixel arrays.
Have you looked at gloss [1] and gloss-raster [2] ?
No, I didn’t know those. I think gloss-raster it exactly what I was looking for !! It’s so nice to just get what you need without spending too much time re-inventing the wheel. :-)

best,
Miguel
Lyndon Maydwell
2013-02-28 08:25:00 UTC
Permalink
I've used OpenGL for this purpose before, but there is a fair bit of
boilerplate. These-days gloss-raster is really good for this kind of thing.


On Thu, Feb 28, 2013 at 4:22 PM, Miguel Negrao <
Post by Miguel Negrao
Post by Brent Yorgey
Post by Miguel Negrao
Post by Stefan Kersten
hi miguel,
On 27 Feb 2013, at 13:07, Miguel Negrao <
Post by Miguel Negrao
I would like to draw in Haskel simulations of turing patterns,
cellular automata, etc. Basically I will only need to take an array of
pixels and draw it to the screen directly. What is the best Haskel graphic
library and functions to do this ?
Post by Brent Yorgey
Post by Miguel Negrao
Post by Stefan Kersten
i've been using diagrams [1] lately --there's also an animation
package [2]-- but maybe it's too slow for realtime. imo opengl would be a
good option if you're already familiar with it ...
Post by Brent Yorgey
Post by Miguel Negrao
I know diagrams but it is more suited for working with primitives then
with direct pixel manipulation. I already have some opengl experience in
Haskell, but since it’s for 3D stuff I assumed it would be overkill. Would
the Haskell SDL bindings be a better option then opengl, or should I go
with opengl ?
Post by Brent Yorgey
Indeed, diagrams is not very well suited for drawing pixel arrays.
Have you looked at gloss [1] and gloss-raster [2] ?
No, I didn’t know those. I think gloss-raster it exactly what I was
looking for !! It’s so nice to just get what you need without spending too
much time re-inventing the wheel. :-)
best,
Miguel
_______________________________________________
haskell-art mailing list
http://lists.lurk.org/mailman/listinfo/haskell-art
David Barbour
2013-02-27 18:43:31 UTC
Permalink
If all you need to do is draw a pixel buffer to screen, use SDL, or
wxHaskell with a bitmap. These will have fewer issues with alignment of
pixels, aliasing, etc.. that you might experience using textures in OpenGL.


On Wed, Feb 27, 2013 at 9:13 AM, Miguel Negrao <
Post by Miguel Negrao
Post by Stefan Kersten
hi miguel,
On 27 Feb 2013, at 13:07, Miguel Negrao <
Post by Miguel Negrao
I would like to draw in Haskel simulations of turing patterns, cellular
automata, etc. Basically I will only need to take an array of pixels and
draw it to the screen directly. What is the best Haskel graphic library and
functions to do this ?
Post by Stefan Kersten
i've been using diagrams [1] lately --there's also an animation package
[2]-- but maybe it's too slow for realtime. imo opengl would be a good
option if you're already familiar with it ...
I know diagrams but it is more suited for working with primitives then
with direct pixel manipulation. I already have some opengl experience in
Haskell, but since it’s for 3D stuff I assumed it would be overkill. Would
the Haskell SDL bindings be a better option then opengl, or should I go
with opengl ?
best,
Miguel
_______________________________________________
haskell-art mailing list
http://lists.lurk.org/mailman/listinfo/haskell-art
Umut Isik
2013-02-27 19:28:06 UTC
Permalink
Hi,

I've used the Glass package before. It uses OpenGL, has a function for
displaying bitmaps, has nice example code too.
Now I'm just using the Repa array package to make arrays of pixels and
write them to BMP files with Data.Array.Repa.IO.BMP

Best wishes
Umut
Post by David Barbour
If all you need to do is draw a pixel buffer to screen, use SDL, or
wxHaskell with a bitmap. These will have fewer issues with alignment of
pixels, aliasing, etc.. that you might experience using textures in OpenGL.
On Wed, Feb 27, 2013 at 9:13 AM, Miguel Negrao <
Post by Miguel Negrao
Post by Stefan Kersten
hi miguel,
On 27 Feb 2013, at 13:07, Miguel Negrao <
Post by Miguel Negrao
I would like to draw in Haskel simulations of turing patterns,
cellular automata, etc. Basically I will only need to take an array of
pixels and draw it to the screen directly. What is the best Haskel graphic
library and functions to do this ?
Post by Stefan Kersten
i've been using diagrams [1] lately --there's also an animation package
[2]-- but maybe it's too slow for realtime. imo opengl would be a good
option if you're already familiar with it ...
I know diagrams but it is more suited for working with primitives then
with direct pixel manipulation. I already have some opengl experience in
Haskell, but since it’s for 3D stuff I assumed it would be overkill. Would
the Haskell SDL bindings be a better option then opengl, or should I go
with opengl ?
best,
Miguel
_______________________________________________
haskell-art mailing list
http://lists.lurk.org/mailman/listinfo/haskell-art
_______________________________________________
haskell-art mailing list
http://lists.lurk.org/mailman/listinfo/haskell-art
--
Mehmet Umut Isik
Michael Steele
2013-02-27 23:48:18 UTC
Permalink
I can also vouch for Gloss as a quick way to get pixels displayed on the screen.
Post by Umut Isik
Hi,
I've used the Glass package before. It uses OpenGL, has a function for
displaying bitmaps, has nice example code too.
Now I'm just using the Repa array package to make arrays of pixels and write
them to BMP files with Data.Array.Repa.IO.BMP
Best wishes
Umut
Post by David Barbour
If all you need to do is draw a pixel buffer to screen, use SDL, or
wxHaskell with a bitmap. These will have fewer issues with alignment of
pixels, aliasing, etc.. that you might experience using textures in OpenGL.
On Wed, Feb 27, 2013 at 9:13 AM, Miguel Negrao
Post by Miguel Negrao
Post by Stefan Kersten
hi miguel,
On 27 Feb 2013, at 13:07, Miguel Negrao
Post by Miguel Negrao
I would like to draw in Haskel simulations of turing patterns,
cellular automata, etc. Basically I will only need to take an array of
pixels and draw it to the screen directly. What is the best Haskel graphic
library and functions to do this ?
i've been using diagrams [1] lately --there's also an animation package
[2]-- but maybe it's too slow for realtime. imo opengl would be a good
option if you're already familiar with it ...
I know diagrams but it is more suited for working with primitives then
with direct pixel manipulation. I already have some opengl experience in
Haskell, but since it’s for 3D stuff I assumed it would be overkill. Would
the Haskell SDL bindings be a better option then opengl, or should I go with
opengl ?
best,
Miguel
_______________________________________________
haskell-art mailing list
http://lists.lurk.org/mailman/listinfo/haskell-art
_______________________________________________
haskell-art mailing list
http://lists.lurk.org/mailman/listinfo/haskell-art
--
Mehmet Umut Isik
_______________________________________________
haskell-art mailing list
http://lists.lurk.org/mailman/listinfo/haskell-art
--
-- Michael Steele
Loading...