Banana changed the topic of #ocaml to: OCaml 3.08.1 available! | Archive of Caml Weekly News: http://sardes.inrialpes.fr/~aschmitt/cwn/ | A tutorial: http://merjis.com/richj/computers/ocaml/tutorial/ | A free book: http://cristal.inria.fr/~remy/cours/appsem/ | Mailing List: http://caml.inria.fr/bin/wilma/caml-list/ | Cookbook: http://pleac.sourceforge.net/
clog has joined #ocaml
kinners has joined #ocaml
salo has joined #ocaml
salo has quit []
wreel has quit ["Leaving"]
wreel has joined #ocaml
kinners has quit ["leaving"]
salo has joined #ocaml
salo has quit []
lodewijk has quit ["[BX] Yo quiero BitchX"]
ne1 has quit ["To understand recursion, you must first understand recursion."]
monochrom has joined #ocaml
wreel has quit ["Leaving"]
mrsolo has quit ["Leaving"]
CosmicRay has quit ["Client exiting"]
Faust has joined #ocaml
monochrom has quit ["hello"]
vezenchio has joined #ocaml
Faust has quit [Remote closed the connection]
solarwin1 has quit ["leaving"]
mrsolo has joined #ocaml
solarwind has joined #ocaml
mlh has quit [Client Quit]
Submarine has quit [Read error: 104 (Connection reset by peer)]
async_ has joined #ocaml
<async_> Smerdyakov
<async_> u there?
pango_ has quit ["Client exiting"]
pango has joined #ocaml
mrsolo has quit ["Leaving"]
senko_ has joined #ocaml
skylan_ has joined #ocaml
senko_ has quit ["Leaving"]
skylan has quit [Client Quit]
senko has quit ["Leaving"]
async_ has quit ["leaving"]
mlh has joined #ocaml
moonfish` has joined #ocaml
moonfish has quit [Read error: 110 (Connection timed out)]
solarwind has quit [Read error: 60 (Operation timed out)]
smimou has joined #ocaml
lus|wazz has joined #ocaml
cmeme has quit [Connection timed out]
vezenchio has quit [Read error: 110 (Connection timed out)]
solarwind has joined #ocaml
moonfish` is now known as moonfish
gim has joined #ocaml
_fab has joined #ocaml
_fab has quit [Remote closed the connection]
karryall has joined #ocaml
_fab has joined #ocaml
blugleblogle has joined #ocaml
Faust79 has joined #ocaml
<Faust79> hi
mlh has quit [Client Quit]
Demitar has joined #ocaml
_fab has quit []
senko has joined #ocaml
smimram has joined #ocaml
smimou has quit [Nick collision from services.]
smimram is now known as smimou
senko has quit ["Leaving"]
senko has joined #ocaml
<vincenz> hello
srv_ has quit [Read error: 104 (Connection reset by peer)]
_fab has joined #ocaml
<mrvn> Is there a way to make an int array that isn't actualy an ref int array? 'Array.make size 0' makes an array of pointers all to the same 0 and thus .(1) <- 1 sets them all to 1.
Faust79 has quit [Read error: 104 (Connection reset by peer)]
<mrvn> Never mind, mea culpa. The outer array was the problem (the array of int arrays) and not the inner one.
<karryall> no, it doesn't
<mrvn> I should have used Array.make_matrix width height 0 I guess.
<vincenz> mrvn: or use init
<mrvn> I had code like this: # let m = Array.make 3 (Array.make 3 0);;
<mrvn> val m : int array array = [|[|0; 0; 0|]; [|0; 0; 0|]; [|0; 0; 0|]|]
<mrvn> # m.(0).(0) <- 1;;
<mrvn> - : unit = ()
<mrvn> # m;;
<mrvn> - : int array array = [|[|1; 0; 0|]; [|1; 0; 0|]; [|1; 0; 0|]|]
<vincenz> Array.init width (fun x -> Array.init height (fun y -> if x == 0 then 1 else 1))
<karryall> yeah, make_matrix is what you need
<mrvn> Why is there no Array.init_matrix ?
<karryall> make_matrix is a very wrapper for Array.init
<karryall> just code your init_matrix function
<vincenz> let width = 3 in let height = 3 in Array.init width (fun x -> Array.init height (fun y -> if y = 0 then 1 else 0 ));;
<vincenz> switch width/height and x/y if you want semantically correct variable
<vincenz> -names
<mrvn> karryall: It should be there so the matrix functions have the same capabilities as the normal ones.
<mrvn> let init_matrix w h f = Array.init w (fun x -> Array.init h (fun y -> f x y))
<karryall> it's not really useful. It's probably a remnant of Caml Light
<vincenz> mrvn: switch w and h
<mrvn> vincenz: why?
<vincenz> data is usually stored in row-major form
<vincenz> in most systems/languages at least
<mrvn> but then access has to switch x and y too.
<vincenz> yah
<vincenz> and that's how it's usually done
<vincenz> in fact if one reads how matlabimplements matrices, they will ntocie that mat[x][y] in matlab translates to mat[y][x] in c
<mrvn> What I actualy need is a hexagonal grid of tiles.
<vincenz> hexanogal can be implemnented with square matrix
<vincenz> just that odd rows will have one value less
<mrvn> Or you shift each row by half a tile so they fit into a hex pattern.
<vincenz> that's what I meant
<vincenz> and that means that every other row will only need width-1 tiles
<mrvn> Gives you a trapez shape.
<mrvn> No, all rows the same size.
<vincenz> well 'rectangularly-shaped' area with hex-grids translates to a rectangularly'shaped matrix with every other row having one less element
<vincenz> look
<vincenz> a b c d
<vincenz> e f g
<vincenz> h i j k
<vincenz> l m n
<mrvn> _ _
<mrvn> _/ \_/ \
<mrvn> _/ \_/ \_/
<mrvn> \_/ \_/
<mrvn> \_/ \_/
<mrvn> _ _
<mrvn> _/ \_/ \
<mrvn> _/ \_/ \_/
<mrvn> / \_/ \_/
<mrvn> \_/ \_/
<mrvn> This way.
<vincenz> yes but that gives you a skewed grid, not very useful
cmeme has joined #ocaml
<mrvn> That doesn't realy matter if you have a donut or cylindrical world
<mrvn> Or if skewed is ok.
<vincenz> what I meant was that you have a square-like world
<vincenz> (or rectangular)
<vincenz> but then with hex-tiles
vezenchio has joined #ocaml
<mrvn> _
<mrvn> _/ \_
<mrvn> _/ \_/ \_
<mrvn> / \_/ \_/ \
<mrvn> \_/ \_/ \_/
<mrvn> \_/ \_/
<mrvn> \_/
<mrvn> Or that shape.
<mrvn> If you only move even rows half a tile in:
<mrvn> _ _
<mrvn> / \_/ \_
<mrvn> \_/ \_/ \
<mrvn> / \_/ \_/
<mrvn> \_/ \_/ \
<mrvn> \_/ \_/
<mrvn> you get strange neighbourhoods for a tile.
<vincenz> yeah I know but usually you have a preset world (rectangular) and then the last diagram is the best to fill it amap
<mrvn> A lot of games use isometric view. Those can better use the middle one.
<mrvn> Settlers uses the skewed one. Leaves room for the map and icons on the screen.
<vincenz> right
<vincenz> what are you working on?
<mrvn> Do you know populous?
lus|wazz has quit [Read error: 60 (Operation timed out)]
<vincenz> Yes
<vincenz> nice game
<mrvn> I'm thinking of writing a clone with hex tiles. The paste buffer creates a trivial map.
wegzz has joined #ocaml
<vincenz> fully ocaml?
<karryall> Unix.sleep doesn't work well with Graphics
<mrvn> unless it becomes too slow.
<mrvn> I will need something for the GUI. Maybe lablgl.
<mrvn> Or I have to modify the Graphics module to give me left/right mouse buttons and mouse move events at least.
<karryall> lablgl ?
vezenchio has quit [Read error: 110 (Connection timed out)]
<mrvn> Description: Runtime libraries for lablgl
<mrvn> LablGL is an OpenGL interface for Objective Caml. Since it includes
<mrvn> support for the Togl widget, you can comfortably use it with LablTk.
<mrvn> A GtkGlarea binding for use with lablgtk is also provided.
<mrvn> .
<mrvn> This package include only the dynamic libraries needed for running dynamic
<mrvn> bytecode executables.
<Smerdyakov> Descripton: mrvn will spam the channel for you.
<mrvn> sorry.
<mrvn> But using OpenGL for the rendering sounds like a good idea.
<karryall> sure but it does not address the GUI
<karryall> you'll have to use Tk or GTK
<Smerdyakov> I've made a GUI with OpenGL before!
<Smerdyakov> It's a shame if there isn't a standard one out there.
<mrvn> I can make one big texture for the background with the icons on it and then catch mouse clicks.
<vincenz> mrvn: go for lablgtk2
<Smerdyakov> You goofball.
<Smerdyakov> You can draw icons the same was as you draw 3D objects.
<Smerdyakov> And then you can use the click resolution functions of OpenGL to tell what was clicked.
<mrvn> exactly.
<Smerdyakov> (I forget what the official name for "click resolution" is.)
<vincenz> who's the goofball?
<Smerdyakov> That's not "one big texture"!
<Smerdyakov> mrvn is a goofball!
<vincenz> oh, yeah
<vincenz> just make multiple polygons
<mrvn> Can GL highlight points on a 3D object when the mouse hovers over it?
<vincenz> and map each with the correct texture
<vincenz> (much smaller textures)
<vincenz> mrvn: just move a lightsource
<Smerdyakov> mrvn, of course. You can detect where the mouse is and draw things differently.
<mrvn> Smerdyakov: I ment if GL can do it for me.
<Smerdyakov> OpenGL doesn't do anything "dynamic" whatsoever, does it?
<mrvn> Populous has a mouse cursor and then a dot on the grid of the map where a click would snap to currently.
<mrvn> I guess I have to make that dot a seperate object and move it myself.
<vincenz> mrvn: add some fog and then a point-light source (or a cone-lightsource)
<Smerdyakov> This isn't that complicated; it's the standard trick of animation.
<Smerdyakov> Draw things differently in different frames, based on outside clues.
<Smerdyakov> Whether or not this involves "objects" or anything else is up to you. There are many ways to do it.
<mrvn> I don't want to redraw to often though. I want to play it without hardware GL.
<vincenz> you can have animation with GL afaik
<Smerdyakov> Then you are out of luck. You can't get animation in OpenGL without redrawing.
<mrvn> Can I draw something and then overlay it with another draw pass?
<vincenz> there
<vincenz> nm
<Smerdyakov> I doubt it, if what you're asking magically lets you avoid regenerating most of the pixels.
<mrvn> I could draw the landscape and then just redraw the mouse pointer and moving people over it on each frame.
<Smerdyakov> You would have to redraw parts of the landscape as the "people" moved.
<Smerdyakov> OpenGL is a very low level interface.
<mrvn> keep a copy of the bare landscape.
<Smerdyakov> It has no concept of "objects," just "pixels."
<mrvn> Luckily populous has very few polygons to draw. Should be fine even with software I guess.
<vincenz> euhm..
<Smerdyakov> mrvn, do you know anyone without a 3D graphics card?
* Demitar raises a paw.
* senko too
<mrvn> Smerdyakov: Yes. Me. No accelerated 3D driver for amd64 for ATI cards.
* Smerdyakov gives out a shout-out to Demitar, senko, mrvn, and their peeps in Somalia!
Godeke has quit ["Leaving"]
<Demitar> Smerdyakov, the truth is: laptop and no good drivers.
<vincenz> opengl has objects
<vincenz> you can have callists
<mrvn> Nowadays it is more a problem of the driver than 3D hardware,
<vincenz> store an object in a calllist and then in your animation, change something, call calllist
<mrvn> vincenz: But that redraws everything, right?
<Smerdyakov> vincenz, that's just like a macro. It doesn't automatically redraw the background.
<vincenz> it's more than a macro
<vincenz> cause everything is already in the opengl-memory, callists are quite performant (and hence perfect for animation)
<vincenz> as for redrawing the background, just have a callist for the background
<mrvn> vincenz: That still readraws
<vincenz> opengl ALWAYS redraws
<vincenz> afaik
<vincenz> but it's done in hardware
<mrvn> If I do it in software I first render the landscape and store that. Then I add the animations on each frame.
<mrvn> No point rerendering the landscape all the time.
<vincenz> ...
<vincenz> there's not much to it, you've defined your textures and polygons
<mrvn> I guess I just have to try it with software GL and see if it is too slow.
<vincenz> and the rest is done in hardware, that's how opengl always does it
<vincenz> it's just drawing a bunch of polygons
<vincenz> well...triangles
<mrvn> vincenz: As I said above: Has to work without hardware.
<vincenz> well then make one BIG texture and one BIG polygon
<vincenz> and use doublebuffering
<mrvn> Does openGL support rendering into a texture?
<vincenz> i believe so
<mrvn> How does that work in hardware? Does it read out the graphics cards memory?
<vincenz> yes
<mrvn> Or can you render into a texture and use it buit not read it?
<vincenz> and copies it into it's texture memory
<vincenz> I noticed that labltk includes lablgl, is the same true for lablgtk2?
<mrvn> vincenz: Under debian lablgl is a seperate package.
<vincenz> alrightio, thnx
<mrvn> It says it has lablgtk bindings but nothing about lablgtk2
<vincenz> what's togl?
<karryall> mrvn: it works with lablgtk2 too
<mrvn> karryall: great
<karryall> lablgtk2 is just lablgtk for GTK 2
<vincenz> makefile only mentions labltk, no lablgtk
<karryall> vincenz: togl is a tk widget with GL
<vincenz> but only for labltk, not lablgtk?
<karryall> for lablgtk tou need a gtk library called GtkGLArea
<karryall> and then lablgtk has support for this library (widget actually)
<vincenz> thnx
<karryall> Mind that GtkGLArea is more or less unmaintained IIRC
<vincenz> ok
<vincenz> I'll make lib and glut
<mrvn> Maybe I should do it the old fashioned 2D way and just blit the tile images together.
<mrvn> It realy is too bad the Graphics module doesn't tell me what mouse button was pressed. If it did it would have all required features.
<mrvn> Does lablgl work under windows?
<mrvn> (not that I would care much)
<mrvn> Has anyone tried the map thingy I pasted?
<mrvn> I think the Graphics module interferes with Unix.sleep.
wegzz is now known as vezenchio
<karryall> you could use SDL too
<karryall> it's pretty good at blitting
<vincenz> hmm
<vincenz> it seems that I have glut installed at work
<vincenz> but not glut.h
<Smerdyakov> In Debian terms, that would probably mean something like libglut but not libglut-dev package installed.
<vincenz> yeah but I don't have access to that
<vincenz> [poucetc@pc1822:lablgl-1.01]$ rpmquery glut
<vincenz> glut-3.7-12
<vincenz> maybe I can install it locally
karryall has quit ["go!"]
<vincenz> how do I install a package locally?
<vincenz> damn
<vincenz> error: package glut-devel is not relocateable
* vincenz sighs
<vincenz> Error on dynamically loaded library: /scratch/lib/ocaml/stublibs/dlltogl.so: undefined symbol: Tcl_EventuallyFree
<vincenz> to bad that you can't display-forward opengl stuff
<vincenz> s/to/too
SmerdyOffice has joined #ocaml
menace has joined #ocaml
gim_ has joined #ocaml
gim has quit [Read error: 60 (Operation timed out)]
gim_ is now known as gim
<mflux> hmh, I think you can with sufficiently proficient x-library and x-server?
<SmerdyOffice> What does it mean for a library to be proficient?
<mflux> can do its job well, covering the specification and extensions?
<mflux> I think GLX can be transported over network
<mflux> and some x-servers actually support that
<SmerdyOffice> Native English speakers generally only use "proficient" to refer to intelligent beings.
<mflux> well, thanks for the information. however that pair of words just sounded so nice ;)
pango has quit ["Leaving"]
pango has joined #ocaml
pacroon has quit [Read error: 60 (Operation timed out)]
blugleblogle has quit [Remote closed the connection]
SmerdyOffice has quit ["Leaving"]
pacroon has joined #ocaml
gim_ has joined #ocaml
gim has quit [Read error: 110 (Connection timed out)]
gim_ is now known as gim
Faust has joined #ocaml
Submarine has joined #ocaml
cmeme has quit [Read error: 104 (Connection reset by peer)]
Submarine has quit [Read error: 104 (Connection reset by peer)]
neale has joined #ocaml
<neale> I don't suppose anyone on here has written an IRC library in Ocaml...
<smimou> yes I have :)
Faust has quit [Read error: 110 (Connection timed out)]
<neale> ah, excellent, are they freely available? I was going to start to port over my Python module, but perhaps there's no need.
<neale> oh, you'r samuel mimram
<neale> I was just reading aboun savonet :)
<smimou> hehe
mrsolo has joined #ocaml
<neale> smimou: this looks excellent. I'll try to use irc.ml as a base for my infobot.
<smimou> neale: you can find that here http://perso.ens-lyon.fr/samuel.mimram/
<smimou> and if you've got some comments / complaints / patchs, feel free to send that to me
<neale> smimou: is the ens-lyon version newer than sourceforge CVS?
<smimou> yes it is
<neale> ah, le voila.
<neale> haha filter_stupid_mirc_color_code
<Demitar> Such functions are the signs of a good irc library...
<neale> or at least a programmer with a sense of humor
Submarine has joined #ocaml
cmeme has joined #ocaml
gim has quit [Read error: 113 (No route to host)]
gim has joined #ocaml
vezenchio has quit ["smile, Rakka ..."]
vincenz has quit [Read error: 104 (Connection reset by peer)]
vincenz has joined #ocaml
gim has quit [Read error: 113 (No route to host)]
gim has joined #ocaml
Excedrin has quit [Read error: 104 (Connection reset by peer)]
Excedrin has joined #ocaml
CosmicRay has joined #ocaml
mlh has joined #ocaml
CosmicRay has quit ["Client exiting"]
gim has quit [Read error: 113 (No route to host)]
gim has joined #ocaml
smimou has quit ["?"]
tyler has joined #ocaml
<tyler> How would I cons onto a list ref?
<tyler> or, to be more general, what is the best way to collect string values of anonymous options using Arg.parse?
<mellum> r := x :: !r
<tyler> thanks
mlh has quit [Client Quit]
<tyler> Arg is cool ;)
mlh has joined #ocaml
<tyler> way easier than screwing about with getopt or something like that...
gim has quit [Connection timed out]
gim has joined #ocaml
tyler has quit ["Leaving"]