From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p42GnIqk026775 for ; Mon, 2 May 2011 18:49:18 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AiUCABXgvk1KfVI0imdsb2JhbACmFggUAQEBCgkNBxIGIaYqinyCKoQpNIheAQEDBoV6BI55hSeFEzuDLw X-IronPort-AV: E=Sophos;i="4.64,303,1301868000"; d="scan'208";a="82184137" Received: from mail-ww0-f52.google.com ([74.125.82.52]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-MD5; 02 May 2011 18:48:53 +0200 Received: by wwe15 with SMTP id 15so7742509wwe.9 for ; Mon, 02 May 2011 09:48:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:subject:date:user-agent:references :in-reply-to:mime-version:message-id:cc:x-face:content-type :content-transfer-encoding; bh=RO3WsoVrt4UxTnNld3idW+VEFnu2Z9nP4LGhVoulLzs=; b=Nzl9lpw/cUfOEB3cwZKOzPua9NZnWJhazkar6lzoTlcG6xyCJSwLdlgmGmr9XYHJiK hJLHUzo2G17X6Zghkw8LfJXHDS5eNWYF+K+sXTRU2eOBdt8REgEVAvcOtxoaV2ib9Mk7 NplpOSjv8X41AXPAp8/LUBmXEBMVcWm8iHQBg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:user-agent:references:in-reply-to:mime-version :message-id:cc:x-face:content-type:content-transfer-encoding; b=oE20zSoT1nReubF3xGQagY8N2+aobWSpGUuFBXokfwbRvr5Xbb14P9atcvL/OZ8TYs XUOzv/NUXBT9HQNLZkNB96id4DA1pl19S2B8QX11j2fWScOzIVgf5vbkjeRN5bogy9we BP3ndEWrnJpb5CdF78vl0wtYFi/cYEV05qPkg= Received: by 10.216.209.212 with SMTP id s62mr5251182weo.67.1304354932740; Mon, 02 May 2011 09:48:52 -0700 (PDT) Received: from localhost.localnet (pat35-5-78-226-58-147.fbx.proxad.net [78.226.58.147]) by mx.google.com with ESMTPS id z50sm2765877weq.23.2011.05.02.09.48.50 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 02 May 2011 09:48:51 -0700 (PDT) From: Florent Monnier To: caml-list@inria.fr Date: Mon, 2 May 2011 18:48:45 +0200 User-Agent: KMail/1.13.5 (Linux/2.6.33.7-desktop586-2mnb; KDE/4.4.5; i686; ; ) References: <85360856-DA1E-48C8-B449-BD03EAA4F154@math.nagoya-u.ac.jp> In-Reply-To: <85360856-DA1E-48C8-B449-BD03EAA4F154@math.nagoya-u.ac.jp> MIME-Version: 1.0 Message-Id: <201105021848.45284.monnier.florent@gmail.com> Cc: Jacques Garrigue X-Face: -0"dKXwF0PiXr]fa$^)NJY7$;waqUckGcM7&q,VU?Xv\[=CiVM]g]pDs^xmfU9+Q=Z,OdfMHUR-7Ao%evJh.=aiq,#r0Ux0dm'!l|zeAXj||$>1_(Lv4Hc",&F}sbHeK0`SBA$_|XP Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id p42GnIqk026775 X-Validation-by: monnier.florent@gmail.com Subject: Re: [Caml-list] Pros and cons of different GL bindings ? Le jeudi 28 avril 2011 02:32:06, Jacques Garrigue a écrit : > On 2011/04/28, at 1:24, Anthony Tavener wrote: > > Ethan's summary is good. I'll elaborate a bit on glcaml... > > > > I use glcaml, but don't recommend it in general. There are two reasons I > > chose it: 1. It looks like OpenGL, so my familiarity with it directly > > translates... the only differences are lowecase GL constants and no > > parentheses around arguments. 2. It (kind-of) supports features like > > shaders. > > > > What I mean by "kind-of" is that the bindings are broken for a lot of > > lesser-used features. I've been maintaining my own modifications to > > support features I need (same with sdlcaml)... though I recently decided > > I should follow OpenGL 4 (basically the same as OpenGL ES 2), which > > strips the interface down to a minimal set heavily reliant on shaders. > > This is turning into "yet another set of bindings". > > > > I know I tried glMLite... but can't remember what problems I encountered, > > and I did encounter problems which led me to settle on glcaml. > > > > Also, there is one other binding I know, by Jeffrey Scofield, for OpenGL > > ES 1, and he uses this for iPhone development: > > http://psellos.com/ocaml/lablgles-build.html > > > > > > Summary: > > > > If you don't need shaders: LablGL > > > > If you want to do OpenGL ES 1.x (mobile device, for example): LablGLES > > > > If you need shaders: glcaml or glMLite > > Actually, LablGL has some shader support, provided by Florent Monnier. > It has been in CVS for more than a year (file src/glShader.ml), but somehow > I never came around to make a new release. > I'm really sorry for the inconvenience. > > If some people could test this code, this would be most helpful, and I > could make a release in a few weeks. > > Jacques Garrigue I take the opportunity of this thread to ask to the users what they would prefer about this module (GlShader). This is about all the functions which has a "count" parameter in the OCaml interface (and which wrap a C function which ends with the letter "v" for vertex probably) http://camlcvs.inria.fr/cgi-bin/cvsweb/bazar- ocaml/lablGL/src/glShader.ml?rev=1.1;content-type=text%2Fx-cvsweb-markup http://camlcvs.inria.fr/cgi-bin/cvsweb/bazar- ocaml/lablGL/src/ml_shader.c?rev=1.1;content-type=text%2Fx-cvsweb-markup The array data are currently provided to these functions in a *flatten* way, and the question is maybe the users would prefer a more high-level interface? A more high-level way would be an array of array or an array of tuples. An array of tuples would be the safer but would probably not be the more easy to manipulate, while a tuple is immutable. An array of array would need to check the size of every sub-array. With these two alternatives, the "count" parameter would not be needed anymore. Please tell us what you would prefer. ___ doc for glUniform* and glUniformMatrix* : http://www.opengl.org/sdk/docs/man/xhtml/glUniform.xml ___ external uniform4fv: location:int -> count:int -> value:float array -> unit = "ml_gluniform4fv" CAMLprim value ml_gluniform4fv( value location, value ml_count, value vars ) { int count = Int_val(ml_count); int i, len = Wosize_val(vars) / Double_wosize; GLfloat val[len]; if (len != (4 * count)) caml_failwith("GlShader.uniform4fv: the array size should be a multiple of 4"); for (i=0; i count:int -> transpose:bool -> value:float array -> unit = "ml_gluniformmatrix4x3fv" CAMLprim value ml_gluniformmatrix4x3f( value location, value transpose, value mat ) { GLfloat val[12]; int i, len; len = Wosize_val(mat) / Double_wosize; if (len != 12) caml_failwith("GlShader.uniform_matrix4x3f: array should contain 12 floats"); for (i=0; i<12; i++) { val[i] = Double_field(mat, i); } LOAD_FUNC(glUniformMatrix4x3fv, PFNGLUNIFORMMATRIX4X3FVPROC) glUniformMatrix4x3fv( Int_val(location), 1, Bool_val(transpose), val ); return Val_unit; }