|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Member (6 bit)
|
Graphics in SML/NJ
Would anyone be able to tell me how to do graphics in ML programming language? preferably SML/NJ. It is for drawing Lindenmayer systems and so basically just needs to support drawing lines of various lengths and at different angles on the screen... thanks for any help
|
|
|
|
|
|
#2 |
|
Member (7 bit)
Join Date: Sep 2003
Posts: 90
|
hmmm. . . graphics in ML . . .
well, the most i have done is to create a word array and then tell each pixel what color to be. then i dump the thing to a ppm (portable pixmap format). file i/o is a real you-know-what in ML. people have done really cool things with this. the code i used to create a ppm was actually used in the ICFP programming contest to make an ML raytracer. http://www.mlton.org/benchmarks/raytrace.sml sorry i can't be much more help than that, but ML is just not nice for file i/o nor graphics. AS |
|
|
|
|
|
#3 |
|
Member (6 bit)
|
Thanks for the response, that sounds really cool, but it also sounds a bit too complicated for me... basically the idea is that I have to do lindenmayer systems in ml, and then find a way to output it, I get the normal points for text output, 30 point bonus or something like that for ascii graphics, and 50 bonus for full graphics... from your explination it sounds like the 50 points might not be worth the trouble...
|
|
|
|
|
|
#4 |
|
Member (7 bit)
Join Date: Sep 2003
Posts: 90
|
if you are savy with openGL, you could dump the results into a C program, but that would be cheating. hehe.
i might have the code for that raytracer in SML lying about, but you would have to write an iterative functions to color the pixels on the line. if they are only horizontal or vertical, it might not be too bad. i have never dealt with l-systems. iterative functions are a trick in a functional language, but the raytracer basically loops over every pixel, so it can be done. i guess you would have to fold over all the lines and do the algebra. it would be quite a trick. it seems everything you are doing in ML, file i/o, graphics, iterativeness, etc are all tricky in a functional language. good luck, you are the first person i have met who knows ML. AS Last edited by AerynSedai; 04-06-2004 at 11:20 PM. |
|
|
|
|
|
#5 |
|
Member (6 bit)
|
That's the problem... I don't know ML, till this semester I've pretty much only used Java, C, and C++
Now I'm taking a programming languages class, and they are trying to teach us the ideas about a wide variety of languages, such as Forth, ML, LISP... It's really a pain because we get these projects in languages we've never used before and then have to rush to learn the language so we can do the project. Supposedly the actually l-systems part isn't very difficult to do in ML just the output, unfortunately I don't know as much about programming as I guess I should by now, because I don't know anything about OpenGL or raytracers, but I don't think OpenGL is cheating. Someone brought that up I think and he said if you could figure it out that's fine, as long as it works on the school's Sun systems, I think he said that requirement was to prevent us from using .net stuff... I guess I should read up on this OpenGL stuff, seems like it might be the easiest way |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|