comp.lang.ada
 help / color / mirror / Atom feed
* OpenGl in ADA
@ 2000-04-27  0:00 Anderson
  2000-04-27  0:00 ` Pascal Obry
  0 siblings, 1 reply; 44+ messages in thread
From: Anderson @ 2000-04-27  0:00 UTC (permalink / raw)


Has anyone here used OpenGL with ADA. I have used it in VB, but in ada I do
not know how to open the context window. Can anyone show me the basic start
up for opengl in ada 95 (GNAT). I have the Glut.ads and Gl.ads.






^ permalink raw reply	[flat|nested] 44+ messages in thread
* Opengl in Ada
@ 2009-10-28 17:12 Pablo
  2009-10-28 18:01 ` Pascal Obry
  2009-10-29  6:11 ` Gautier write-only
  0 siblings, 2 replies; 44+ messages in thread
From: Pablo @ 2009-10-28 17:12 UTC (permalink / raw)


Does someone know any tutorial of opengl in Ada? I found thousands
opengl tutorials, but none for Ada...



^ permalink raw reply	[flat|nested] 44+ messages in thread
* OpenGL in Ada
@ 2010-07-08  2:42 Shark8
  2010-07-08 14:15 ` John B. Matthews
                   ` (3 more replies)
  0 siblings, 4 replies; 44+ messages in thread
From: Shark8 @ 2010-07-08  2:42 UTC (permalink / raw)


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?



^ permalink raw reply	[flat|nested] 44+ messages in thread
* OpenGL in Ada
@ 2010-10-05 21:23 Yves Bailly
  2010-10-06  3:45 ` anon
                   ` (2 more replies)
  0 siblings, 3 replies; 44+ messages in thread
From: Yves Bailly @ 2010-10-05 21:23 UTC (permalink / raw)


Greetings to everyone in this group,

This is my very first posting, so please apologize if I do something
really wrong (as well as for my english, it's not my native language).

I have created a small program which generates a pair of files, namely
"gl.ads" and "gl.adb", to use OpenGL from Ada. The files are generated
by reading the official OpenGL specifications files (namely
"enum.spec", "gl.spec" and "gl.tm") which can be found from the
official OpenGL page http://www.opengl.org/registry/ (no GLU nor GLUT
though).

The OpenGL subprograms are named according to the usual C naming
scheme ("glBegin", "glVertex3d" and so on), so the result looks more
like C than like Ada, but at least it allows to read tutorials more
easily (as most of them are based on C). So the generated binding is
rather low-level (I think "thin binding" is the appropriate wording).

The subprograms are not imported using "pragma Import", but rather
declared as access to subprograms (procedures or functions). The
access are then resolved in a lenghty "Init_GL" procedure, which
relies on the "glGetProcAddress" function imported from SDL. So the
generated binding requires SDL to work.

I'm far from being an Ada expert. I would really appreciate if someone
interested in using OpenGL with Ada would accept to spend some time:
- to point me to the horrible things I probably wrote in this program;
- to tell if the generated binding is of good or bad quality.

Thanks for your time and best regards,

-- Yves Bailly
yves.bailly@gmail.com



^ permalink raw reply	[flat|nested] 44+ messages in thread

end of thread, other threads:[~2015-01-30 18:41 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-04-27  0:00 OpenGl in ADA Anderson
2000-04-27  0:00 ` Pascal Obry
  -- strict thread matches above, loose matches on Subject: below --
2009-10-28 17:12 Opengl in Ada Pablo
2009-10-28 18:01 ` Pascal Obry
2009-10-28 19:04   ` John B. Matthews
2009-10-29  6:11 ` Gautier write-only
2010-07-08  2:42 OpenGL " Shark8
2010-07-08 14:15 ` John B. Matthews
2010-07-09  2:18   ` anon
2010-07-12 16:51   ` Warren
2010-07-13 12:26     ` Ludovic Brenta
2010-07-13 13:13       ` Warren
2010-07-09 11:43 ` Gautier write-only
2010-07-09 15:11 ` Gene
2010-07-09 17:38   ` Shark8
2010-07-09 20:54     ` Gene
2010-07-12 17:04       ` Warren
2010-07-10  4:00     ` BrianG
2010-07-10 11:47       ` Gautier write-only
2010-07-11  2:45         ` BrianG
2010-07-11  4:10           ` Gautier write-only
2010-07-11  5:30       ` tmoran
2010-07-11 20:46         ` anon
2010-07-12 14:17           ` Shark8
2010-07-13  0:45             ` BrianG
2010-07-13 17:50               ` anon
2010-07-13 18:37                 ` Shark8
2015-01-30 14:45 ` Lucretia
2015-01-30 18:41   ` David Botton
2010-10-05 21:23 Yves Bailly
2010-10-06  3:45 ` anon
2010-10-06  5:10   ` Yves Bailly
2010-10-06  9:51     ` Alex R. Mosteo
2010-10-06 10:38       ` Yves Bailly
2010-10-06 10:59         ` Ludovic Brenta
2010-10-06 16:07           ` Pascal Obry
2010-10-06 17:32             ` Yves Bailly
2010-10-06  8:38 ` Gautier write-only
2010-10-07  1:52   ` BrianG
2010-10-07 22:06     ` Yves Bailly
2010-10-08 17:11     ` Shark8
2010-10-08 15:02 ` Lucretia
2010-10-08 20:42   ` Yves Bailly
2010-10-10 19:49     ` Vadim Godunko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox