let main () =
	try
			if (Glfw.init () = 0) then failwith "init failed";
			let dtmode = Glfw.get_desktop_mode () in
				Printf.printf "Desktop mode: %d x %d x %d\n"  dtmode.Glfw.vidmode_width dtmode.Glfw.vidmode_height (dtmode.Glfw.vidmode_red_bits + dtmode.Glfw.vidmode_blue_bits + dtmode.Glfw.vidmode_green_bits);
			let max_num_modes = 1024 in
				let modecount,modes = Glfw.get_video_modes (max_num_modes) in
					Printf.printf "Available modes:\n";
					for i = 0 to (modecount - 1)	do
						let colourbits = modes.(i).Glfw.vidmode_red_bits + modes.(i).Glfw.vidmode_green_bits + modes.(i).Glfw.vidmode_blue_bits in
	        				Printf.printf "%3d %d x %d x %d\n" (i+1) modes.(i).Glfw.vidmode_width modes.(i).Glfw.vidmode_height  colourbits;
	                done;	
			Glfw.terminate();
	with
		Failure s -> Printf.printf "Failure: %s\n" s
;;		

main () 		


