Date: Sat, 29 Nov 2003 12:37:54 +0100 To: lablgtk at kaba.or.jp, Jacques Garrigue Cc: 218823 at bugs.debian.org, control at bugs.debian.org Subject: lablgl and runtime vs compile time GL version detection. Message-ID: <20031129113754.GA3375 at iliana> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline From: Sven Luther reassign 218823 lablgl thanks Hello, I have got a bug report against lablgl (well, against lablgtk2, but the problem is pulled in by lablgl). Advice from Michael Daenzer, from the DRI project, was : |> I suppose that glMultTransposeMatrixd is a new symbol of GL 1.3 it |> seems (formely known as glMultTransposeMatrixdARB i hear). Anyway, |> i have code of the kind : |> |> #ifdef GL_VERSION_1_3 |> ML_1 (glMultTransposeMatrixd, Double_raw) |> #else |> CAMLprim void ml_glMultTransposeMatrixd (value raw) |> { |> ml_raise_gl ("Function: glMultTransposeMatrixd not available"); |> } |> #endif |> |> Where naturally GL_VERSION_1_3 and GL_VERSION_1_4 and so on come from |> the OpenGL headers, i think. | |You should probably post about this to an OpenGL related mailing list, |but AFAIK compile-time checks aren't adequate for something like this. | |> Naturally, these are present on my system (and when using the non |> XFree86 mesa packages too, but then you loose acceleration, no ?) | |The only thing that limits the available OpenGL functionality is the |library used at runtime, so long as everything conforms to the ABI. So, if i understood this right, the checking for OpenGL versions should be done at runtime and not at compile time. I am not sure about the exact syntax of that, but i guess there is an OpenGL function which enables you to check for either the presence of an extension and/or the version of GL used. Ideally, the above code (and all the one like it) should be changed to something like : CAMLprim void ml_glMultTransposeMatrixd (value raw) { if () glMultTransposeMatrixd(); else if () glMultTransposeMatrixdARB(); else ml_raise_gl ("Function: glMultTransposeMatrixd not available"); } Sure, it does uglify the code a lot, but it is, i think, the only way to solve this problem in a sane way, without needing to build one version of the lablgl package for every opengl library out there the user will want to use, especially when linking in -custom mode, and thus including the stublibs statically. Friendly, Sven Luther