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,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!k39g2000yqd.googlegroups.com!not-for-mail From: Shark8 Newsgroups: comp.lang.ada Subject: OpenGL in Ada Date: Wed, 7 Jul 2010 19:42:13 -0700 (PDT) Organization: http://groups.google.com Message-ID: <68dd0333-f502-4351-9e50-4ec83bddc44e@k39g2000yqd.googlegroups.com> NNTP-Posting-Host: 174.28.205.195 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1278556933 3756 127.0.0.1 (8 Jul 2010 02:42:13 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 8 Jul 2010 02:42:13 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: k39g2000yqd.googlegroups.com; posting-host=174.28.205.195; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.10) Gecko/20100504 Firefox/3.5.10 ( .NET CLR 3.5.30729; .NET CLR 4.0.20506),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:12260 Date: 2010-07-07T19:42:13-07:00 List-Id: Hello everyone, I posted about wanting to write an OS in Ada a while ago and, as part of that effort I've taken to translating the OpenGL API. No, I don't mean JUST running the headers through ato-Ada converter but actually translating the API into a more Ada-natural form. As an example, here is the glColor-'family' of functions: * WINGDIAPI void APIENTRY glColor3b (GLbyte red, GLbyte green, GLbyte blue); * WINGDIAPI void APIENTRY glColor3bv (const GLbyte *v); * WINGDIAPI void APIENTRY glColor3d (GLdouble red, GLdouble green, GLdouble blue); * WINGDIAPI void APIENTRY glColor3dv (const GLdouble *v); * WINGDIAPI void APIENTRY glColor3f (GLfloat red, GLfloat green, GLfloat blue); * WINGDIAPI void APIENTRY glColor3fv (const GLfloat *v); * WINGDIAPI void APIENTRY glColor3i (GLint red, GLint green, GLint blue); * WINGDIAPI void APIENTRY glColor3iv (const GLint *v); * WINGDIAPI void APIENTRY glColor3s (GLshort red, GLshort green, GLshort blue); * WINGDIAPI void APIENTRY glColor3sv (const GLshort *v); * WINGDIAPI void APIENTRY glColor3ub (GLubyte red, GLubyte green, GLubyte blue); * WINGDIAPI void APIENTRY glColor3ubv (const GLubyte *v); * WINGDIAPI void APIENTRY glColor3ui (GLuint red, GLuint green, GLuint blue); * WINGDIAPI void APIENTRY glColor3uiv (const GLuint *v); * WINGDIAPI void APIENTRY glColor3us (GLushort red, GLushort green, GLushort blue); * WINGDIAPI void APIENTRY glColor3usv (const GLushort *v); * WINGDIAPI void APIENTRY glColor4b (GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha); * WINGDIAPI void APIENTRY glColor4bv (const GLbyte *v); * WINGDIAPI void APIENTRY glColor4d (GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha); * WINGDIAPI void APIENTRY glColor4dv (const GLdouble *v); * WINGDIAPI void APIENTRY glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); * WINGDIAPI void APIENTRY glColor4fv (const GLfloat *v); * WINGDIAPI void APIENTRY glColor4i (GLint red, GLint green, GLint blue, GLint alpha); * WINGDIAPI void APIENTRY glColor4iv (const GLint *v); * WINGDIAPI void APIENTRY glColor4s (GLshort red, GLshort green, GLshort blue, GLshort alpha); * WINGDIAPI void APIENTRY glColor4sv (const GLshort *v); * WINGDIAPI void APIENTRY glColor4ub (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); * WINGDIAPI void APIENTRY glColor4ubv (const GLubyte *v); * WINGDIAPI void APIENTRY glColor4ui (GLuint red, GLuint green, GLuint blue, GLuint alpha); * WINGDIAPI void APIENTRY glColor4uiv (const GLuint *v); * WINGDIAPI void APIENTRY glColor4us (GLushort red, GLushort green, GLushort blue, GLushort alpha); * WINGDIAPI void APIENTRY glColor4usv (const GLushort *v); which was rewritten as: -- Color Formats Procedure Color ( red, green, blue : in Byte ); Procedure Color ( v : RGB_Byte_Vector ); Procedure Color ( red, green, blue : in double ); Procedure Color ( v : RGB_Double_Vector ); Procedure Color ( red, green, blue : in float ); Procedure Color ( V : RGB_Float_Vector ); Procedure Color ( red, green, blue : int ); Procedure Color ( V : RGB_Integer_Vector ); Procedure Color ( red, green, blue : Short ); Procedure Color ( V : RGB_Short_Vector ); Procedure Color ( red, green, blue : Unsigned_Byte ); Procedure Color ( v : RGB_Unsigned_Byte_Vector ); Procedure Color ( red, green, blue : in Unsigned_Integer ); Procedure Color ( v : RGB_Unsigned_Integer_Vector ); Procedure Color ( red, green, blue : in Unsigned_Short ); Procedure Color ( v : RGB_Unsigned_Short_Vector ); Procedure Color ( red, green, blue, alpha : in byte ); Procedure Color ( v: RGBA_Byte_Vector ); Procedure Color ( red, green, blue, alpha : in double ); Procedure Color ( v : RGBA_Double_Vector ); Procedure Color ( red, green, blue, alpha : in float ); Procedure Color ( v: RGBA_Float_Vector ); Procedure Color ( red, green, blue, alpha : in int ); Procedure Color ( v: RGBA_Integer_Vector ); Procedure Color ( red, green, blue, alpha : in short ); Procedure Color ( v: RGBA_Short_Vector ); Procedure Color ( red, green, blue, alpha : in Unsigned_Byte ); Procedure Color ( v: RGBA_Unsigned_Byte_Vector ); Procedure Color ( red, green, blue, alpha : in Unsigned_Integer ); Procedure Color ( v: RGBA_Unsigned_Integer_Vector ); Procedure Color ( red, green, blue, alpha : in Unsigned_Short ); Procedure Color ( v: RGBA_Unsigned_Short_Vector ); where X_Y_Vector is an array of elements of type Y and indexed on type X. Another thing that I've done is, to the best of my ability, used Ada's strong typing to make passing invalid parameters less of a problem; for example: Type Begin_Mode_Type is ( POINTS, LINES, LINE_LOOP, LINE_STRIP, TRIANGLES, TRIANGLE_STRIP, TRIANGLE_FAN, QUADS, QUAD_STRIP, POLYGON ); For Begin_Mode_Type use ( POINTS => GL_POINTS, LINES => GL_LINES, LINE_LOOP => GL_LINE_LOOP, LINE_STRIP => GL_LINE_STRIP, TRIANGLES => GL_TRIANGLES, TRIANGLE_STRIP => GL_TRIANGLE_STRIP, TRIANGLE_FAN => GL_TRIANGLE_FAN, QUADS => GL_QUADS, QUAD_STRIP => GL_QUAD_STRIP, POLYGON => GL_POLYGON ); is a type for the glBegin-wrapper which only allows the passing of valid "mode"-parameters. {That is, range points..polygon.} My questions are these: Would anyone, other than myself, find such a translation of interest? and When I finish, would anyone want to test it out?