From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,5b7ee26df9f9c357 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder.news-service.com!feeder.news-service.com!85.214.198.2.MISMATCH!eternal-september.org!.POSTED!not-for-mail From: BrianG Newsgroups: comp.lang.ada Subject: Re: OpenGL in Ada Date: Mon, 12 Jul 2010 20:45:42 -0400 Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 13 Jul 2010 00:42:17 +0000 (UTC) Injection-Info: mx01.eternal-september.org; posting-host="vvBPJT09arwmd97Fw4UIhw"; logging-data="7547"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18CrO3Slgz3UQ4ObHAaUzNo" User-Agent: Thunderbird 2.0.0.24 (X11/20100317) In-Reply-To: Cancel-Lock: sha1:2jEsdP2qKt42MiWkAauSjhlxEG0= Xref: g2news1.google.com comp.lang.ada:12361 Date: 2010-07-12T20:45:42-04:00 List-Id: Shark8 wrote: > On Jul 11, 2:46 pm, a...@att.net wrote: >> In , tmo...@acm.org writes: >>>>>>> Procedure Color ( red, green, blue : in double ); >>>>>>> Procedure Color ( red, green, blue : in float ); >>>> One problem you'll have is if a user wants to make a call with all >>>> literals, i.e. Color(1, 2, 3) or Color(1.0, 2.0, 3.0), the compiler >>>> won't know which version to use. The best solution I've found (besides >>>> making users specify a type) >>> And what's wrong with requiring the user to be unambiguous by specifying >>> a type? It's unlikely there will be a lot of calls with all literals >>> (unless generated by some program) so it shouldn't be onerous. And >>> "Float'(1.0)" is clearer to the person reading the code five years >> >from now than "Color_F". >> >> What your are forgetting is the openGL is a specification from the openGL >> group ( opengl.org ), it is just like the Ada RM in that respect. For a >> program or package, to be classified as openGL it must comply with "openGL >> group" openGL specification. Changing any API part nullify the use of >> openGL in any part of your system. I'm sorry, I wasn't aware we had a member of the OpenGL police present. Where do I go to pay my fine? BTW, it appears the proper name is OpenGL, not openGL :-). Not that I'm picky. Maybe you ('Anon') ought to actually read the spec you mentioned. The following is a direct quote from that document: "The declarations shown in this document apply to ANSI C. Languages such as C++ and Ada that allow passing of argument type information admit simpler declarations and fewer entry points." (with reference to the GLxxxTypeInterface naming convention.) [http://www.opengl.org/registry/doc/glspec40.core.20100311.pdf] >> >> So, adding or altering any definitions about the given API must comply with >> the openGL specification. Names of the API functions and procedures with >> the API defined types are set by this openGL group. > > That seems, on its face, to contradict BrianG's claim: > >> What you have is a way to do it, but that's not what the OP posted. He had >> all procedures named Color, so the user doesn't need to worry about >> implementation. (If I use Color for Double and want to change my program to >> use Float, I have to change the names of all calls, even if I use calls where >> the compiler could determine what I want - and not just calls to Color, many >> routines would have the same issue.) This is also what the OpenGL >> documentation implies should be done in a language like Ada. > > But, if he's correct in this earlier post: >> (I've tried starting a similar effort, but never got very far. I was using >> the OpenGL "red book" as a basis; I find it interesting that the OpenGL >> definition recognizes that "some languages like Ada and C++" could implement >> names this way, but every Ada library I've seen follows the C naming scheme.) > > Then my renaming (to get rid of the gl- prefix and parameter-type- > postfix) and > overloading them all is a valid OpenGL API. > Not only is it valid, it looks like it's what was expected. I've never seen an implementation that does that. >> visitwww.opengl.org >> for more information on openGL and the "openGL group" >> >> Also, you may find the API specifications predefined with examples in C that >> you can alter to Ada there as well. > What I've been using is the online v1.1 "Redbook" [http://www.glprogramming.com/red/] - since ObjectAda (from Barnes' book) uses that version (last I looked, GNAT/GTKAda didn't provide OpenGL on windows). I've never tried figuring out OpenGL versions - right now the "current edition of the Redbook" is version 2.1, but the same page points to a "Specification Version 4.0". Whatever.