[SCM] Lisaac library opengl-binding branch, master, updated. 9a65c25f45c3200d7a0c546bc1b3ac0a802c6280
Damien Bouvarel
dams.bouvarel at wanadoo.fr
Wed Aug 26 23:46:31 UTC 2009
The following commit has been merged in the master branch:
commit 0d50b7c17c35c536cec47ed61f52a9cd90444b09
Author: Damien Bouvarel <dams.bouvarel at wanadoo.fr>
Date: Mon Aug 24 08:33:50 2009 +0200
add new files
diff --git a/3D/camera.li b/3D/camera.li
new file mode 100644
index 0000000..8ace876
--- /dev/null
+++ b/3D/camera.li
@@ -0,0 +1,206 @@
+///////////////////////////////////////////////////////////////////////////////
+// Application //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := CAMERA;
+
+ - comment := "handle view (based on gluLookAt())";
+
+Section Inherit
+
+ - parent_framework:FRAMEWORK := FRAMEWORK;
+
+Section Public
+
+ // position in 3d world
+ + position:VECTOR3[REAL_32];
+
+ // camera's view vector
+ + view:VECTOR3[REAL_32];
+
+ // camera's up vector (orthonormal with view & right)
+ + up:VECTOR3[REAL_32];
+
+ // camera's up vector (orthonormal with view & up)
+ + right:VECTOR3[REAL_32];
+
+
+ // speed coeff
+ - kspeed:REAL_32 := 50;
+
+
+ - create_from (p,v,u,r:VECTOR3[REAL_32]) :SELF <-
+ ( + result:SELF;
+ result := SELF.clone;
+ result.make (p,v,u,r);
+ result
+ );
+
+ - create_position (p:VECTOR3[REAL_32]) :SELF <-
+ ( + result:SELF;
+ result := SELF.clone;
+ result.make (p, VECTOR3[REAL_32].create (0.0,-1.0,1.0),VECTOR3[REAL_32].create (0.0,1.0,0.0),VECTOR3[REAL_32].create (1.0,0.0,0.0));
+ result
+ );
+
+ - create_position p:VECTOR3[REAL_32] looking_at target:VECTOR3[REAL_32] :SELF <-
+ ( + result:SELF;
+ result := SELF.clone;
+ result.make (p, (target - p).normalized, VECTOR3[REAL_32].create (0.0,1.0,0.0),VECTOR3[REAL_32].create (1.0,0.0,0.0));
+ result
+ );
+
+ - create :SELF <-
+ // default camera
+ ( + result:SELF;
+ result := SELF.clone;
+ result.make (VECTOR3[REAL_32].create (0.0,1.0,-1.0), VECTOR3[REAL_32].create (0.0,-1.0,1.0),VECTOR3[REAL_32].create (0.0,1.0,0.0),VECTOR3[REAL_32].create (1.0,0.0,0.0));
+ result
+ );
+
+ - make (p,v,u,r:VECTOR3[REAL_32]) <-
+ (
+ position := p;
+ view := v;
+ up := u;
+ right := r;
+ );
+
+ - set_position p:VECTOR3[REAL_32] <-
+ (
+ position := p;
+ );
+
+ - set_view v:VECTOR3[REAL_32] <-
+ (
+ view := v;
+ );
+
+ - set_up u:VECTOR3[REAL_32] <-
+ (
+ up := u;
+ );
+
+ - set_right u:VECTOR3[REAL_32] <-
+ (
+ right := u;
+ );
+
+ - look <-
+ (
+ + px,py,pz,vx,vy,vz,ux,uy,uz:REAL_32;
+
+ px := position.x;
+ py := position.y;
+ pz := position.z;
+
+ vx := px + view.x;
+ vy := py + view.y;
+ vz := pz + view.z;
+
+ ux := up.x;
+ uy := up.y;
+ uz := up.z;
+
+ `gluLookAt (@px, at py, at pz, @vx, at vy, at vz, @ux, at uy, at uz)`;
+ );
+
+ - update_with_mouse <-
+ (
+ + midx, midy, mx, my:INTEGER;
+ + angle_y, angle_x:REAL_32;
+
+ midx := screen_width >> 1;
+ midy := screen_height >> 1;
+
+ (mx,my) := event.get_mouse_pos;
+
+ ((mx = midx) && {my = midy}).if_false {
+ event.warp_mouse (midx,midy); // a changer
+
+ // scaled direction the moused moved in
+ angle_y := (midx - mx).to_real / 1000.0;
+ angle_x := (midy - my).to_real / 1000.0;
+
+ rotate_y angle_y;
+ rotate_x angle_x;
+ };
+ );
+
+ - rotate_x angle:REAL_32 <-
+ (
+ view := ((view*angle.cos) + (up*angle.sin)).normalized;
+
+ up := (view.cross right) * -1;
+ );
+
+ - rotate_y angle:REAL_32 <-
+ (
+ view := ((view*angle.cos) - (right*angle.sin)).normalized;
+
+ right := view.cross up;
+ );
+
+ - rotate_z angle:REAL_32 <-
+ (
+ right := ((right*angle.cos) + (up*angle.sin)).normalized;
+
+ up := view.cross right * -1;
+ );
+
+ - move (speed:REAL_32,t:REAL_32) axis v:VECTOR3[REAL_32] <-
+ (
+ position.set_x (position.x + v.x * speed * t);
+ position.set_y (position.y + v.y * speed * t);
+ position.set_z (position.z + v.z * speed * t);
+ );
+
+ //
+ // just for testing
+ //
+ - update_with_keys time:REAL_32 <-
+ (
+ (event.keydown (KEYCODE.k_up)).if {
+ move (kspeed,time) axis view;
+ event.set_up (KEYCODE.k_up);// hack
+ };
+ (event.keydown (KEYCODE.k_down)).if {
+ move (-kspeed,time) axis view;
+ event.set_up (KEYCODE.k_down); // hack
+ };
+ (event.keydown (KEYCODE.k_left)).if {
+ move (-kspeed,time) axis right;
+ event.set_up (KEYCODE.k_left);// hack
+ };
+ (event.keydown (KEYCODE.k_right)).if {
+ move (kspeed,time) axis right;
+ event.set_up (KEYCODE.k_right); // hack
+ };
+ );
+
+ - animate t:REAL_32 <-
+ (
+ update_with_mouse;
+ update_with_keys t;
+ );
+
+
diff --git a/3D/model.li b/3D/model.li
new file mode 100644
index 0000000..0a1b916
--- /dev/null
+++ b/3D/model.li
@@ -0,0 +1,97 @@
+///////////////////////////////////////////////////////////////////////////////
+// Application //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := MODEL;
+
+ - comment := "Animated 3d model";
+
+Section Inherit
+
+ - parent_framework:FRAMEWORK := FRAMEWORK;
+
+Section Public
+
+ + name:STRING;
+
+ + texture:TEXTURE;
+ + material:MATERIAL;
+
+ + lerp:REAL_32;
+
+ + current_frame:INTEGER;
+ + old_frame:INTEGER;
+ + nb_frames:INTEGER;
+
+ - create s:ABSTRACT_STRING with tex:TEXTURE :SELF <-
+ (
+ + result:SELF;
+ result := SELF.clone;
+ result.make (s,tex);
+ result
+ );
+
+ - create s:ABSTRACT_STRING :SELF <-
+ (
+ + result:SELF;
+ result := SELF.clone;
+ result.make (s,NULL);
+ result
+ );
+
+ - make (s:ABSTRACT_STRING, tex:TEXTURE) <-
+ (
+ name := STRING.create_from_string s;
+ texture := tex;
+ load;
+ );
+
+ - set_material m:MATERIAL <-
+ (
+ material := m;
+ );
+
+ - render <-
+ (
+ deferred;
+ );
+
+ - render_with tex:TEXTURE <-
+ (
+ deferred;
+ );
+
+ - load <- deferred;
+
+ - update time:REAL_32 <-
+ (
+ lerp := lerp + time;
+ (lerp >= 1.0).if {
+ lerp := 0.0;
+ old_frame := current_frame;
+ current_frame := current_frame + 1;
+
+ (current_frame >= nb_frames).if {
+ current_frame := 0;
+ };
+ };
+ );
diff --git a/3D/models/md2_frame.li b/3D/models/md2_frame.li
new file mode 100644
index 0000000..3923223
--- /dev/null
+++ b/3D/models/md2_frame.li
@@ -0,0 +1,67 @@
+///////////////////////////////////////////////////////////////////////////////
+// Application //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := MD2_FRAME;
+
+ - comment := "Quake2' md2 model format";
+
+Section Inherit
+
+ - parent_object:OBJECT := OBJECT;
+
+
+Section Public
+
+ - fixme:VECTOR3[REAL_32] := VECTOR3[REAL_32].zero;
+
+ + name:STRING;
+
+ // frame transformation
+ + scale:VECTOR3[REAL_32] := fixme;
+ + translate:VECTOR3[REAL_32] := fixme;
+
+ + vertex:FAST_ARRAY[MD2_VERTEX];
+
+
+ - create (n:ABSTRACT_STRING, s,t:VECTOR3[REAL_32], v:FAST_ARRAY[MD2_VERTEX]) :SELF <-
+ (
+ + result:SELF;
+ result := SELF.clone;
+ result.make (n,s,t,v);
+ result
+ );
+
+ - make (n:ABSTRACT_STRING, s,t:VECTOR3[REAL_32], v:FAST_ARRAY[MD2_VERTEX]) <-
+ (
+ name := STRING.create_from_string n;
+ scale := s;
+ translate := t;
+ vertex := v;
+ );
+
+ - print <-
+ (
+ "\n-> frame ".print; name.print;
+ " sc = ".print; scale.print;
+ " tr = ".print; translate.print;
+ );
\ No newline at end of file
diff --git a/3D/models/md2_model.li b/3D/models/md2_model.li
new file mode 100644
index 0000000..36a4541
--- /dev/null
+++ b/3D/models/md2_model.li
@@ -0,0 +1,321 @@
+///////////////////////////////////////////////////////////////////////////////
+// Application //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := MD2_MODEL;
+
+ - comment := "Quake2' md2 model format";
+
+Section Inherit
+
+ + parent_model:Expanded MODEL;
+
+ - parent_md2_normals:MD2_NORMALS := MD2_NORMALS;
+
+Section Public
+
+ - md2_magic:INTEGER <- 0;
+ - md2_version:INTEGER <- 1;
+
+ - md2_skin_width:INTEGER <- 2;
+ - md2_skin_height:INTEGER <- 3;
+
+ - md2_nb_vertex:INTEGER <- 6;
+ - md2_nb_texels:INTEGER <- 7;
+ - md2_nb_triangles:INTEGER <- 8;
+ - md2_nb_frames:INTEGER <- 10;
+
+ - md2_offset_texels:INTEGER <- 12;
+ - md2_offset_tris:INTEGER <- 13;
+ - md2_offset_frames:INTEGER <- 14;
+
+
+ // texture coordinates
+ + texels:FAST_ARRAY[VECTOR2[INTEGER_16]];
+
+ // model geometry
+ + triangles:FAST_ARRAY[MD2_TRIANGLE];
+
+ // model frames for animation
+ + frames:FAST_ARRAY[MD2_FRAME];
+
+ // re-scaling model
+ + scale:REAL_32;
+
+ // frame start of each animation
+ + anim_index:FAST_ARRAY[INTEGER];
+
+ // skin texture dimensions
+ + skin_width:REAL_32;
+ + skin_height:REAL_32;
+
+ - load <-
+ (
+ + header:FAST_ARRAY[UINTEGER_32];
+ + buffer_16:FAST_ARRAY[INTEGER_16];
+ + nb_texels,nb_tris,nb_vertex:INTEGER;
+ + v:VECTOR2[INTEGER_16];
+ + t:MD2_TRIANGLE;
+ + x:INTEGER;
+
+ + e:ENTRY;
+ + file:STD_FILE;
+
+ e := FILE_SYSTEM.get_entry name;
+ (e != NULL).if {
+ file ?= e;
+ file.open;
+
+ // md2 header size = 17*4 bytes
+ header := FAST_ARRAY[UINTEGER_32].create_with_capacity 17;
+
+ (file.read header size (17) > 0).if {
+ // read header
+
+ ((header.item md2_magic != 844121161) || {header.item md2_version != 8}).if {
+ error "Bad model file";
+ };
+
+ nb_texels := header.item md2_nb_texels;
+ nb_tris := header.item md2_nb_triangles;
+ nb_frames := header.item md2_nb_frames;
+ nb_vertex := header.item md2_nb_vertex;
+
+ /* "\nNb texels: ".print;nb_texels.print;
+ "\nNb tris: ".print;nb_tris.print;
+ "\nNb verts: ".print;nb_vertex.print;
+ "\nNb frames: ".print;nb_frames.print;
+ */
+ texels := FAST_ARRAY[VECTOR2[INTEGER_16]].create_with_capacity nb_texels;
+ triangles := FAST_ARRAY[MD2_TRIANGLE].create_with_capacity nb_tris;
+
+ frames := FAST_ARRAY[MD2_FRAME].create_with_capacity nb_frames;
+
+ skin_width := header.item md2_skin_width.to_real;
+ skin_height := header.item md2_skin_height.to_real;
+
+ // coord texture
+ buffer_16 := FAST_ARRAY[INTEGER_16].create_with_capacity (nb_texels*2);
+ file.set_cursor (header.item md2_offset_texels);
+ (file.read buffer_16 size (nb_texels*2) <= 0).if {
+ error "load model: read error";
+ };
+
+ // read texels
+ x := 0;
+ {x < nb_texels*2}.while_do {
+ v := VECTOR2[INTEGER_16].create (buffer_16.item (x),buffer_16.item (x+1));
+ texels.add_last v;
+ x := x+2;
+ };
+
+ // triangles
+ buffer_16 := FAST_ARRAY[INTEGER_16].create_with_capacity (nb_tris*6);
+ file.set_cursor (header.item md2_offset_tris);
+ (file.read buffer_16 size (nb_tris*6) <= 0).if {
+ error "load model: read error";
+ };
+
+ x := 0;
+ {x < nb_tris*6}.while_do {
+ t := MD2_TRIANGLE.create (buffer_16.item x,buffer_16.item (x+1),buffer_16.item (x+2),buffer_16.item (x+3),buffer_16.item (x+4),buffer_16.item (x+5));
+ triangles.add_last t;
+
+ x := x + 6;
+ };
+
+ // frames
+ file.set_cursor (header.item md2_offset_frames);
+ 1.to nb_frames do { i:INTEGER;
+ frames.add_last (load_frame (file, nb_vertex));
+ };
+
+ scale := 3.0;
+ current_frame := 1;
+ };
+ };
+ );
+
+ - load_frame (file:STD_FILE, nb_vertex:INTEGER) :MD2_FRAME <-
+ (
+ + scale,translate:VECTOR3[REAL_32];
+ + vertex:FAST_ARRAY[MD2_VERTEX];
+ + buffer:FAST_ARRAY[REAL_32];
+ + buffer_8:FAST_ARRAY[UINTEGER_8];
+ + x,y,z:REAL_32;
+ + name:FAST_ARRAY[CHARACTER];
+ + v:MD2_VERTEX;
+ + i:INTEGER;
+
+ vertex := FAST_ARRAY[MD2_VERTEX].create_with_capacity nb_vertex;
+
+ // read transformation vectors
+ buffer := FAST_ARRAY[REAL_32].create_with_capacity 7;
+ (file.read buffer size 6 <= 0).if {
+ error "load model: read error (trans)";
+ };
+
+ x := buffer.item 0;
+ y := buffer.item 1;
+ z := buffer.item 2;
+
+ scale := VECTOR3[REAL_32].create (x,y,z);
+
+ x := buffer.item 3;
+ y := buffer.item 4;
+ z := buffer.item 5;
+
+ translate := VECTOR3[REAL_32].create (x,y,z);
+
+ // read frame name
+ name := FAST_ARRAY[CHARACTER].create_with_capacity 16;
+ (file.read name size 16 <= 0).if {
+ error "load model: read error (name)";
+ };
+
+ buffer_8 := FAST_ARRAY[UINTEGER_8].create_with_capacity (4*nb_vertex);
+ (file.read buffer_8 size (4*nb_vertex) <= 0).if {
+ error "load model: read error";
+ };
+ i := 0;
+ {i < nb_vertex*4}.while_do {
+
+ v := MD2_VERTEX.create (buffer_8.item i,buffer_8.item (i+1),buffer_8.item (i+2),buffer_8.item (i+3));
+
+ vertex.add_last v;
+ i := i + 4;
+ };
+
+ MD2_FRAME.create (CONVERT[FAST_ARRAY[CHARACTER],STRING].on (name), scale, translate, vertex)
+ );
+
+ - render_with tex:TEXTURE <-
+ (
+ texture := tex;
+ render;
+ );
+
+ - n:VERTEX := VERTEX.clone;// avoid multiple cloning
+ - n1:VERTEX := VERTEX.clone;
+ - n2:VERTEX := VERTEX.clone;
+ - v:VERTEX := VERTEX.clone;
+ - v1:VERTEX := VERTEX.clone;
+ - v2:VERTEX := VERTEX.clone;
+
+ - render <-
+ (
+ + frame1,frame2:MD2_FRAME;
+ + poly:MD2_TRIANGLE;
+ + verts1,verts2:MD2_VERTEX;
+ + vertex_index,texel_index:INTEGER_16;
+ + texel:VECTOR2[INTEGER_16];
+ //+ n,n1,n2,v,v1,v2:VERTEX;
+ + x,y,z:REAL_32;
+
+ frame1 := frames.item old_frame;
+ frame2 := frames.item current_frame;
+
+
+ (material != NULL).if {
+ material.apply (MATERIAL.mode_front);
+ };
+ (texture != NULL).if {
+ texture.bind;
+ };
+
+ renderer.vb.begin_triangles;
+
+ // draw each triangle
+ triangles.lower.to (triangles.upper) do { i:INTEGER;
+ poly := triangles.item i;
+
+ // draw each vertex of triangle
+ 0.to 2 do { k:INTEGER;
+
+ (k = 0).if {
+ (vertex_index,texel_index) := poly.index1;
+ }.elseif {k = 1} then {
+ (vertex_index,texel_index) := poly.index2;
+ } else {
+ (vertex_index,texel_index) := poly.index3;
+ };
+
+ // get current vertex from the two frames
+ verts1 := frame1.vertex.item vertex_index;
+ verts2 := frame2.vertex.item vertex_index;
+
+ // coordonnees texture
+ texel := texels.item texel_index;
+
+ renderer.vb.add_texel2f (texel.x.to_real / skin_width, texel.y.to_real / skin_height);
+
+ // normale
+ get_normal (verts1.light_index) in n1;
+ get_normal (verts2.light_index) in n2;
+
+ (x,y,z) := lerp_vertex (n1, n2) lerp lerp scale 1.0;
+
+ renderer.vb.add_normal3f (x, y, z);
+
+ // decompression des vertex (byte -> float)
+
+ x := verts1.index1 * frame1.scale.x + frame1.translate.x;
+ y := verts1.index2 * frame1.scale.y + frame1.translate.y;
+ z := verts1.index3 * frame1.scale.z + frame1.translate.z;
+
+ v1.make (x,y,z);
+
+ x := verts2.index1 * frame2.scale.x + frame2.translate.x;
+ y := verts2.index2 * frame2.scale.y + frame2.translate.y;
+ z := verts2.index3 * frame2.scale.z + frame2.translate.z;
+
+ v2.make (x,y,z);
+
+ (x,y,z) := lerp_vertex (v1, v2) lerp lerp scale scale;
+
+ renderer.vb.add_vertex3f (x,y,z);
+ };
+ };
+
+ renderer.vb.end;
+ );
+
+ - render_outlines <-
+ (
+ outlines := TRUE;
+ render;
+ outlines := FALSE;
+ );
+
+ - lerp_vertex (u,v:VERTEX) lerp t:REAL_32 scale s:REAL_32 :(REAL_32,REAL_32,REAL_32) <-
+ // linear interpolation
+ (
+ + x,y,z:REAL_32;
+
+ x := (u.x + t * (v.x - u.x)) * s;
+ y := (u.y + t * (v.y - u.y)) * s;
+ z := (u.z + t * (v.z - u.z)) * s;
+
+ (x,y,z)
+ );
+
+
\ No newline at end of file
diff --git a/3D/models/md2_normals.li b/3D/models/md2_normals.li
new file mode 100644
index 0000000..acfc45c
--- /dev/null
+++ b/3D/models/md2_normals.li
@@ -0,0 +1,220 @@
+///////////////////////////////////////////////////////////////////////////////
+// Application //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := MD2_NORMALS;
+
+ - comment := "Quake2' md2 model format";
+
+ - external := `
+
+ typedef struct
+ {
+ float x,y,z;
+ } vec3_t;
+
+ static vec3_t anorms[162] = {
+ {-0.525731, 0.000000, 0.850651},
+ {-0.442863, 0.238856, 0.864188},
+ {-0.295242, 0.000000, 0.955423},
+ {-0.309017, 0.500000, 0.809017},
+ {-0.162460, 0.262866, 0.951056},
+ {0.000000, 0.000000, 1.000000},
+ {0.000000, 0.850651, 0.525731},
+ {-0.147621, 0.716567, 0.681718},
+ {0.147621, 0.716567, 0.681718},
+ {0.000000, 0.525731, 0.850651},
+ {0.309017, 0.500000, 0.809017},
+ {0.525731, 0.000000, 0.850651},
+ {0.295242, 0.000000, 0.955423},
+ {0.442863, 0.238856, 0.864188},
+ {0.162460, 0.262866, 0.951056},
+ {-0.681718, 0.147621, 0.716567},
+ {-0.809017, 0.309017, 0.500000},
+ {-0.587785, 0.425325, 0.688191},
+ {-0.850651, 0.525731, 0.000000},
+ {-0.864188, 0.442863, 0.238856},
+ {-0.716567, 0.681718, 0.147621},
+ {-0.688191, 0.587785, 0.425325},
+ {-0.500000, 0.809017, 0.309017},
+ {-0.238856, 0.864188, 0.442863},
+ {-0.425325, 0.688191, 0.587785},
+ {-0.716567, 0.681718, -0.147621},
+ {-0.500000, 0.809017, -0.309017},
+ {-0.525731, 0.850651, 0.000000},
+ {0.000000, 0.850651, -0.525731},
+ {-0.238856, 0.864188, -0.442863},
+ {0.000000, 0.955423, -0.295242},
+ {-0.262866, 0.951056, -0.162460},
+ {0.000000, 1.000000, 0.000000},
+ {0.000000, 0.955423, 0.295242},
+ {-0.262866, 0.951056, 0.162460},
+ {0.238856, 0.864188, 0.442863},
+ {0.262866, 0.951056, 0.162460},
+ {0.500000, 0.809017, 0.309017},
+ {0.238856, 0.864188, -0.442863},
+ {0.262866, 0.951056, -0.162460},
+ {0.500000, 0.809017, -0.309017},
+ {0.850651, 0.525731, 0.000000},
+ {0.716567, 0.681718, 0.147621},
+ {0.716567, 0.681718, -0.147621},
+ {0.525731, 0.850651, 0.000000},
+ {0.425325, 0.688191, 0.587785},
+ {0.864188, 0.442863, 0.238856},
+ {0.688191, 0.587785, 0.425325},
+ {0.809017, 0.309017, 0.500000},
+ {0.681718, 0.147621, 0.716567},
+ {0.587785, 0.425325, 0.688191},
+ {0.955423, 0.295242, 0.000000},
+ {1.000000, 0.000000, 0.000000},
+ {0.951056, 0.162460, 0.262866},
+ {0.850651, -0.525731, 0.000000},
+ {0.955423, -0.295242, 0.000000},
+ {0.864188, -0.442863, 0.238856},
+ {0.951056, -0.162460, 0.262866},
+ {0.809017, -0.309017, 0.500000},
+ {0.681718, -0.147621, 0.716567},
+ {0.850651, 0.000000, 0.525731},
+ {0.864188, 0.442863, -0.238856},
+ {0.809017, 0.309017, -0.500000},
+ {0.951056, 0.162460, -0.262866},
+ {0.525731, 0.000000, -0.850651},
+ {0.681718, 0.147621, -0.716567},
+ {0.681718, -0.147621, -0.716567},
+ {0.850651, 0.000000, -0.525731},
+ {0.809017, -0.309017, -0.500000},
+ {0.864188, -0.442863, -0.238856},
+ {0.951056, -0.162460, -0.262866},
+ {0.147621, 0.716567, -0.681718},
+ {0.309017, 0.500000, -0.809017},
+ {0.425325, 0.688191, -0.587785},
+ {0.442863, 0.238856, -0.864188},
+ {0.587785, 0.425325, -0.688191},
+ {0.688191, 0.587785, -0.425325},
+ {-0.147621, 0.716567, -0.681718},
+ {-0.309017, 0.500000, -0.809017},
+ {0.000000, 0.525731, -0.850651},
+ {-0.525731, 0.000000, -0.850651},
+ {-0.442863, 0.238856, -0.864188},
+ {-0.295242, 0.000000, -0.955423},
+ {-0.162460, 0.262866, -0.951056},
+ {0.000000, 0.000000, -1.000000},
+ {0.295242, 0.000000, -0.955423},
+ {0.162460, 0.262866, -0.951056},
+ {-0.442863, -0.238856, -0.864188},
+ {-0.309017, -0.500000, -0.809017},
+ {-0.162460, -0.262866, -0.951056},
+ {0.000000, -0.850651, -0.525731},
+ {-0.147621, -0.716567, -0.681718},
+ {0.147621, -0.716567, -0.681718},
+ {0.000000, -0.525731, -0.850651},
+ {0.309017, -0.500000, -0.809017},
+ {0.442863, -0.238856, -0.864188},
+ {0.162460, -0.262866, -0.951056},
+ {0.238856, -0.864188, -0.442863},
+ {0.500000, -0.809017, -0.309017},
+ {0.425325, -0.688191, -0.587785},
+ {0.716567, -0.681718, -0.147621},
+ {0.688191, -0.587785, -0.425325},
+ {0.587785, -0.425325, -0.688191},
+ {0.000000, -0.955423, -0.295242},
+ {0.000000, -1.000000, 0.000000},
+ {0.262866, -0.951056, -0.162460},
+ {0.000000, -0.850651, 0.525731},
+ {0.000000, -0.955423, 0.295242},
+ {0.238856, -0.864188, 0.442863},
+ {0.262866, -0.951056, 0.162460},
+ {0.500000, -0.809017, 0.309017},
+ {0.716567, -0.681718, 0.147621},
+ {0.525731, -0.850651, 0.000000},
+ {-0.238856, -0.864188, -0.442863},
+ {-0.500000, -0.809017, -0.309017},
+ {-0.262866, -0.951056, -0.162460},
+ {-0.850651, -0.525731, 0.000000},
+ {-0.716567, -0.681718, -0.147621},
+ {-0.716567, -0.681718, 0.147621},
+ {-0.525731, -0.850651, 0.000000},
+ {-0.500000, -0.809017, 0.309017},
+ {-0.238856, -0.864188, 0.442863},
+ {-0.262866, -0.951056, 0.162460},
+ {-0.864188, -0.442863, 0.238856},
+ {-0.809017, -0.309017, 0.500000},
+ {-0.688191, -0.587785, 0.425325},
+ {-0.681718, -0.147621, 0.716567},
+ {-0.442863, -0.238856, 0.864188},
+ {-0.587785, -0.425325, 0.688191},
+ {-0.309017, -0.500000, 0.809017},
+ {-0.147621, -0.716567, 0.681718},
+ {-0.425325, -0.688191, 0.587785},
+ {-0.162460, -0.262866, 0.951056},
+ {0.442863, -0.238856, 0.864188},
+ {0.162460, -0.262866, 0.951056},
+ {0.309017, -0.500000, 0.809017},
+ {0.147621, -0.716567, 0.681718},
+ {0.000000, -0.525731, 0.850651},
+ {0.425325, -0.688191, 0.587785},
+ {0.587785, -0.425325, 0.688191},
+ {0.688191, -0.587785, 0.425325},
+ {-0.955423, 0.295242, 0.000000},
+ {-0.951056, 0.162460, 0.262866},
+ {-1.000000, 0.000000, 0.000000},
+ {-0.850651, 0.000000, 0.525731},
+ {-0.955423, -0.295242, 0.000000},
+ {-0.951056, -0.162460, 0.262866},
+ {-0.864188, 0.442863, -0.238856},
+ {-0.951056, 0.162460, -0.262866},
+ {-0.809017, 0.309017, -0.500000},
+ {-0.864188, -0.442863, -0.238856},
+ {-0.951056, -0.162460, -0.262866},
+ {-0.809017, -0.309017, -0.500000},
+ {-0.681718, 0.147621, -0.716567},
+ {-0.681718, -0.147621, -0.716567},
+ {-0.850651, 0.000000, -0.525731},
+ {-0.688191, 0.587785, -0.425325},
+ {-0.587785, 0.425325, -0.688191},
+ {-0.425325, 0.688191, -0.587785},
+ {-0.425325, -0.688191, -0.587785},
+ {-0.587785, -0.425325, -0.688191},
+ {-0.688191, -0.587785, -0.425325} };
+
+
+ `;
+
+Section Inherit
+
+ - parent_object:OBJECT := OBJECT;
+
+
+Section Public
+
+ - get_normal i:INTEGER :VERTEX <-
+ (
+ + v:VERTEX;
+
+ v := VERTEX.create (`anorms[@i].x`:REAL_32,`anorms[@i].y`:REAL_32,`anorms[@i].z`:REAL_32);
+ v
+ );
+
+ - get_normal i:INTEGER in v:VERTEX <-
+ (
+ v.make (`anorms[@i].x`:REAL_32,`anorms[@i].y`:REAL_32,`anorms[@i].z`:REAL_32);
+ );
\ No newline at end of file
diff --git a/3D/models/md2_triangle.li b/3D/models/md2_triangle.li
new file mode 100644
index 0000000..19fd9ea
--- /dev/null
+++ b/3D/models/md2_triangle.li
@@ -0,0 +1,65 @@
+///////////////////////////////////////////////////////////////////////////////
+// Application //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := MD2_TRIANGLE;
+
+ - comment := "Quake2' md2 model format";
+
+Section Inherit
+
+ - parent_object:OBJECT := OBJECT;
+
+Section Public //Mapping
+
+ + vertex_index1:INTEGER_16;
+ + vertex_index2:INTEGER_16;
+ + vertex_index3:INTEGER_16;
+
+ + texel_index1:INTEGER_16;
+ + texel_index2:INTEGER_16;
+ + texel_index3:INTEGER_16;
+
+Section Public
+
+ - index1:(INTEGER_16,INTEGER_16) <- (vertex_index1,texel_index1);
+ - index2:(INTEGER_16,INTEGER_16) <- (vertex_index2,texel_index2);
+ - index3:(INTEGER_16,INTEGER_16) <- (vertex_index3,texel_index3);
+
+ - create (v1,v2,v3,t1,t2,t3:INTEGER_16) :SELF<-
+ ( + result:SELF;
+ result := SELF.clone;
+ result.make (v1,v2,v3,t1,t2,t3);
+ result
+ );
+
+ - make (v1,v2,v3,t1,t2,t3:INTEGER_16) <-
+ (
+ vertex_index1 := v1;
+ vertex_index2 := v2;
+ vertex_index3 := v3;
+
+ texel_index1 := t1;
+ texel_index2 := t2;
+ texel_index3 := t3;
+ );
+
diff --git a/3D/models/md2_vertex.li b/3D/models/md2_vertex.li
new file mode 100644
index 0000000..ceafe31
--- /dev/null
+++ b/3D/models/md2_vertex.li
@@ -0,0 +1,69 @@
+///////////////////////////////////////////////////////////////////////////////
+// Application //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := MD2_VERTEX;
+
+ - comment := "Quake2' md2 model format";
+
+Section Inherit
+
+ - parent_object:OBJECT := OBJECT;
+
+Section Public //Mapping
+
+ + vertex_index1:UINTEGER_8;
+ + vertex_index2:UINTEGER_8;
+ + vertex_index3:UINTEGER_8;
+
+ + lightnormal_index:UINTEGER_8;
+
+Section Public
+
+ - index1:REAL_32 <- vertex_index1.to_real;
+ - index2:REAL_32 <- vertex_index2.to_real;
+ - index3:REAL_32 <- vertex_index3.to_real;
+
+ - light_index:UINTEGER_8 <- lightnormal_index;
+
+ - create (v1,v2,v3:UINTEGER_8, l:UINTEGER_8) :SELF <-
+ ( + result:SELF;
+ result := SELF.clone;
+ result.make (v1,v2,v3,l);
+ result
+ );
+
+ - make (v1,v2,v3:UINTEGER_8, l:UINTEGER_8) <-
+ (
+ vertex_index1 := v1;
+ vertex_index2 := v2;
+ vertex_index3 := v3;
+ lightnormal_index := l;
+ );
+
+ - print <-
+ (
+ "\nmd2 vertex: ".print; vertex_index1.print; " , ".print;
+ vertex_index2.print; " , ".print;
+ vertex_index2.print; " => light ".print;
+ lightnormal_index.print;
+ );
\ No newline at end of file
diff --git a/3D/noise.li b/3D/noise.li
new file mode 100644
index 0000000..501769b
--- /dev/null
+++ b/3D/noise.li
@@ -0,0 +1,167 @@
+///////////////////////////////////////////////////////////////////////////////
+// Math-Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := NOISE;
+
+ - comment := "3D Perlin noise";
+
+ - external := `
+
+ static const char gradient[12][3] =
+ {
+ {1, 1, 0}, {1, -1, 0}, {-1, 1, 0}, {-1, -1, 0},
+ {1, 0, 1}, {1, 0, -1}, {-1, 0, 1}, {-1, 0, -1},
+ {0, 1, 1}, {0, -1, 1}, {0, 1, -1}, {0, -1, -1},
+ };`;
+
+Section Inherit
+
+ - parent_framework:FRAMEWORK := FRAMEWORK;
+
+Section Public
+
+ + permutation:FAST_ARRAY[INTEGER];
+
+
+
+ //
+ // Creation.
+ //
+
+ - create:SELF <-
+ ( + result:SELF;
+ result := clone;
+ result.make;
+ result
+ );
+
+ - make <-
+ (
+ permutation := FAST_ARRAY[INTEGER].create 256;
+ 0.to 255 do { i:INTEGER;
+ permutation.put (random & 0ffh) to i;
+ };
+ );
+
+ - get (x,y,z:REAL_32) :REAL_32 <-
+ // return Perlin noise at (x,y,z) point
+ (
+ + x1,y1,z1, x2,y2,z2:INTEGER;
+ + gx,gy,gz:INTEGER;
+ + dx1,dy1,dz1, dx2,dy2,dz2:REAL_32;
+ + dot1,dot2,dot3,dot4,dot5,dot6,dot7,dot8:REAL_32;
+ + idx,idy,idz:REAL_32;
+ + v0,v1, v00,v01,v10,v11:REAL_32;
+
+ // integer unit cube containing the point
+ x1 := x.to_integer;
+ y1 := y.to_integer;
+ z1 := z.to_integer;
+
+ x2 := x1 + 1;
+ y2 := y1 + 1;
+ z2 := z1 + 1;
+
+ // vectors from the corners of the cube to the point
+ dx1 := x - x1;
+ dy1 := y - y1;
+ dz1 := z - z1;
+
+ dx2 := x - x2;
+ dy2 := y - y2;
+ dz2 := z - z2;
+
+
+ // the corresponding gradients
+ (gx,gy,gz) := get_gradient (get_index (x1,y1,z1));
+ dot1 := dot (dx1,gx, dy1,gy, dz1,gz);
+ (gx,gy,gz) := get_gradient (get_index (x1,y1,z2));
+ dot2 := dot (dx1,gx, dy1,gy, dz2,gz);
+ (gx,gy,gz) := get_gradient (get_index (x1,y2,z1));
+ dot3 := dot (dx1,gx, dy2,gy, dz1,gz);
+ (gx,gy,gz) := get_gradient (get_index (x1,y2,z2));
+ dot4 := dot (dx1,gx, dy2,gy, dz2,gz);
+ (gx,gy,gz) := get_gradient (get_index (x2,y1,z1));
+ dot5 := dot (dx2,gx, dy1,gy, dz1,gz);
+ (gx,gy,gz) := get_gradient (get_index (x2,y1,z2));
+ dot6 := dot (dx2,gx, dy1,gy, dz2,gz);
+ (gx,gy,gz) := get_gradient (get_index (x2,y2,z1));
+ dot7 := dot (dx2,gx, dy2,gy, dz1,gz);
+ (gx,gy,gz) := get_gradient (get_index (x2,y2,z2));
+ dot8 := dot (dx2,gx, dy2,gy, dz2,gz);
+
+ // interpolations
+ idx := spline dx1;
+ idy := spline dy1;
+ idz := spline dz1;
+
+ v11 := linear (dot7, dot8, idz);
+ v10 := linear (dot5, dot6, idz);
+ v01 := linear (dot3, dot4, idz);
+ v00 := linear (dot1, dot2, idz);
+
+ v0 := linear (v10, v11, idy);
+ v1 := linear (v00, v01, idy);
+
+ linear (v0, v1, idx)
+ );
+
+Section Private
+
+ - get_gradient i:INTEGER :(INTEGER,INTEGER,INTEGER) <-
+ (
+ (`gradient[@i][0]`:INTEGER,`gradient[@i][1]`:INTEGER,`gradient[@i][2]`:INTEGER)
+ );
+
+ - get_index (x,y,z:INTEGER) :INTEGER <-
+ (
+ permutation.item ((x + permutation.item ((y + permutation.item (z & 0ffh)) & 0ffh)) & 0ffh) & 0ch
+ );
+
+ - prod (a,b:REAL_32) :REAL_32 <-
+ ( + result:REAL_32;
+ (b > 0).if {
+ result := a;
+ }.elseif {b < 0} then {
+ result := -a;
+ };
+ result
+ );
+
+ - dot (x1,x2, y1,y2, z1,z2:REAL_32) :REAL_32 <-
+ (
+ prod (x1, x2) + prod (y1, y2) + prod (z1, z2)
+ );
+
+ - spline val:REAL_32 :REAL_32 <-
+ // 3x^2 + 2x^3 curve
+ ( + val2:REAL_32;
+
+ val2 := val * val;
+ val2 * (3.0 + val * 2.0)
+ );
+
+ - linear (start, end, t:REAL_32) :REAL_32 <-
+ (
+ start + (end - start) * t
+ );
diff --git a/3D/particles/bounce_plane.li b/3D/particles/bounce_plane.li
new file mode 100644
index 0000000..5f07c76
--- /dev/null
+++ b/3D/particles/bounce_plane.li
@@ -0,0 +1,80 @@
+///////////////////////////////////////////////////////////////////////////////
+// Application //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := BOUNCE_PLANE;
+
+ - comment := "part of particle engine";
+
+Section Inherit
+
+ - parent_constraint:CONSTRAINT := CONSTRAINT;
+
+Section Public
+
+ + normal:VECTOR3[REAL_32];
+ + offset:REAL_32;
+
+ //
+ // Creation.
+ //
+
+ - create (n:VECTOR3[REAL_32], off:REAL_32) :SELF <-
+ ( + result:SELF;
+ result := clone;
+ result.make (n,off);
+ result
+ );
+
+ - make (n:VECTOR3[REAL_32], off:REAL_32) <-
+ (
+ normal := n;
+ offset := off;
+ );
+
+
+
+ - apply_to p:PARTICLE time t:REAL_32 <-
+ (
+ + dist:REAL_32;
+
+ dist := distance_to (p.position);
+
+ (dist < p.size).if {
+ p.set_direction (p.dir - (normal * (2.0*p.dir.dot normal)));
+ p.set_position (p.position + (normal * (p.size - dist)));
+ };
+ );
+
+Section Private
+
+ - distance_to p:VECTOR3[REAL_32] :REAL_32 <-
+ (
+ (p.dot normal) + offset
+ );
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/3D/particles/constraint.li b/3D/particles/constraint.li
new file mode 100644
index 0000000..19733dc
--- /dev/null
+++ b/3D/particles/constraint.li
@@ -0,0 +1,40 @@
+///////////////////////////////////////////////////////////////////////////////
+// Application //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := CONSTRAINT;
+
+ - comment := "part of particle engine";
+
+Section Inherit
+
+ - parent_framework:FRAMEWORK := FRAMEWORK;
+
+Section Public
+
+ - apply_to p:PARTICLE time t:REAL_32 <- deferred;
+
+
+
+
+
+
diff --git a/3D/particles/kill_plane.li b/3D/particles/kill_plane.li
new file mode 100644
index 0000000..511ee2f
--- /dev/null
+++ b/3D/particles/kill_plane.li
@@ -0,0 +1,79 @@
+///////////////////////////////////////////////////////////////////////////////
+// Application //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := KILL_PLANE;
+
+ - comment := "part of particle engine";
+
+Section Inherit
+
+ - parent_constraint:CONSTRAINT := CONSTRAINT;
+
+Section Public
+
+ + normal:VECTOR3[REAL_32];
+ + offset:REAL_32;
+
+ //
+ // Creation.
+ //
+
+ - create (n:VECTOR3[REAL_32], off:REAL_32) :SELF <-
+ ( + result:SELF;
+ result := clone;
+ result.make (n,off);
+ result
+ );
+
+ - make (n:VECTOR3[REAL_32], off:REAL_32) <-
+ (
+ normal := n;
+ offset := off;
+ );
+
+
+
+ - apply_to p:PARTICLE time t:REAL_32 <-
+ (
+ + dist:REAL_32;
+
+ dist := distance_to (p.position);
+
+ (dist < p.size).if {
+ p.kill;
+ };
+ );
+
+Section Private
+
+ - distance_to p:VECTOR3[REAL_32] :REAL_32 <-
+ (
+ (p.dot normal) + offset
+ );
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/3D/particles/particle.li b/3D/particles/particle.li
new file mode 100644
index 0000000..c8ab3c5
--- /dev/null
+++ b/3D/particles/particle.li
@@ -0,0 +1,100 @@
+///////////////////////////////////////////////////////////////////////////////
+// Application //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := PARTICLE;
+
+ - comment := "part of particle engine";
+
+Section Inherit
+
+ - parent_object:OBJECT := OBJECT;
+
+Section Public
+
+ //
+ // Particle properties
+ //
+
+ + position:VECTOR3[REAL_32];
+ + dir:VECTOR3[REAL_32];
+
+ + size:REAL_32;
+ + life:REAL_32;
+ + initial_life:REAL_32;
+
+ - is_dead:BOOLEAN <- life <= 0;
+
+
+ - create (p,d:VECTOR3[REAL_32]) size sz:REAL_32 life t:REAL_32 :SELF <-
+ ( + result:SELF;
+ result := SELF.clone;
+ result.make (p,d) size sz life t;
+ result
+ );
+
+ - make (p,d:VECTOR3[REAL_32]) size sz:REAL_32 life t:REAL_32 <-
+ (
+ position := p;
+ dir := d;
+ size := sz;
+
+ initial_life := t;
+ life := initial_life;
+ );
+
+ - set_position p:VECTOR3[REAL_32] <-
+ (
+ position := p;
+ );
+
+ - set_direction d:VECTOR3[REAL_32] <-
+ (
+ dir := d;
+ );
+
+ - kill <-
+ (
+ life := 0;
+ );
+
+ //
+ // Update
+ //
+
+ - update_life time:REAL_32 <-
+ (
+ life := life - time;
+ );
+
+ - update time:REAL_32 <-
+ (
+ position.set_x (position.x + dir.x * time);
+ position.set_y (position.y + dir.y * time);
+ position.set_z (position.z + dir.z * time);
+ );
+
+
+
+
+
+
diff --git a/3D/particles/particle_system.li b/3D/particles/particle_system.li
new file mode 100644
index 0000000..eeb545d
--- /dev/null
+++ b/3D/particles/particle_system.li
@@ -0,0 +1,302 @@
+///////////////////////////////////////////////////////////////////////////////
+// Application //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := PARTICLE_SYSTEM;
+
+ - comment := "part of particle engine";
+
+Section Inherit
+
+ - parent_framework:FRAMEWORK := FRAMEWORK;
+
+Section Public
+
+ //
+ // Particle System properties
+ //
+
+ + position:VECTOR3[REAL_32];
+ + direction:VECTOR3[REAL_32];
+
+ + particles:LINKED_LIST[PARTICLE];
+ + constraints:LINKED_LIST[CONSTRAINT];
+
+ + palette:FAST_ARRAY[RGB];
+
+ + spawn_rate:REAL_32;
+ + size:REAL_32;
+ + life:REAL_32;
+ + speed:REAL_32;
+
+ + size_spread:REAL_32;
+ + life_spread:REAL_32;
+ + speed_spread:REAL_32;
+
+
+ - create p:VECTOR3[REAL_32] :SELF <-
+ ( + result:SELF;
+ result := SELF.clone;
+ result.make p;
+ result
+ );
+
+ - make p:VECTOR3[REAL_32] <-
+ (
+ position := p;
+ direction := VECTOR3[REAL_32].create (0.5,0.1,0.5);
+
+ spawn_rate := 60;
+
+ speed := 10;
+ speed_spread := 2;
+
+ size := 1;
+ size_spread := 0.5;
+
+ life := 5;
+ life_spread := 1;
+
+ particles := LINKED_LIST[PARTICLE].create;
+ constraints := LINKED_LIST[CONSTRAINT].create;
+
+ palette := FAST_ARRAY[RGB].create_with_capacity 12;
+ 0.to 12 do { i:INTEGER;
+ palette.add_last (RGB.create (0,0,0));
+ };
+ set_color_fire;
+ );
+
+ - add_constraint c:CONSTRAINT <-
+ (
+ constraints.add_last c;
+ );
+
+ - set_spawn_rate sr:REAL_32 <-
+ (
+ spawn_rate := sr;
+ );
+
+ - set_life (life0, spread:REAL_32) <-
+ (
+ life := life0;
+ life_spread := spread;
+ );
+
+ - set_speed (speed0, spread:REAL_32) <-
+ (
+ speed := speed0;
+ speed_spread := spread;
+ );
+
+ - set_size (size0, spread:REAL_32) <-
+ (
+ size := size0;
+ size_spread := spread;
+ );
+
+ //
+ // Update
+ //
+
+ - dir:VECTOR3[REAL_32] := VECTOR3[REAL_32].zero;
+
+ - update time:REAL_32 <-
+ (
+ + nb_new_particles:INTEGER;
+ + p:PARTICLE;
+ + sz,lifetime:REAL_32;
+ // + dir:VECTOR3[REAL_32];
+ + k:INTEGER;
+
+ // spawn new particles
+ nb_new_particles := (time * spawn_rate).to_integer;
+
+ 0.to nb_new_particles do { i:INTEGER;
+
+ //dir := random_vector direction spread (1,1,1);
+ get_random_vector direction spread (1,1,1) in dir;
+
+ dir.normalize;
+ dir := dir * speed;
+
+ sz := random_around size spread size_spread;
+ lifetime := random_around life spread life_spread;
+
+ p := PARTICLE.create (position.copy, dir) size sz life lifetime;
+ particles.add_last p;
+ };
+
+ k := particles.lower;
+ {k <= particles.upper}.while_do {
+ p := particles.item k;
+
+ p.update_life time;
+ p.is_dead.if {
+ // kill particle
+ particles.remove k;
+ } else {
+ // apply constraints to the system
+ constraints.lower.to (constraints.upper) do { i:INTEGER;
+ constraints.item i.apply_to p time (time);
+
+ p.is_dead.if {
+ // kill particle
+ particles.remove k;
+ };
+ };
+
+ // update particle
+ p.update (time);
+ k := k + 1;
+ };
+ };
+ );
+
+
+ - render (dx,dy:VECTOR3[REAL_32]) <-
+ (
+ + v:VECTOR3[REAL_32];
+ + frac:REAL_32;
+ + col_int:INTEGER;
+
+ renderer.vb.new_quads {
+ particles.lower.to (particles.upper) do { i:INTEGER;
+
+ frac := (11.0*particles.item i.life)/particles.item i.initial_life;
+ col_int := frac.to_integer;
+ frac := frac - col_int;
+
+ renderer.color_buffer.set_color3f (get_r col_int frac frac,get_g col_int frac frac,get_b col_int frac frac);
+
+
+ // render particle
+ renderer.vb.add_texel2f (0,0);
+ v := particles.item i.position + ((-dx + dy) * particles.item i.size);
+ renderer.vb.add_vertex3f (v.x, v.y, v.z);
+
+ renderer.vb.add_texel2f (1,0);
+ v := particles.item i.position + ((dx + dy) * particles.item i.size);
+ renderer.vb.add_vertex3f (v.x, v.y, v.z);
+
+ renderer.vb.add_texel2f (1,1);
+ v := particles.item i.position + ((dx - dy) * particles.item i.size);
+ renderer.vb.add_vertex3f (v.x, v.y, v.z);
+
+ renderer.vb.add_texel2f (0,1);
+ v := particles.item i.position + ((-dx - dy) * particles.item i.size);
+ renderer.vb.add_vertex3f (v.x, v.y, v.z);
+ };
+ };
+ );
+
+ - get_r idx:INTEGER frac frac:REAL_32 :REAL_32 <-
+ (
+ palette.item idx.r * (1.0 - frac) + palette.item (idx+1).r * frac
+ );
+ - get_g idx:INTEGER frac frac:REAL_32 :REAL_32 <-
+ (
+ palette.item idx.g * (1.0 - frac) + palette.item (idx+1).g * frac
+ );
+ - get_b idx:INTEGER frac frac:REAL_32 :REAL_32 <-
+ (
+ palette.item idx.b * (1.0 - frac) + palette.item (idx+1).b * frac
+ );
+
+ - set_color_fire <-
+ (
+ 0.to 4 do { i:INTEGER;
+ palette.item i.make (i.to_real/4.0, 0, 0);
+ palette.item (i+4).make (1, i.to_real/4.0, 0);
+ palette.item (i+8).make ((3-i).to_real/3.0, (3-i).to_real/3.0, 1);
+ };
+ );
+
+ - set_color_ice <-
+ (
+ 0.to 6 do { i:INTEGER;
+ palette.item i.make (0, 0, i.to_real/6.0);
+ palette.item (i+6).make (i.to_real/5.0, 1, 1);
+ };
+ );
+
+ - set_color_smoke <-
+ (
+ + col:REAL_32;
+
+ 0.to 12 do { i:INTEGER;
+ col := i.to_real / 24.0;
+ palette.item i.make (col, col, col);
+ };
+ );
+
+ - set_color_rainbow <-
+ (
+ palette.item 0.make (0, 0, 0);
+ palette.item 1.make (0, 0, 0.25);
+ palette.item 2.make (0, 0, 0.5);
+ palette.item 3.make (0, 0, 1);
+ palette.item 4.make (0, 0.5, 1);
+ palette.item 5.make (0, 1, 1);
+ palette.item 6.make (0, 1, 0.5);
+ palette.item 7.make (0, 1, 0);
+ palette.item 8.make (0.5, 1, 0);
+ palette.item 9.make (1, 1, 0);
+ palette.item 10.make (1, 0.5, 0);
+ palette.item 11.make (1, 0, 0);
+ );
+
+Section Private
+
+ - random_around val:REAL_32 spread spread_val:REAL_32 :REAL_32 <-
+ (
+ + r:REAL_32;
+
+ r := 2.0 * random_ratio - 1.0;
+ val + r * spread_val * r.abs
+ );
+
+ - random_vector v:VECTOR3[REAL_32] spread (sx,sy,sz:REAL_32) :VECTOR3[REAL_32] <-
+ (
+ + x,y,z:REAL_32;
+
+ x := v.x * random_around 0 spread sx;
+ y := v.y * random_around 0 spread sy;
+ z := v.z * random_around 0 spread sz;
+
+ VECTOR3[REAL_32].create (x, y, z)
+ );
+
+ - get_random_vector v:VECTOR3[REAL_32] spread (sx,sy,sz:REAL_32) in vec:VECTOR3[REAL_32] <-
+ (
+ + x,y,z:REAL_32;
+
+ x := v.x * random_around 0 spread sx;
+ y := v.y * random_around 0 spread sy;
+ z := v.z * random_around 0 spread sz;
+
+ vec.make (x, y, z);
+ );
+
+
+
+
diff --git a/3D/particles/point_force.li b/3D/particles/point_force.li
new file mode 100644
index 0000000..ac18da6
--- /dev/null
+++ b/3D/particles/point_force.li
@@ -0,0 +1,88 @@
+///////////////////////////////////////////////////////////////////////////////
+// Application //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := POINT_FORCE;
+
+ - comment := "part of particle engine";
+
+Section Inherit
+
+ - parent_constraint:CONSTRAINT := CONSTRAINT;
+
+Section Public
+
+ //
+ // Particle properties
+ //
+
+ + position:VECTOR3[REAL_32];
+
+ + strength:REAL_32;
+ + linear_attenuation:REAL_32;
+ + quadratic_attenuation:REAL_32;
+
+
+ //
+ // Creation.
+ //
+
+ - create (p:VECTOR3[REAL_32],s,la,qa:REAL_32) :SELF <-
+ ( + result:SELF;
+ result := clone;
+ result.make (p,s,la,qa);
+ result
+ );
+
+ - make (p:VECTOR3[REAL_32],s,la,qa:REAL_32) <-
+ (
+ position := p;
+ strength := s;
+ linear_attenuation := la;
+ quadratic_attenuation := qa;
+ );
+
+
+
+ - apply_to p:PARTICLE time t:REAL_32 <-
+ (
+ + dir:VECTOR3[REAL_32];
+ + dist:REAL_32;
+
+ dir := position - p.position;
+ dist := dir.magnitude;
+
+ dir := dir * (strength / (1.0 + dist.sqrt*linear_attenuation + dist*quadratic_attenuation));
+
+ p.set_direction (p.dir + (dir*t));
+ );
+
+ - set_strength str:REAL_32 <-
+ (
+ strength := str;
+ );
+
+
+
+
+
+
\ No newline at end of file
diff --git a/3D/primitives/cone.li b/3D/primitives/cone.li
new file mode 100644
index 0000000..44fd522
--- /dev/null
+++ b/3D/primitives/cone.li
@@ -0,0 +1,67 @@
+///////////////////////////////////////////////////////////////////////////////
+// Application //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := CONE;
+
+ - comment := "3D cone";
+
+Section Inherit
+
+ - parent_framework:FRAMEWORK := FRAMEWORK;
+
+Section Public
+
+ + radius_base:REAL_32;
+ + height:REAL_32;
+ + slices:REAL_32;
+
+ + position:VECTOR3[REAL_32];
+
+
+ - create (p:VECTOR3[REAL_32],r,h,sl:REAL_32) :SELF <-
+ (
+ + result:SELF;
+ result := SELF.clone;
+ result.make (p,r,h,sl);
+ result
+ );
+
+ - make (p:VECTOR3[REAL_32],r,h,sl:REAL_32) <-
+ (
+ radius_base := r;
+ height := h;
+ slices := sl;
+ position := p;
+ );
+
+ - render <-
+ (
+ renderer.transform.push_matrix;
+
+ renderer.transform.translatef (position.x, position.y, position.z);
+
+ renderer.quadrics.new_quadric {
+ renderer.quadrics.draw_cylinder (radius_base,0,height,slices,1);
+ };
+ renderer.transform.pop_matrix;
+ );
diff --git a/3D/primitives/cylinder.li b/3D/primitives/cylinder.li
new file mode 100644
index 0000000..6df0053
--- /dev/null
+++ b/3D/primitives/cylinder.li
@@ -0,0 +1,73 @@
+///////////////////////////////////////////////////////////////////////////////
+// Application //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := CYLINDER;
+
+ - comment := "glu quadric cylinder";
+
+Section Inherit
+
+ - parent_framework:FRAMEWORK := FRAMEWORK;
+
+Section Public
+
+ + radius_top:REAL_32;
+ + radius_base:REAL_32;
+
+ + height:REAL_32;
+
+ + slices:REAL_32;
+ + stacks:REAL_32;
+
+ + position:VECTOR3[REAL_32];
+
+
+ - create (p:VECTOR3[REAL_32],r1,r2,h,sl,st:REAL_32) :SELF <-
+ (
+ + result:SELF;
+ result := SELF.clone;
+ result.make (p,r1,r2,h,sl,st);
+ result
+ );
+
+ - make (p:VECTOR3[REAL_32],r1,r2,h,sl,st:REAL_32) <-
+ (
+ radius_top := r1;
+ radius_base := r2;
+ height := h;
+ slices := sl;
+ stacks := st;
+ position := p;
+ );
+
+ - render <-
+ (
+ renderer.transform.push_matrix;
+
+ renderer.transform.translatef (position.x, position.y, position.z);
+
+ renderer.quadrics.new_quadric {
+ renderer.quadrics.draw_cylinder (radius_base,radius_top,height,slices,stacks);
+ };
+ renderer.transform.pop_matrix;
+ );
diff --git a/3D/primitives/sphere.li b/3D/primitives/sphere.li
new file mode 100644
index 0000000..55378c7
--- /dev/null
+++ b/3D/primitives/sphere.li
@@ -0,0 +1,67 @@
+///////////////////////////////////////////////////////////////////////////////
+// Application //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := SPHERE;
+
+ - comment := "glu quadric sphere";
+
+Section Inherit
+
+ - parent_framework:FRAMEWORK := FRAMEWORK;
+
+Section Public
+
+ + radius:REAL_32;
+ + slices:REAL_32;
+ + stacks:REAL_32;
+
+ + position:VECTOR3[REAL_32];
+
+
+ - create (p:VECTOR3[REAL_32],r,sl,st:REAL_32) :SELF <-
+ (
+ + result:SELF;
+ result := SELF.clone;
+ result.make (p,r,sl,st);
+ result
+ );
+
+ - make (p:VECTOR3[REAL_32],r,sl,st:REAL_32) <-
+ (
+ radius := r;
+ slices := sl;
+ stacks := st;
+ position := p;
+ );
+
+ - render <-
+ (
+ renderer.transform.push_matrix;
+
+ renderer.transform.translatef (position.x, position.y, position.z);
+
+ renderer.quadrics.new_quadric {
+ renderer.quadrics.draw_sphere (radius,slices,stacks);
+ };
+ renderer.transform.pop_matrix;
+ );
diff --git a/3D/skybox.li b/3D/skybox.li
new file mode 100644
index 0000000..5f46c86
--- /dev/null
+++ b/3D/skybox.li
@@ -0,0 +1,180 @@
+///////////////////////////////////////////////////////////////////////////////
+// Application //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := SKYBOX;
+
+ - comment := "render cube with sky effect";
+
+Section Inherit
+
+ - parent_framework:FRAMEWORK := FRAMEWORK;
+
+Section Public
+
+ // position in 3d world
+ + position:VECTOR3[REAL_32];
+
+ // 3d cube
+ + vertex:FAST_ARRAY[VERTEX];
+
+ // skybox textures
+ + textures:FAST_ARRAY[TEXTURE];
+
+
+ - create (pos,dim:VECTOR3[REAL_32],tex:FAST_ARRAY[TEXTURE]) :SELF <-
+ ( + result:SELF;
+ result := SELF.clone;
+ result.make (pos,dim,tex);
+ result
+ );
+
+ - make (pos,dim:VECTOR3[REAL_32],tex:FAST_ARRAY[TEXTURE]) <-
+ (
+ + v:VERTEX;
+ ? {tex.count = 5};
+
+
+ position := pos;
+ textures := tex;
+
+ vertex := FAST_ARRAY[VERTEX].create_with_capacity 8;
+
+ // top
+ v := VERTEX.create (pos.x - dim.x, pos.y + dim.y, pos.z + dim.z);
+ vertex.add_last v;
+ v := VERTEX.create (pos.x + dim.x, pos.y + dim.y, pos.z + dim.z);
+ vertex.add_last v;
+ v := VERTEX.create (pos.x + dim.x, pos.y + dim.y, pos.z - dim.z);
+ vertex.add_last v;
+ v := VERTEX.create (pos.x - dim.x, pos.y + dim.y, pos.z - dim.z);
+ vertex.add_last v;
+
+ // bottom
+ v := VERTEX.create (pos.x - dim.x, pos.y - dim.y, pos.z + dim.z);
+ vertex.add_last v;
+ v := VERTEX.create (pos.x + dim.x, pos.y - dim.y, pos.z + dim.z);
+ vertex.add_last v;
+ v := VERTEX.create (pos.x + dim.x, pos.y - dim.y, pos.z - dim.z);
+ vertex.add_last v;
+ v := VERTEX.create (pos.x - dim.x, pos.y - dim.y, pos.z - dim.z);
+ vertex.add_last v;
+ );
+
+ - render <-
+ (
+ //
+ textures.item 0.bind;
+ renderer.vb.begin_quads;
+
+ renderer.vb.add_texel2f (1, 0);
+ renderer.vb.add_vertex (vertex.item 7);
+
+ renderer.vb.add_texel2f (0, 0);
+ renderer.vb.add_vertex (vertex.item 6);
+
+ renderer.vb.add_texel2f (0, 1);
+ renderer.vb.add_vertex (vertex.item 2);
+
+ renderer.vb.add_texel2f (1, 1);
+ renderer.vb.add_vertex (vertex.item 3);
+
+ renderer.vb.end;
+
+ //
+ textures.item 1.bind;
+ renderer.vb.begin_quads;
+
+ renderer.vb.add_texel2f (0, 1);
+ renderer.vb.add_vertex (vertex.item 1);
+
+ renderer.vb.add_texel2f (1, 1);
+ renderer.vb.add_vertex (vertex.item 2);
+
+ renderer.vb.add_texel2f (1, 0);
+ renderer.vb.add_vertex (vertex.item 6);
+
+ renderer.vb.add_texel2f (0, 0);
+ renderer.vb.add_vertex (vertex.item 5);
+
+ renderer.vb.end;
+
+ //
+ textures.item 2.bind;
+ renderer.vb.begin_quads;
+
+ renderer.vb.add_texel2f (0, 1);
+ renderer.vb.add_vertex (vertex.item 0);
+
+ renderer.vb.add_texel2f (1, 1);
+ renderer.vb.add_vertex (vertex.item 1);
+
+ renderer.vb.add_texel2f (1, 0);
+ renderer.vb.add_vertex (vertex.item 5);
+
+ renderer.vb.add_texel2f (0, 0);
+ renderer.vb.add_vertex (vertex.item 4);
+
+ renderer.vb.end;
+
+ //
+ textures.item 3.bind;
+ renderer.vb.begin_quads;
+
+ renderer.vb.add_texel2f (1, 0);
+ renderer.vb.add_vertex (vertex.item 4);
+
+ renderer.vb.add_texel2f (0, 0);
+ renderer.vb.add_vertex (vertex.item 7);
+
+ renderer.vb.add_texel2f (0, 1);
+ renderer.vb.add_vertex (vertex.item 3);
+
+ renderer.vb.add_texel2f (1, 1);
+ renderer.vb.add_vertex (vertex.item 0);
+
+ renderer.vb.end;
+
+ //
+ textures.item 4.bind;
+ renderer.vb.begin_quads;
+
+ renderer.vb.add_texel2f (0, 1);
+ renderer.vb.add_vertex (vertex.item 3);
+
+ renderer.vb.add_texel2f (1, 1);
+ renderer.vb.add_vertex (vertex.item 2);
+
+ renderer.vb.add_texel2f (1, 0);
+ renderer.vb.add_vertex (vertex.item 1);
+
+ renderer.vb.add_texel2f (0, 0);
+ renderer.vb.add_vertex (vertex.item 0);
+
+ renderer.vb.end;
+ );
+
+ - set_position p:VECTOR3[REAL_32] <-
+ (
+ position := p;
+ );
+
diff --git a/3D/terrain.li b/3D/terrain.li
new file mode 100644
index 0000000..6580784
--- /dev/null
+++ b/3D/terrain.li
@@ -0,0 +1,256 @@
+///////////////////////////////////////////////////////////////////////////////
+// Application //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := TERRAIN;
+
+ - comment := "Height map";
+
+Section Inherit
+
+ - parent_framework:FRAMEWORK := FRAMEWORK;
+
+Section Public
+
+ + width:INTEGER;
+ + height:INTEGER;
+
+ + w_step:REAL_32 := 2;
+ + h_step:REAL_32 := 2;
+
+ + height_factor:REAL_32 := 2.5;
+
+ + heights:FAST_ARRAY[REAL_32];
+ + normals:FAST_ARRAY[VECTOR3[REAL_32]];
+
+ + texture:TEXTURE;
+
+ - is_textured:BOOLEAN <- texture != NULL;
+
+
+ //
+ // Creation.
+ //
+
+ - create map:IMAGE texture tex:TEXTURE :SELF <-
+ ( + result:SELF;
+ result := clone;
+ result.make (map,tex);
+ result
+ );
+
+ - make (image:IMAGE, tex:TEXTURE) <-
+ // build the terrain
+ (
+ + map:IMAGE;
+ + h:REAL_32;
+
+ (image.channels = 3).if {
+ // we need an alpha channel or a greyscale image
+
+ map := image.to_greyscale;
+ } else {
+ map := image;
+ };
+
+ texture := tex;
+ width := map.width;
+ height := map.height;
+
+ heights := FAST_ARRAY[REAL_32].create (width*height);
+ normals := FAST_ARRAY[VECTOR3[REAL_32]].create_with_capacity (width*height);
+
+ // fill data with heights
+ 0.to (height-1) do { j:INTEGER;
+ 0.to (width-1) do { i:INTEGER;
+ (image.channels = 4).if {
+ h := map.get_alpha_value (i,j).to_real / 256.0;
+ } else {
+ h := map.get_value (i,j).to_real / 256.0;
+ };
+ heights.put (h*height_factor) to (i*width+j);
+ };
+ };
+ compute_normals;
+ );
+
+ - render vb:VERTEX_BUFFER at (xpos,ypos,zpos:REAL_32) <-
+ (
+ + index:INTEGER;
+
+ is_textured.if {
+ texture.enable;
+ texture.bind;
+ };
+
+ 0.to (height-2) do { i:INTEGER;
+ // generate n-1 strips
+
+ vb.new_triangle_strip {
+ 0.to (width-1) do { j:INTEGER;
+
+ // first point of strip
+ index := 3*((i+1)*width+j);
+
+ is_textured.if {
+ vb.add_texel2f ((i+1).to_real/256.0, j.to_real/256.0);
+ };
+
+ vb.add_vertex3f (xpos+j.to_real*w_step,ypos+ heights.item ((i+1)*width+j),zpos+(i+1).to_real*h_step);
+
+ // second point
+ index := 3*(i*width+j);
+
+ is_textured.if {
+ vb.add_texel2f (i.to_real/256.0, j.to_real/256.0);
+ };
+ (normals != NULL).if {
+ vb.add_normal (normals.item (i*width+j));
+ };
+
+ vb.add_vertex3f (xpos+j.to_real*w_step, ypos+heights.item (i*width+j),zpos+i.to_real*h_step);
+ };
+ };
+ };
+ );
+
+ - rescale (min,max:REAL_32) <-
+ (
+ + amplitude,h_min,h_max,h:REAL_32;
+ + n:INTEGER;
+
+ amplitude := max - min;
+ n := width * height;
+
+ // find actual amplitude
+ h_min := heights.item 0;
+ h_max := heights.item 0;
+ 1.to (n-1) do { i:INTEGER;
+ (heights.item i > h_max).if {
+ h_max := heights.item i;
+ };
+ (heights.item i < h_min).if {
+ h_min := heights.item i;
+ };
+ };
+ // re-scale terrain
+ 0.to (n-1) do { i:INTEGER;
+ h := (heights.item i - h_min) / (h_max-h_min);
+ heights.put (h * amplitude - min) to i;
+ };
+
+ // re-compute normals
+ compute_normals;
+ );
+
+ - cross_product_p1 (x1,z1:INTEGER) p2 (x2,z2:INTEGER) p3 (x3,z3:INTEGER) :VECTOR3[REAL_32] <-
+ // compute normal unit vector of the (p1,p2,p3) triangle
+ (
+ + v1,v2:VECTOR3[REAL_32];
+
+ // vector between p1 & p2
+ v1 := VECTOR3[REAL_32].create ((x2-x1).to_real*w_step, heights.item (z2*width+x2) - heights.item (z1*width+x1), (z2-z1).to_real*h_step);
+
+ // vector between p1 & p3
+ v2 := VECTOR3[REAL_32].create ((x3-x1).to_real*w_step, heights.item (z3*width+x3) - heights.item (z1*width+x1), (z3-z1).to_real*h_step);
+
+ (v1.cross v2).normalized
+ );
+
+ - compute_normals <-
+ (
+ + v1,v2:VECTOR3[REAL_32];
+
+ normals.clear;
+
+ 0.to (height-1) do { z:INTEGER;
+ 0.to (width-1) do { x:INTEGER;
+ //
+ // normals of the corners
+ //
+ ((x = 0) && {z = 0}).if {
+ // bottom left
+ v1 := cross_product_p1 (0,0) p2 (0,1) p3 (1,0);
+ }.elseif {(z = height-1) && {x = width-1}} then {
+ // top right
+ v1 := cross_product_p1 (x,z) p2 (x,z-1) p3 (x-1,z);
+ }.elseif {(x = 0) && {z = height-1}} then {
+ // top left
+ v1 := cross_product_p1 (x,z) p2 (x,z-1) p3 (x+1,z);
+ }.elseif {(x = width-1) && {z = 0}} then {
+ // bottom right
+ v1 := cross_product_p1 (x,z) p2 (x,z+1) p3 (x-1,z);
+ }.elseif {z = 0} then {
+ //
+ // normals of the borders
+ //
+ v1 := cross_product_p1 (x,0) p2 (x-1,0) p3 (x,1);
+ v2 := cross_product_p1 (x,0) p2 (x,1) p3 (x+1,0);
+
+ v1 := v1 + v2;
+ }.elseif {x = 0} then {
+ // left border
+ v1 := cross_product_p1 (0,z) p2 (1,z) p3 (0,z-1);
+ v2 := cross_product_p1 (0,z) p2 (0,z+1) p3 (1,z);
+
+ v1 := v1 + v2;
+ }.elseif {z = height-1} then {
+ // top border
+ v1 := cross_product_p1 (x,z) p2 (x,z-1) p3 (x+1,z);
+ v2 := cross_product_p1 (x,z) p2 (x+1,z) p3 (x,z-1);
+
+ v1 := v1 + v2;
+ }.elseif {x = width-1} then {
+ // right border
+ v1 := cross_product_p1 (x,z) p2 (x,z-1) p3 (x-1,z);
+ v2 := cross_product_p1 (x,z) p2 (x-1,z) p3 (x,z+1);
+
+ v1 := v1 + v2;
+ } else {
+ //
+ // inner point: sum the 8 neighbours normals
+ //
+ v1 := cross_product_p1 (x,z) p2 (x-1,z) p3 (x-1,z+1);
+ v2 := cross_product_p1 (x,z) p2 (x-1,z+1) p3 (x,z+1);
+ v1 := v1 + v2;
+
+ v2 := cross_product_p1 (x,z) p2 (x,z+1) p3 (x+1,z+1);
+ v1 := v1 + v2;
+ v2 := cross_product_p1 (x,z) p2 (x+1,z+1) p3 (x+1,z);
+ v1 := v1 + v2;
+ v2 := cross_product_p1 (x,z) p2 (x+1,z) p3 (x+1,z-1);
+ v1 := v1 + v2;
+ v2 := cross_product_p1 (x,z) p2 (x+1,z-1) p3 (x,z-1);
+ v1 := v1 + v2;
+ v2 := cross_product_p1 (x,z) p2 (x,z-1) p3 (x-1,z-1);
+ v1 := v1 + v2;
+ v2 := cross_product_p1 (x,z) p2 (x-1,z-1) p3 (x-1,z);
+ v1 := v1 + v2;
+ };
+ v1.normalize;
+ v1.set_z (-v1.z);
+
+ // add normal
+ normals.add_last v1;
+ };
+ };
+ );
diff --git a/abstract_renderer/abstract_evaluator.li b/abstract_renderer/abstract_evaluator.li
new file mode 100644
index 0000000..b3bc92c
--- /dev/null
+++ b/abstract_renderer/abstract_evaluator.li
@@ -0,0 +1,147 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := ABSTRACT_EVALUATOR;
+
+ - comment := "Maps a spline function";
+
+Section Inherit
+
+ + parent_state:Expanded STATE;
+
+Section Public
+
+ // types of the control points
+ - vertex3:INTEGER <- 1;
+ - vertex4:INTEGER <- 2;
+ - index:INTEGER <- 3;
+ - normal:INTEGER <- 4;
+ - texture_coord1:INTEGER <- 5;
+ - texture_coord2:INTEGER <- 6;
+ - texture_coord3:INTEGER <- 7;
+ - texture_coord4:INTEGER <- 8;
+ - color4:INTEGER <- 9;
+
+
+ + type:INTEGER;
+ + capacity:INTEGER;
+
+ + control_points:FAST_ARRAY[REAL_32];
+
+
+ - create (t, cap:INTEGER) :SELF <-
+ (
+ + result:SELF;
+ result := SELF.clone;
+ result.make (t,cap);
+ result
+ );
+
+ - create_for_vertex3 cap:INTEGER :SELF <-
+ (
+ create (vertex3,cap)
+ );
+
+ - create_for_vertex4 cap:INTEGER :SELF <-
+ (
+ create (vertex4,cap)
+ );
+
+ - create_for_index cap:INTEGER :SELF <-
+ (
+ create (index,cap)
+ );
+
+ - create_for_normal cap:INTEGER :SELF <-
+ (
+ create (normal,cap)
+ );
+
+ - create_for_texture_coord1 cap:INTEGER :SELF <-
+ (
+ create (texture_coord1,cap)
+ );
+
+ - create_for_texture_coord2 cap:INTEGER :SELF <-
+ (
+ create (texture_coord2,cap)
+ );
+
+ - create_for_texture_coord3 cap:INTEGER :SELF <-
+ (
+ create (texture_coord3,cap)
+ );
+
+ - create_for_texture_coord4 cap:INTEGER :SELF <-
+ (
+ create (texture_coord4,cap)
+ );
+
+ - create_for_color4 cap:INTEGER :SELF <-
+ (
+ create (color4,cap)
+ );
+
+ - make (t,cap:INTEGER) <-
+ (
+ type := t;
+ capacity := cap;
+ );
+
+ - begin_control_points <-
+ (
+ control_points := FAST_ARRAY[REAL_32].create_with_capacity capacity;
+ );
+ - end <- ();
+ - new_control_points body:BLOCK <-
+ (
+ begin_control_points;
+ body.value;
+ end;
+ );
+
+ - add_point4f (x,y,z,w:REAL_32) <-
+ (
+ control_points.add_last x;
+ control_points.add_last y;
+ control_points.add_last z;
+ control_points.add_last w;
+ );
+
+ - add_point3f (x,y,z:REAL_32) <-
+ (
+ control_points.add_last x;
+ control_points.add_last y;
+ control_points.add_last z;
+ );
+
+ - add_point2f (x,y:REAL_32) <-
+ (
+ control_points.add_last x;
+ control_points.add_last y;
+ );
+
+ - add_point1f (x:REAL_32) <-
+ (
+ control_points.add_last x;
+ );
\ No newline at end of file
diff --git a/abstract_renderer/accum_buffer.li b/abstract_renderer/accum_buffer.li
new file mode 100644
index 0000000..2711a88
--- /dev/null
+++ b/abstract_renderer/accum_buffer.li
@@ -0,0 +1,67 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := ACCUM_BUFFER;
+
+ - comment := "Abstract Accumulation buffer";
+
+Section Inherit
+
+ - parent_object:OBJECT := OBJECT;
+
+Section Public
+
+ // accumulation functions
+ - accum:INTEGER <- 1; // accum_buffer = accum_buffer + val * color_buffer
+ - load:INTEGER <- 2; // accum_buffer = val * color_buffer
+ - return:INTEGER <- 3; // color_buffer = val * accum_buffer
+ - add:INTEGER <- 4; // accum_buffer = accum_buffer + val
+ - mult:INTEGER <- 5; // accum_buffer = val * accum_buffer
+
+ - set_function f:INTEGER value val:REAL_32 <- deferred;
+
+
+ // different way to use functions
+ - accumulate_with coef:REAL_32 <-
+ (
+ set_function accum value coef;
+ );
+ - load_with coef:REAL_32 <-
+ (
+ set_function load value coef;
+ );
+ - return_with coef:REAL_32 <-
+ (
+ set_function return value coef;
+ );
+ - add_with val:REAL_32 <-
+ (
+ set_function add value val;
+ );
+ - mult_with val:REAL_32 <-
+ (
+ set_function mult value val;
+ );
+
+ - clear <- deferred;
+
diff --git a/abstract_renderer/alpha_test.li b/abstract_renderer/alpha_test.li
new file mode 100644
index 0000000..02fd09e
--- /dev/null
+++ b/abstract_renderer/alpha_test.li
@@ -0,0 +1,44 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := ALPHA_TEST;
+
+ - comment := "Alpha Testing (only in RGBA mode)";
+
+Section Inherit
+
+ + parent_state:Expanded STATE;
+
+Section Public
+
+ // pixel test functions
+ - always:INTEGER <- 0; // test always sucess
+ - never:INTEGER <- 1; // test always fails
+ - less:INTEGER <- 2; // pixel drawn if its alpha-value is lesser than the corresponding depth buffer pixel
+ - lequal:INTEGER <- 3; // lesser or equal
+ - equal:INTEGER <- 4;
+ - gequal:INTEGER <- 5; // greater or equal
+ - greater:INTEGER <- 6;
+ - notequal:INTEGER <- 7; // not equal
+
+ - apply f:INTEGER with val:REAL_32 <- deferred;
\ No newline at end of file
diff --git a/abstract_renderer/blending.li b/abstract_renderer/blending.li
new file mode 100644
index 0000000..dafb678
--- /dev/null
+++ b/abstract_renderer/blending.li
@@ -0,0 +1,49 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := BLENDING;
+
+ - comment := "Abstact Blending Mode";
+
+Section Inherit
+
+ + parent_state:Expanded STATE;
+
+Section Public
+
+ // factors values
+ - zero:INTEGER <- 0; // (0, 0, 0, 0)
+ - one:INTEGER <- 1; // (1, 1, 1, 1)
+ - dst_color:INTEGER <- 2; // (destR, destG, destB, destA)
+ - one_minus_dst_color:INTEGER <- 3; // (1-destR, 1-destG, 1-destB, 1-destA)
+ - src_color:INTEGER <- 4; // (srcR, srcG, srcB, srcA)
+ - one_minus_src_color:INTEGER <- 5; // (1-srcR, 1-srcG, 1-srcB, 1-srcA)
+ - src_alpha:INTEGER <- 6; // (srcA, srcA, srcA, srcA)
+ - one_minus_src_alpha:INTEGER <- 7; // (1-srcA, 1-srcA, 1-srcA, 1-srcA)
+ - dst_alpha:INTEGER <- 8; // (destA, destA, destA, destA)
+ - one_minus_dst_alpha:INTEGER <- 9; // (1-destA, 1-destA, 1-destA, 1-destA)
+ - src_alpha_saturate:INTEGER <- 10; // (min(srcA, 1-destA), ...)
+
+ - apply (src_factor,dst_factor:INTEGER) <- deferred;
+
+ - set_alpha_value alpha:REAL_32 <- deferred;
\ No newline at end of file
diff --git a/abstract_renderer/capabilities.li b/abstract_renderer/capabilities.li
new file mode 100644
index 0000000..c71459d
--- /dev/null
+++ b/abstract_renderer/capabilities.li
@@ -0,0 +1,127 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := CAPABILITIES;
+
+ - comment := "Renderer settings";
+
+Section Inherit
+
+ - parent_object:OBJECT := OBJECT;
+
+Section Public
+
+ - nicest_quality:INTEGER <- 1;
+ - fastest_quality:INTEGER <- 2;
+ - default_quality:INTEGER <- 3;
+
+
+ - quality:INTEGER := nicest_quality;
+
+ - width:INTEGER;
+ - height:INTEGER;
+
+ - fov:REAL_32 := 45.0;
+
+ - is_fullscreen:BOOLEAN;
+
+
+ - has_doublebuffer:BOOLEAN := TRUE;
+ - buffer_size:INTEGER := 32;
+
+ - has_depth_buffer:BOOLEAN := TRUE;
+ - depth_size:INTEGER := 16;
+
+ - has_stencil_buffer:BOOLEAN;
+ - stencil_size:INTEGER := 1;
+
+ - has_accum_buffer:BOOLEAN;
+ - accum_red_size:INTEGER := 8;
+ - accum_green_size:INTEGER := 8;
+ - accum_blue_size:INTEGER := 8;
+ - accum_alpha_size:INTEGER := 8;
+
+ - has_alpha:BOOLEAN := TRUE;
+
+ - red_size:INTEGER := 8;
+ - green_size:INTEGER := 8;
+ - blue_size:INTEGER := 8;
+ - alpha_size:INTEGER := 8;
+
+
+ - set_dimensions (w,h:INTEGER) <-
+ (
+ width := w;
+ heigth := h;
+ );
+
+ - set_fov val:REAL_32 <-
+ (
+ fov := val;
+ );
+
+ - use_fullscreen <-
+ (
+ has_fullscreen := TRUE;
+ );
+
+ - use_doublebuffer <-
+ (
+ has_doublebuffer := TRUE;
+ );
+
+ - use_alpha_channel <-
+ (
+ has_alpha := TRUE;
+ );
+
+ - use_depth_buffer <-
+ (
+ has_depth_buffer := TRUE;
+ );
+
+ - use_stencil_buffer <-
+ (
+ has_stencil_buffer := TRUE;
+ );
+
+ - use_accum_buffer <-
+ (
+ has_accum_buffer := TRUE;
+ );
+
+ - use_default <-
+ (
+ quality := nicest_quality;
+
+ use_doublebuffer;
+ use_depth_buffer;
+ use_alpha_channel;
+ set_fov 45;
+
+ buffer_size := 32;
+ depth_size := 16;
+ stencil_size := 1;
+ red_size := blue_size := green_size := alpha_size := 8;
+ accum_red_size := accum_blue_size := accum_green_size := accum_alpha_size := 8;
+ );
\ No newline at end of file
diff --git a/abstract_renderer/color.li b/abstract_renderer/color.li
new file mode 100644
index 0000000..35940d4
--- /dev/null
+++ b/abstract_renderer/color.li
@@ -0,0 +1,39 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := COLOR;
+
+ - comment := "Generic type for colors";
+
+Section Inherit
+
+ - parent_object:OBJECT := OBJECT;
+
+Section Public
+
+ - r:REAL_32 <- deferred;
+ - g:REAL_32 <- deferred;
+ - b:REAL_32 <- deferred;
+ - a:REAL_32 <- deferred;
+
+ - getv:FAST_ARRAY[REAL_32] <- deferred;
\ No newline at end of file
diff --git a/abstract_renderer/color_buffer.li b/abstract_renderer/color_buffer.li
new file mode 100644
index 0000000..923747b
--- /dev/null
+++ b/abstract_renderer/color_buffer.li
@@ -0,0 +1,76 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := COLOR_BUFFER;
+
+ - comment := "abstract pixel color buffer";
+
+Section Inherit
+
+ - parent_object:OBJECT := OBJECT;
+
+Section Public
+
+ - rgb:INTEGER <- 0;
+ - rgba:INTEGER <- 1;
+ - red:INTEGER <- 2;
+ - green:INTEGER <- 3;
+ - blue:INTEGER <- 4;
+ - alpha:INTEGER <- 5;
+ - luminance:INTEGER <- 6; // grey (single component)
+ - luminance_alpha:INTEGER <- 7; // grey+alpha
+ - stencil_index:INTEGER <- 8;
+ - depth_component:INTEGER <- 9;
+
+
+ - clear <- deferred;
+ - set_clear_value (r,g,b,a:REAL_32) <- deferred;
+
+ - set_color c:COLOR <- deferred;
+ - set_color3f (r,g,b:REAL_32) <- deferred;
+ - set_color4f (r,g,b,a:REAL_32) <- deferred;
+
+ - set_mask (r,g,b,a:BOOLEAN) <- deferred;
+
+ - enable <- deferred;
+ - disable <- deferred;
+
+ //
+ // FrameBuffer transfert functions
+ //
+
+ - read (x,y:INTEGER) size (w,h:INTEGER) type t:INTEGER in buf:FAST_ARRAY[UINTEGER_8] <- deferred;
+
+ - read_rgb (x,y:INTEGER) size (w,h:INTEGER) in buf:FAST_ARRAY[UINTEGER_8] <- deferred;
+ - read_rgba (x,y:INTEGER) size (w,h:INTEGER) in buf:FAST_ARRAY[UINTEGER_8] <- deferred;
+
+
+ - draw_pixels pixels:FAST_ARRAY[UINTEGER_8] size (w,h:INTEGER) type t:INTEGER <- deferred;
+
+ - draw_rgb_pixels pixels:FAST_ARRAY[UINTEGER_8] size (w,h:INTEGER) <- deferred;
+ - draw_rgba_pixels pixels:FAST_ARRAY[UINTEGER_8] size (w,h:INTEGER) <- deferred;
+
+ - copy (x,y:INTEGER) size (w,h:INTEGER) type t:INTEGER <- deferred;
+
+ - copy_rgb (x,y:INTEGER) size (w,h:INTEGER) <- deferred;
+ - copy_rgba (x,y:INTEGER) size (w,h:INTEGER) <- deferred;
\ No newline at end of file
diff --git a/abstract_renderer/culling.li b/abstract_renderer/culling.li
new file mode 100644
index 0000000..48a187d
--- /dev/null
+++ b/abstract_renderer/culling.li
@@ -0,0 +1,67 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := CULLING;
+
+ - comment := "Abstract Culling Mode";
+
+Section Inherit
+
+ + parent_state:Expanded STATE;
+
+Section Public
+
+ // culling modes
+ - front:INTEGER <- 1;
+ - back:INTEGER <- 2;
+
+ // culling function
+ - clockwise:INTEGER <- 3;
+ - counter_clockwise:INTEGER <- 4;
+
+
+ - apply mode:INTEGER <- deferred;
+ - set_orientation o:INTEGER <- deferred;
+
+
+ // aliases
+ - apply_front <-
+ (
+ apply front;
+ );
+
+ - apply_back <-
+ (
+ apply back;
+ );
+
+ - set_clockwise <-
+ (
+ set_orientation clockwise;
+ );
+
+ - set_counter_clockwise <-
+ (
+ set_orientation counter_clockwise;
+ );
+
diff --git a/abstract_renderer/depth_buffer.li b/abstract_renderer/depth_buffer.li
new file mode 100644
index 0000000..ba6373a
--- /dev/null
+++ b/abstract_renderer/depth_buffer.li
@@ -0,0 +1,50 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := DEPTH_BUFFER;
+
+ - comment := "abstract pixel buffer";
+
+Section Inherit
+
+ + parent_state:Expanded STATE;
+
+Section Public
+
+ // pixel test functions
+ - always:INTEGER <- 0; // test always sucess
+ - never:INTEGER <- 1; // test always fails
+ - less:INTEGER <- 2; // pixel drawn if its Z-value is lesser than the corresponding depth buffer pixel
+ - lequal:INTEGER <- 3; // lesser or equal: (pixelDepth <= bufferDepth) => draw pixel else don't
+ - equal:INTEGER <- 4;
+ - gequal:INTEGER <- 5; // greater or equal
+ - greater:INTEGER <- 6;
+ - notequal:INTEGER <- 7; // not equal
+
+ - set_clear_value val:REAL_32 <- deferred;
+ - clear <- deferred;
+
+ - lock <- deffered;
+ - unlock <- deffered;
+
+ - set_function f:INTEGER <- deferred;
\ No newline at end of file
diff --git a/abstract_renderer/display_list.li b/abstract_renderer/display_list.li
new file mode 100644
index 0000000..5e78a3c
--- /dev/null
+++ b/abstract_renderer/display_list.li
@@ -0,0 +1,38 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := DISPLAY_LIST;
+
+ - author := "api independant display list";
+
+Section Inherit
+
+ - parent_object:OBJECT := OBJECT;
+
+Section Public
+
+ - create body:BLOCK :SELF <- deferred;
+
+ - call <- deferred;
+
+ - destroy <- deferred;
diff --git a/abstract_renderer/error.li b/abstract_renderer/error.li
new file mode 100644
index 0000000..8d41764
--- /dev/null
+++ b/abstract_renderer/error.li
@@ -0,0 +1,78 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := ERROR;
+
+ - comment := "Renderer error";
+
+Section Inherit
+
+ - parent_object:OBJECT := OBJECT;
+
+Section Public
+
+ //
+ // Error codes
+ //
+
+ - no_error:INTEGER <- 0;
+ - invalid_enum:INTEGER <- 1;
+ - invalid_value:INTEGER <- 2;
+ - invalid_operation:INTEGER <- 3;
+ - stack_overflow:INTEGER <- 4;
+ - stack_underflow:INTEGER <- 5;
+ - out_of_memory:INTEGER <- 6;
+
+ - last_error:INTEGER := no_error;
+
+
+ // return current error state variable
+ - get:INTEGER <- deferred;
+
+ // return details of error
+ - get buffer:STRING from code:INTEGER <- deferred;
+
+ - get_string <-
+ (
+ msg_error.clear;
+ get msg_error from last_error;
+ );
+
+ - print_error <-
+ (
+ get_string;
+ STD_ERROR.put_string msg_error;
+ );
+
+ - print msg:ABSTRACT_STRING <-
+ (
+ msg_error.clear;
+ msg_error.append "\nRenderer error: ";
+ msg_error.append msg;
+
+ STD_ERROR.put_string msg_error;
+ );
+
+Section Public
+
+ - msg_error:STRING := STRING.create 256;
\ No newline at end of file
diff --git a/abstract_renderer/evaluator1d.li b/abstract_renderer/evaluator1d.li
new file mode 100644
index 0000000..dd4dc4c
--- /dev/null
+++ b/abstract_renderer/evaluator1d.li
@@ -0,0 +1,50 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := EVALUATOR1D;
+
+ - comment := "Maps a curve line";
+
+Section Inherit
+
+ + parent_abstract_evaluator:Expanded ABSTRACT_EVALUATOR;
+
+Section Public
+
+ // mesh drawing modes
+ - line:INTEGER <- 1;
+ - point:INTEGER <- 2;
+
+
+ // load the map function
+ - map (n_points,point_size:INTEGER) range (t1,t2:REAL_32) <- deferred;
+
+ // generate a point for the parametric value 'val'
+ - evaluate val:REAL_32 <- deferred;
+
+ // auto generate n points evenly spaced between (t1,t2)
+ - generate_grid nb_points:INTEGER between (t1,t2:REAL_32) <- deferred;
+
+ // Warning: mode is defined in the vertex buffer prototype
+ - evaluate_mesh mode:INTEGER from start:INTEGER to end:INTEGER <- deferred;
+
\ No newline at end of file
diff --git a/abstract_renderer/evaluator2d.li b/abstract_renderer/evaluator2d.li
new file mode 100644
index 0000000..4bce65d
--- /dev/null
+++ b/abstract_renderer/evaluator2d.li
@@ -0,0 +1,50 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := EVALUATOR2D;
+
+ - comment := "Maps a spline surface";
+
+Section Inherit
+
+ + parent_abstract_evaluator:Expanded ABSTRACT_EVALUATOR;
+
+Section Public
+
+ // mesh drawing modes
+ - line:INTEGER <- 1;
+ - point:INTEGER <- 2;
+ - fill:INTEGER <- 3;
+
+ // load the map function
+ - map (u_order,u_size:INTEGER) and (v_order,v_size:INTEGER) range (u1,v1:REAL_32) to (u2,v2:REAL_32) <- deferred;
+
+ // generate a point for the parametric values x,y
+ - evaluate (x,y:REAL_32) <- deferred;
+
+ // auto generate n points evenly spaced between (t1,t2)
+ - generate_grid (w,h:INTEGER) between (u1,u2:REAL_32) and (v1,v2:REAL_32) <- deferred;
+
+ // Warning: mode is defined in the vertex buffer prototype
+ - evaluate_mesh mode:INTEGER from (start1,start2:INTEGER) to (end1,end2:INTEGER) <- deferred;
+
diff --git a/abstract_renderer/fog.li b/abstract_renderer/fog.li
new file mode 100644
index 0000000..0f5a5b3
--- /dev/null
+++ b/abstract_renderer/fog.li
@@ -0,0 +1,82 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := FOG;
+
+ - comment := "Fog properties";
+
+Section Inherit
+
+ + parent_state:Expanded STATE;
+
+Section Public
+
+ // fog modes
+ - filter_linear:INTEGER <- 1;
+ - filter_exp:INTEGER <- 2;
+
+ - fogmode:INTEGER := filter_linear; // best fog rendering mode
+
+ + color:COLOR;
+ + density:REAL_32;
+
+ // fog depth
+ + start:REAL_32;
+ + end:REAL_32;
+
+ - create (c:COLOR, d,s,e:REAL_32) :SELF <-
+ (
+ + result:SELF;
+ result := SELF.clone;
+ result.make (c,d,s,e);
+ result
+ );
+
+ - make (c:COLOR, d,s,e:REAL_32) <-
+ (
+ color := c;
+ density := d;
+ start := s;
+ end := e;
+ render;
+ );
+
+ - set_filter f:INTEGER <- fogmode := f;
+
+ - set_color c:COLOR <-
+ (
+ color := c;
+ );
+
+ - set_density d:REAL_32 <-
+ (
+ density := d;
+ );
+
+ - set_depth (s,e:REAL_32) <-
+ (
+ start := s;
+ end := e;
+ );
+
+ - render <- deferred;
\ No newline at end of file
diff --git a/abstract_renderer/font.li b/abstract_renderer/font.li
new file mode 100644
index 0000000..2ab10ce
--- /dev/null
+++ b/abstract_renderer/font.li
@@ -0,0 +1,71 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := FONT;
+
+ - comment := "rendered font";
+
+Section Inherit
+
+ - parent_object:OBJECT := OBJECT;
+
+Section Public
+
+ + name:STRING;
+
+ + font_height:UINTEGER_32 := 24;
+ + nb_chars:INTEGER := 96;
+
+
+ - create s:ABSTRACT_STRING :SELF <-
+ (
+ + result:SELF;
+ result := SELF.clone;
+ result.make s;
+ result
+ );
+
+ - make s:ABSTRACT_STRING <-
+ (
+ name := STRING.create_from_string s;
+
+ load;
+ );
+
+ - enable <- deferred;
+ - disable <- deferred;
+
+ - print_zone body:BLOCK <-
+ (
+ enable;
+ body.value;
+ disable;
+ );
+
+ - load <- deferred;
+ - unload <- deferred;
+
+ - print text:ABSTRACT_STRING at (x,y:INTEGER) <- deferred;
+
+ // get default font
+ - default:FONT <- (deferred;NULL);
diff --git a/abstract_renderer/index_buffer.li b/abstract_renderer/index_buffer.li
new file mode 100644
index 0000000..c88878e
--- /dev/null
+++ b/abstract_renderer/index_buffer.li
@@ -0,0 +1,60 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := INDEX_BUFFER;
+
+ - comment := "api independant index buffer";
+
+Section Inherit
+
+ - parent_object:OBJECT := OBJECT;
+
+Section Public
+
+ - create sz:INTEGER :SELF <-
+ ( + result:SELF;
+ result := SELF.clone;
+ result.make sz;
+ result
+ );
+
+ - make sz:INTEGER <- deferred;
+
+ - bind <- deferred;
+
+ - destroy <- deferred;
+
+ - begin_index <- deferred;
+ - end <- deferred;
+
+ - new_indices body:BLOCK <-
+ (
+ begin_indices;
+ body.value;
+ end;
+ );
+
+ - draw mode:INTEGER size sz:INTEGER <- deferred;
+
+ - add_index i:UINTEGER_16 <- deferred;
+
diff --git a/abstract_renderer/light.li b/abstract_renderer/light.li
new file mode 100644
index 0000000..25b24c8
--- /dev/null
+++ b/abstract_renderer/light.li
@@ -0,0 +1,108 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := LIGHT;
+
+ - comment := "Light properties";
+
+Section Inherit
+
+ + parent_state:Expanded STATE;
+
+Section Public
+
+ + ambient:COLOR; // scattered light - no particular direction
+ + diffuse:COLOR; // conic light
+ + specular:COLOR; // shininess
+
+ + position:VECTOR3[REAL_32];
+
+ + is_directional:BOOLEAN; // if true 'position' is the direction
+
+ + modified:BOOLEAN;
+
+
+ - create (a,d,s:COLOR) at (pos:VECTOR3[REAL_32]) :SELF <-
+ (
+ + result:SELF;
+ result := SELF.clone;
+ result.make (a,d,s,pos);
+ result
+ );
+
+ - make (a,d,s:COLOR, pos:VECTOR3[REAL_32]) <-
+ (
+ ambient := a;
+ diffuse := d;
+ specular := s;
+
+ position := pos;
+ modified := TRUE;
+ );
+
+ //
+ // Lighting Model
+ //
+
+ - set_model_ambient col:RGBA <- deferred;
+ - set_model_local_viewer b:BOOLEAN <- deferred;
+ - set_model_two_side b:BOOLEAN <- deferred;
+
+
+ - notify <-
+ (
+ modified := TRUE;
+ );
+
+ - set_ambient c:COLOR <-
+ (
+ notify;
+ ambient := c;
+ );
+
+ - set_diffuse c:COLOR <-
+ (
+ notify;
+ diffuse := c;
+ );
+
+ - set_specular c:COLOR <-
+ (
+ notify;
+ specular := c;
+ );
+
+ - set_position p:VECTOR3[REAL_32] <-
+ (
+ notify;
+ position := p;
+ );
+
+ - set_directional <-
+ (
+ notify;
+ is_directional := TRUE;
+ );
+
+ - enable_default_light <- deferred;
+ - disable_default_light <- deferred;
\ No newline at end of file
diff --git a/abstract_renderer/material.li b/abstract_renderer/material.li
new file mode 100644
index 0000000..56b07d7
--- /dev/null
+++ b/abstract_renderer/material.li
@@ -0,0 +1,120 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := MATERIAL;
+
+ - comment := "Material: lighting properties of an object";
+
+Section Inherit
+
+ - parent_object:OBJECT := OBJECT;
+
+Section Public
+
+ - mode_front:INTEGER <- 1;
+ - mode_back:INTEGER <- 2;
+ - mode_front_and_back:INTEGER <- 3;
+
+
+ + ambient:COLOR; // percentage of reflected ambient light
+ + diffuse:COLOR;
+ + specular:COLOR;
+
+ + emission:COLOR; // emissive color of material
+
+ + shininess:REAL_32; // specular exponent
+
+
+ - create (a,d,s,e:COLOR, shine:REAL_32) :SELF <-
+ (
+ + result:SELF;
+ result := SELF.clone;
+ result.make (a,d,s,e,shine);
+ result
+ );
+
+ - make (a,d,s,e:COLOR, shine:REAL_32) <-
+ (
+ ambient := a;
+ diffuse := d;
+ specular := s;
+ emission := e;
+
+ shininess := shine;
+ );
+
+ - enable_color <- deferred;
+ - disable_color <- deferred;
+
+ - notify <-
+ (
+ // modified := TRUE;
+ );
+
+ - set_ambient c:COLOR <-
+ (
+ notify;
+ ambient := c;
+ );
+
+ - set_diffuse c:COLOR <-
+ (
+ notify;
+ diffuse := c;
+ );
+
+ - set_specular c:COLOR <-
+ (
+ notify;
+ specular := c;
+ );
+
+ - set_emission c:COLOR <-
+ (
+ notify;
+ emission := c;
+ );
+
+ - set_shininess s:REAL_32 <-
+ (
+ notify;
+ shininess := s;
+ );
+
+ - apply mode:INTEGER <- deferred;
+
+ // aliases
+ - apply_front <-
+ (
+ apply mode_front;
+ );
+
+ - apply_back <-
+ (
+ apply mode_back;
+ );
+
+ - apply_front_and_back <-
+ (
+ apply mode_front_and_back;
+ );
\ No newline at end of file
diff --git a/abstract_renderer/name_stack.li b/abstract_renderer/name_stack.li
new file mode 100644
index 0000000..58dd1ba
--- /dev/null
+++ b/abstract_renderer/name_stack.li
@@ -0,0 +1,39 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := NAME_STACK;
+
+ - comment := "Used by pickable objects using Selection buffer";
+
+Section Inherit
+
+ - parent_object:OBJECT := OBJECT;
+
+Section Public
+
+ - init <- deferred;
+
+ - load n:UINTEGER_32 <- deferred;
+
+ - push n:UINTEGER_32 <- deferred;
+ - pop <- deferred;
\ No newline at end of file
diff --git a/abstract_renderer/plane.li b/abstract_renderer/plane.li
new file mode 100644
index 0000000..d617f9d
--- /dev/null
+++ b/abstract_renderer/plane.li
@@ -0,0 +1,54 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := PLANE;
+
+ - comment := "a*x+b*y+c*z+d >= 0 clipping plane";
+
+Section Inherit
+
+ + parent_vector:Expanded VECTOR4[REAL_32];
+
+ + parent_state:Expanded STATE;
+
+Section Public
+
+ - a:REAL_32 <- x;
+ - b:REAL_32 <- y;
+ - c:REAL_32 <- z;
+ - d:REAL_32 <- w;
+
+ - make (p1,p2,p3,p4:REAL_32) <-
+ (
+ x := p1;
+ y := p2;
+ z := p3;
+ w := p4;
+
+ load_clipping_plane;
+ );
+
+ - load_clipping_plane <- ();
+
+ - clip <- deferred;
+ - unclip <- deferred;
\ No newline at end of file
diff --git a/abstract_renderer/quadrics.li b/abstract_renderer/quadrics.li
new file mode 100644
index 0000000..c5d7f65
--- /dev/null
+++ b/abstract_renderer/quadrics.li
@@ -0,0 +1,60 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := QUADRICS;
+
+ - comment := "3D Primitive (sphere,cylinder,...)";
+
+Section Inherit
+
+ - parent_object:OBJECT := OBJECT;
+
+Section Public
+
+ - fill_mode:INTEGER <- 1;
+ - point_mode:INTEGER <- 2;
+ - line_mode:INTEGER <- 3;
+
+ - begin_quadric <- deferred;
+ - end_quadric <- deferred;
+
+ - new_quadric body:BLOCK <-
+ (
+ begin_quadric;
+ body.value;
+ end_quadric;
+ );
+
+ - enable_texture <- deferred;
+
+ - disable_texture <- deferred;
+
+ - set_style style:INTEGER <- deferred;
+
+ //
+ // Quadrics
+ //
+
+ - draw_sphere (radius,slices,stacks:REAL_32) <- deferred;
+ - draw_cylinder (base,top,height,slices,stacks:REAL_32) <- deferred;
+ - draw_disk (inner,outer,slices,loops:REAL_32) <- deferred;
\ No newline at end of file
diff --git a/abstract_renderer/renderer.li b/abstract_renderer/renderer.li
new file mode 100644
index 0000000..a63d31f
--- /dev/null
+++ b/abstract_renderer/renderer.li
@@ -0,0 +1,152 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := RENDERER;
+
+ - comment := "abstract prototype for render systems";
+
+Section Inherit
+
+ - parent_capabilities:CAPABILITIES := CAPABILITIES;
+
+Section Public
+
+ - set_capabilities caps:CAPABILITIES <-
+ (
+ parent_capabilities := caps;
+ );
+
+ //
+ // Renderer settings
+ //
+
+ - viewport:VIEWPORT; // current viewport
+
+ - reshape:RESHAPE := RESHAPE; // for projection modification & re-sizing
+
+ //
+ // Renderer Modules
+ //
+
+ - transform:TRANSFORM <- deferred; // 3D transformation & projection
+ - font:FONT <- deferred;
+ - texture1d:TEXTURE <- deferred;
+ - texture2d:TEXTURE <- deferred;
+ - light:LIGHT <- deferred;
+ - material:MATERIAL <- deferred;
+ - plane:PLANE <- deferred;
+ - quadrics:QUADRICS <- deferred;
+ - blending:BLENDING <- deferred;
+ - culling:CULLING <- deferred;
+ - fog:FOG;
+
+ //
+ // Renderer features
+ //
+
+ - vb:VERTEX_BUFFER; // current vertex buffer
+ - vertex_array:VERTEX_BUFFER <- deferred;
+ - vertex_buffer:VERTEX_BUFFER <- deferred;
+ - index_buffer:INDEX_BUFFER <- deferred;
+ - display_list:DISPLAY_LIST <- deferred;
+
+ - color_buffer:COLOR_BUFFER <- deferred;
+ - depth_buffer:DEPTH_BUFFER <- deferred;
+ - stencil_buffer:STENCIL_BUFFER <- deferred;
+ - accum_buffer:ACCUM_BUFFER <- deferred;
+ - alpha_test:ALPHA_TEST <- deferred;
+ - scissor:SCISSOR <- deferred;
+
+ - evaluator1d:EVALUATOR1D <- deferred;
+ - evaluator2d:EVALUATOR2D <- deferred;
+
+ - shader:SHADER <- deferred;
+
+ - name_stack:NAME_STACK <- deferred;
+
+ - error:ERROR <- (deferred;NULL);
+
+
+ - enable_shading <- deferred;
+ - disable_shading <- deferred;
+
+ - enable_lighting <- deferred;
+ - disable_lighting <- deferred;
+
+ - enable_auto_normal <- deferred;
+ - disable_auto_normal <- deferred;
+
+ - wireframe_mode on:BOOLEAN <- deferred;
+
+ - set_point_size sz:REAL_32 <- deferred;
+ - set_line_width w:REAL_32 <- deferred;
+
+ //
+ // Selection mode
+ //
+
+ - begin_selection_in buffer:FAST_ARRAY[UINTEGER_32] size sz:INTEGER <- deferred;
+ - end_selection:INTEGER <- deferred;
+
+ // make with default settings
+ - make (w,h:INTEGER) title s:ABSTRACT_STRING fullscreen b:BOOLEAN <-
+ (
+ deferred;
+ );
+
+ - make settings:SETTINGS title s:ABSTRACT_STRING <-
+ (
+ parent_settings := settings;
+ make (width, height) title s fullscreen is_fullscreen;
+ );
+
+ - initialize <- deferred;
+
+ - begin_frame <- deferred;
+ - end_frame <- deferred;
+ - new_frame body:BLOCK <- deferred;
+
+ - clear_screen <- deferred;
+
+ - set_fog f:FOG <- deferred;
+
+ - resize (w,h:INTEGER) <- deferred;
+
+ - set_reshape r:RESHAPE <-
+ (
+ reshape := r;
+ r.set_render_system Self;
+ );
+
+ - fatal_error msg:ABSTRACT_STRING <-
+ (
+ msg.print;
+ die_with_code exit_failure_code;
+ );
+
+ // renderer info
+ - video_card_name buf:STRING <- deferred;
+ - video_card_vendor buf:STRING <- deferred;
+ - video_card_version buf:STRING <- deferred;
+
+
diff --git a/abstract_renderer/reshape.li b/abstract_renderer/reshape.li
new file mode 100644
index 0000000..050f23f
--- /dev/null
+++ b/abstract_renderer/reshape.li
@@ -0,0 +1,70 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := RESHAPE;
+
+Section Inherit
+
+ - parent_object:OBJECT := OBJECT;
+
+Section Private
+
+ - r:RENDERER;
+
+Section Public
+
+ - set_render_system renderer:RENDERER <-
+ (
+ r := renderer;
+ );
+
+ //
+ // Reshape Events
+ //
+
+ - on_resize (w,h:INTEGER) <-
+ ( + ratio,f:REAL_32;
+
+ `glViewport(0, 0, @w, @h)`;
+ `glMatrixMode(GL_PROJECTION)`;
+ `glLoadIdentity()`;
+ ratio := w.to_real / h.to_real;
+ f := r.fov;
+ `gluPerspective(@f, @ratio, 0.1, 1000)`;
+ `glMatrixMode(GL_MODELVIEW)`;
+ `glLoadIdentity()`;
+
+
+ /* r.transform.set_viewport (r.viewport);
+
+ // modify projection matrix
+ r.transform.new_projection {
+ r.transform.load_identity;
+
+ r.transform.perspective (r.fov, w.to_real/h.to_real, 0.1, 1000.0);
+ };
+ // clear modelview matrix
+ r.transform.load_identity;
+ */
+ );
+
diff --git a/abstract_renderer/rgb.li b/abstract_renderer/rgb.li
new file mode 100644
index 0000000..606f1b1
--- /dev/null
+++ b/abstract_renderer/rgb.li
@@ -0,0 +1,40 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := RGB;
+
+ - comment := "(r,g,b) color";
+
+Section Inherit
+
+ + parent_vector:Expanded VECTOR3[REAL_32];
+
+ - parent_color:COLOR := COLOR;
+
+Section Public
+
+ - r:REAL_32 <- x;
+ - g:REAL_32 <- y;
+ - b:REAL_32 <- z;
+
+ - getv:FAST_ARRAY[REAL_32] <- parent_vector.getv;
\ No newline at end of file
diff --git a/abstract_renderer/rgba.li b/abstract_renderer/rgba.li
new file mode 100644
index 0000000..163d7aa
--- /dev/null
+++ b/abstract_renderer/rgba.li
@@ -0,0 +1,42 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := RGBA;
+
+ - comment := "(r,g,b,a) color";
+
+Section Inherit
+
+ + parent_vector:Expanded VECTOR4[REAL_32];
+
+ - parent_color:COLOR := COLOR;
+
+Section Public
+
+ - r:REAL_32 <- x;
+ - g:REAL_32 <- y;
+ - b:REAL_32 <- z;
+ - a:REAL_32 <- w;
+
+ - getv:FAST_ARRAY[REAL_32] <- parent_vector.getv;
+
\ No newline at end of file
diff --git a/abstract_renderer/scissor.li b/abstract_renderer/scissor.li
new file mode 100644
index 0000000..2215720
--- /dev/null
+++ b/abstract_renderer/scissor.li
@@ -0,0 +1,38 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := SCISSOR;
+
+ - comment := "Viewport clipping";
+
+Section Inherit
+
+ + parent_state:Expanded STATE;
+
+Section Public
+
+ - cut v:VIEWPORT <- deferred;
+
+ - cut4i (x,y,width,height:UINTEGER_32) <- deferred;
+
+ - get_scissor_box viewport:VIEWPORT <- deferred;
\ No newline at end of file
diff --git a/abstract_renderer/shader.li b/abstract_renderer/shader.li
new file mode 100644
index 0000000..e4be13c
--- /dev/null
+++ b/abstract_renderer/shader.li
@@ -0,0 +1,58 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := SHADER;
+
+ - comment := "Abstract Shader Object";
+
+Section Inherit
+
+ - parent_object:OBJECT := OBJECT;
+
+Section Public
+
+ - create (vertex_shader,fragment_shader:ABSTRACT_STRING) :SELF <-
+ ( + result:SELF;
+ result := SELF.clone;
+ result.make (vertex_shader,fragment_shader);
+ result
+ );
+
+ - make (vertex_shader,fragment_shader:ABSTRACT_STRING) <- deferred;
+
+ - has_compiled:BOOLEAN <- deferred;
+ - get_infolog buffer:STRING <- deferred;
+
+ - enable <- deferred;
+ - disable <- deferred;
+
+ - get_uniform_location varname:ABSTRACT_STRING :INTEGER <- deferred;
+
+ - set_uniform1f loc:INTEGER to val:REAL_32 <- deferred;
+ - set_uniform2f loc:INTEGER to (v0,v1:REAL_32) <- deferred;
+ - set_uniform3f loc:INTEGER to (v0,v1,v2:REAL_32) <- deferred;
+ - set_uniform4f loc:INTEGER to (v0,v1,v2,v3:REAL_32) <- deferred;
+
+ - bind_sampler tex:TEXTURE unit u:INTEGER location loc:INTEGER <- deferred;
+
+ - delete <- deferred;
diff --git a/abstract_renderer/state.li b/abstract_renderer/state.li
new file mode 100644
index 0000000..a8776da
--- /dev/null
+++ b/abstract_renderer/state.li
@@ -0,0 +1,87 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := STATE;
+
+ - comment := "The renderer is a Finite-State Machine";
+
+Section Inherit
+
+ - parent_object:OBJECT := OBJECT;
+
+Section Private
+
+ + stack:LINKED_LIST[BOOLEAN];
+
+Section Public
+
+ //
+ // Current states:
+ // - lights
+ // - planes
+ // - textures
+ // - depth test
+ // - alpha test
+ // - stencil test
+ // - scissor test
+ // - blending
+ // - culling
+ // - fog
+
+ + is_enabled:BOOLEAN;
+
+
+ - enable <-
+ (
+ is_enabled := TRUE;
+ );
+
+ - disable <-
+ (
+ is_enabled := FALSE;
+ );
+
+ - push_attrib <- deferred;
+ - pop_attrib <- deferred;
+ - new_attrib body:BLOCK <-
+ (
+ push_attrib;
+ body.value;
+ pop_attrib;
+ );
+
+
+ - save <-
+ (
+ (stack = NULL).if {
+ stack := LINKED_LIST[BOOLEAN].create;
+ };
+ stack.add_last is_enabled;
+ );
+
+ - restore <-
+ (
+ ? {(stack != NULL) && {stack.count > 1}};
+ is_enabled := stack.last;
+ stack.remove_last;
+ );
\ No newline at end of file
diff --git a/abstract_renderer/stencil_buffer.li b/abstract_renderer/stencil_buffer.li
new file mode 100644
index 0000000..a0580d2
--- /dev/null
+++ b/abstract_renderer/stencil_buffer.li
@@ -0,0 +1,43 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := STENCIL_BUFFER;
+
+ - comment := "store some bits for each pixels ";
+
+Section Inherit
+
+ + parent_depth_buffer:Expanded DEPTH_BUFFER; // extends depth buffer
+
+Section Public
+
+ // stencil operations
+ - keep:INTEGER <- 1; // do not change value
+ - replace:INTEGER <- 2; // replace value
+ - incr:INTEGER <- 3; // increment value
+ - decr:INTEGER <- 4; // decrement value
+ - invert:INTEGER <- 5; // invert bits value
+
+
+ - set_function f:INTEGER value val:INTEGER_32 mask m:UINTEGER_32 <- deferred;
+ - when_pass op1:INTEGER when_fail op2:INTEGER when_zfail op3:INTEGER <- deferred;
\ No newline at end of file
diff --git a/abstract_renderer/texture.li b/abstract_renderer/texture.li
new file mode 100644
index 0000000..31609fc
--- /dev/null
+++ b/abstract_renderer/texture.li
@@ -0,0 +1,120 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := TEXTURE;
+
+ - comment := "rendered image";
+
+Section Inherit
+
+ + parent_image:IMAGE := IMAGE;
+
+ + parent_state:Expanded STATE;
+
+Section Public
+
+ //
+ // texture parameters
+ //
+
+ // filters: how to draw texture
+ - filter_nearest:INTEGER <- 1;
+ - filter_linear:INTEGER <- 2;
+ - filter_mipmap:INTEGER <- 3;
+
+ - filter:INTEGER := filter_mipmap;
+
+ // texture functions: how to combine texture on its polygon
+ - decal:INTEGER <- 1;
+ - replace:INTEGER <- 2;
+ - modulate:INTEGER <- 3;
+ - blend:INTEGER <- 4;
+
+ - drawing_mode:INTEGER := modulate;
+
+ // border behaviour: what to draw when texels outside [0,1]
+ - clamp:INTEGER <- 1;
+ - repeat:INTEGER <- 2;
+ - clamp_to_edge:INTEGER <- 3;
+
+ - wrapping_mode:INTEGER := repeat;
+
+ //
+ // Create.
+ //
+
+ - create_from image:IMAGE :SELF <-
+ ( + result:SELF;
+ result := SELF.clone;
+ result.make image;
+ result
+ );
+
+ - create_from_data pixels:FAST_ARRAY[UINTEGER_8] size (w,h:INTEGER) type t:INTEGER :SELF <-
+ ( + result:SELF;
+ result := SELF.clone;
+ result.make_from_data pixels size (w,h) type t;
+ result
+ );
+
+ - create_from_framebuffer (x,y,w,h:INTEGER) type t:INTEGER :SELF <-
+ ( + result:SELF;
+ result := SELF.clone;
+ result.make_from_framebuffer (x,y,w,h) type t;
+ result
+ );
+
+ - create_empty (w,h:INTEGER) type t:INTEGER :SELF <-
+ ( + result:SELF;
+ result := SELF.clone;
+ result.make_empty (w,h) type t;
+ result
+ );
+
+ - make image:IMAGE <- deferred;
+ - make_from_data pixels:FAST_ARRAY[UINTEGER_8] size (x,y,w,h:INTEGER) type t:INTEGER <- deferred;
+ - make_from_framebuffer (x,y,w,h:INTEGER) type t:INTEGER <- deferred;
+
+ - replace_region (x,y,w,h:INTEGER) with_data (pixels:FAST_ARRAY[UINTEGER_8],type:INTEGER) <- deferred;
+ - replace_region (x,y,w,h:INTEGER) with image:IMAGE <- deferred;
+
+ - replace_region (x,y,w,h:INTEGER) with_framebuffer_at (x0,y0:INTEGER) <- deferred;
+
+ - enable_unit n:INTEGER <- deferred;
+ - disable_unit n:INTEGER <- deferred;
+
+ - bind <- deferred;
+ - bind_unit n:INTEGER <- deferred;
+
+ - set_image image:IMAGE <-
+ (
+ parent_image := image;
+ );
+
+ - draw (x,y:INTEGER) <- deferred;
+
+ - draw_strech (x,y,w,h:INTEGER) <- deferred;
+
+ - set_filter f:INTEGER <- filter := f;
+ - set_drawing_mode f:INTEGER <- drawing_mode := f;
+ - set_wrapping_mode f:INTEGER <- wrapping_mode := f;
\ No newline at end of file
diff --git a/abstract_renderer/transform.li b/abstract_renderer/transform.li
new file mode 100644
index 0000000..598bc5a
--- /dev/null
+++ b/abstract_renderer/transform.li
@@ -0,0 +1,102 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := TRANSFORM;
+
+ - comment := "3 types of transformation: modelview, projection, viewport";
+
+Section Inherit
+
+ - parent_object:OBJECT := OBJECT;
+
+Section Public
+
+ - load_identity <- deferred;
+
+ - push_matrix <- deferred;
+ - pop_matrix <- deferred;
+ - new_matrix body:BLOCK <-
+ (
+ push_matrix;
+ body.value;
+ pop_matrix;
+ );
+
+ // operations on current matrix
+ - load_matrix m:MATRIX4[REAL_32] <- deferred;
+ - mult_matrix_by m:MATRIX4[REAL_32] <- deferred;
+
+
+ //
+ // Viewing & Modeling transformations
+ //
+
+ - set_modelview_mode <- deferred;
+
+ - translatef (x,y,z:REAL_32) <- deferred;
+ - rotatef (val,x,y,z:REAL_32) <- deferred;
+ - scalef (x,y,z:REAL_32) <- deferred;
+
+ - get_modelview matrix:MATRIX4[REAL_32] <- deferred;
+
+ //
+ // Projection transformations
+ //
+
+ - set_projection_mode <- deferred;
+ - new_projection body:BLOCK <-
+ (
+ set_projection_mode;
+ body.value;
+ set_modelview_mode;
+ );
+
+ - perspective (fovy,aspect,near,far:REAL_32) <- deferred;
+ - frustum (left,right,bottom,top,near,far:REAL_32) <- deferred;
+
+ - orthographic (left,right,bottom,top,near,far:REAL_32) <- deferred;
+ - orthographic2d (left,right,bottom,top:REAL_32) <- deferred;
+
+ - pickmatrix (x,y,w,h:UINTEGER_32) in v:VIEWPORT <- deferred;
+
+ //
+ // Viewport transformations
+ //
+
+ - set_viewport v:VIEWPORT <- deferred;
+ - set_viewport4i (x,y,width,height:UINTEGER_32) <- deferred;
+ - get_viewport viewport:VIEWPORT <- deferred;
+
+ //
+ // Tranformation utility
+ //
+
+ - begin_ortho (w,h:INTEGER) <- deferred;
+ - end_ortho <- deferred;
+ - ortho_mode (w,h:INTEGER) do body:BLOCK <-
+ (
+ begin_ortho (w,h);
+ body.value;
+ end_ortho;
+ );
+
\ No newline at end of file
diff --git a/abstract_renderer/vertex.li b/abstract_renderer/vertex.li
new file mode 100644
index 0000000..b7dd167
--- /dev/null
+++ b/abstract_renderer/vertex.li
@@ -0,0 +1,34 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := VERTEX;
+
+ - comment := "(x,y,z) point";
+
+Section Inherit
+
+ + parent_vector:Expanded VECTOR3[REAL_32];
+
+Section Public
+
+
\ No newline at end of file
diff --git a/abstract_renderer/vertex_buffer.li b/abstract_renderer/vertex_buffer.li
new file mode 100644
index 0000000..29514e7
--- /dev/null
+++ b/abstract_renderer/vertex_buffer.li
@@ -0,0 +1,175 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := VERTEX_BUFFER;
+
+ - comment := "api independant vertex buffer";
+
+Section Inherit
+
+ - parent_object:OBJECT := OBJECT;
+
+Section Public
+
+ - drawing_mode:INTEGER;
+ - capacity:INTEGER;
+
+ - points:INTEGER <- 1;
+ - lines:INTEGER <- 2;
+ - polygon:INTEGER <- 3;
+ - triangles:INTEGER <- 4;
+ - quads:INTEGER <- 5;
+ - line_strip:INTEGER <- 6;
+ - line_loop:INTEGER <- 7;
+ - triangle_strip:INTEGER <- 8;
+ - triangle_fan:INTEGER <- 9;
+ - quad_strip:INTEGER <- 10;
+
+
+ - create sz:INTEGER :SELF <-
+ ( + result:SELF;
+ result := SELF.clone;
+ result.make sz;
+ result
+ );
+
+ - create_subarray :SELF <-
+ ( + result:SELF;
+ result := SELF.clone;
+ result.make capacity;
+ result
+ );
+
+ - make sz:INTEGER <- deferred;
+
+ - destroy <- deferred;
+
+ - begin_points <- deferred;
+ - begin_lines <- deferred;
+ - begin_polygon <- deferred;
+ - begin_triangles <- deferred;
+ - begin_quads <- deferred;
+ - begin_line_strip <- deferred;
+ - begin_line_loop <- deferred;
+ - begin_triangle_strip <- deferred;
+ - begin_triangle_fan <- deferred;
+ - begin_quad_strip <- deferred;
+
+ - end <- deferred;
+
+ - new_points body:BLOCK <-
+ (
+ begin_points;
+ body.value;
+ end;
+ );
+
+ - new_lines body:BLOCK <-
+ (
+ begin_lines;
+ body.value;
+ end;
+ );
+
+ - new_polygon body:BLOCK <-
+ (
+ begin_polygon;
+ body.value;
+ end;
+ );
+
+ - new_triangles body:BLOCK <-
+ (
+ begin_triangles;
+ body.value;
+ end;
+ );
+
+ - new_quads body:BLOCK <-
+ (
+ begin_quads;
+ body.value;
+ end;
+ );
+
+ - new_line_strip body:BLOCK <-
+ (
+ begin_line_strip;
+ body.value;
+ end;
+ );
+
+ - new_line_loop body:BLOCK <-
+ (
+ begin_line_loop;
+ body.value;
+ end;
+ );
+
+ - new_triangle_strip body:BLOCK <-
+ (
+ begin_triangle_strip;
+ body.value;
+ end;
+ );
+
+ - new_triangle_fan body:BLOCK <-
+ (
+ begin_triangle_fan;
+ body.value;
+ end;
+ );
+
+ - new_quad_strip body:BLOCK <-
+ (
+ begin_quad_strip;
+ body.value;
+ end;
+ );
+
+ - add_vertex2f (x,y:REAL_32) <- deferred;
+ - add_vertex3f (x,y,z:REAL_32) <- deferred;
+ - add_vertex v:VERTEX <- deferred;
+ - add_vertex v:VERTEX color col:COLOR <- deferred;
+ - add_vertex3f (x,y,z:REAL_32) color col:COLOR <- deferred;
+
+ - add_texel2f (s,t:REAL_32) <- deferred;
+ - add_normal3f (x,y,z:REAL_32) <- deferred;
+ - add_normal v:VECTOR3[REAL_32] <- deferred;
+
+ - add_color (c:COLOR) <- deferred;
+ - add_color3f (r,g,b:REAL_32) <- deferred;
+
+ - build <- deferred;
+
+ - bind <- deferred;
+ - bind_unit n:INTEGER <- deferred;
+
+ - draw <- deferred;
+ - draw_using index_array:INDEX_BUFFER <- deferred;
+
+
+ - get_vertex_data:FAST_ARRAY[REAL_32] <- deferred;
+ - get_texels_data:FAST_ARRAY[REAL_32] <- deferred;
+ - get_normals_data:FAST_ARRAY[REAL_32] <- deferred;
+ - get_colors_data:FAST_ARRAY[REAL_32] <- deferred;
\ No newline at end of file
diff --git a/abstract_renderer/viewport.li b/abstract_renderer/viewport.li
new file mode 100644
index 0000000..c9d3435
--- /dev/null
+++ b/abstract_renderer/viewport.li
@@ -0,0 +1,38 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := VIEWPORT;
+
+ - comment := "(x0,y0,width,height) viewport";
+
+Section Inherit
+
+ + parent_vector:Expanded VECTOR4[UINTEGER_32];
+
+Section Public
+
+ - x0:UINTEGER_32 <- x;
+ - y0:UINTEGER_32 <- y;
+ - width:UINTEGER_32 <- z;
+ - height:UINTEGER_32 <- w;
+
\ No newline at end of file
diff --git a/framework/event_listener.li b/framework/event_listener.li
new file mode 100644
index 0000000..33050a9
--- /dev/null
+++ b/framework/event_listener.li
@@ -0,0 +1,55 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := EVENT_LISTENER;
+
+Section Inherit
+
+ - parent_framework_any:FRAMEWORK_ANY := FRAMEWORK_ANY;
+
+Section Public
+
+ //
+ // Keyboard events
+ //
+
+ - keydown k:INTEGER <-
+ (
+ );
+
+ - keyup k:INTEGER <-
+ (
+ );
+
+
+ //
+ // Mouse events
+ //
+
+ - move (x,y:INTEGER) <-
+ (
+ );
+
+ - click b:INTEGER <-
+ (
+ );
\ No newline at end of file
diff --git a/framework/framework.li b/framework/framework.li
new file mode 100644
index 0000000..67d0e80
--- /dev/null
+++ b/framework/framework.li
@@ -0,0 +1,340 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := FRAMEWORK;
+
+Section Inherit
+
+ - parent_framework_any:FRAMEWORK_ANY := FRAMEWORK_ANY;
+
+ - parent_platform:PLATFORM := PLATFORM;
+
+Section Private
+
+ - current_time:UINTEGER_32; //REAL_32;
+ - prev_time:UINTEGER_32; //REAL_32;
+
+Section Public
+
+ //
+ // Framework modules.
+ //
+
+ - event:FRAMEWORK_EVENT <- FRAMEWORK_EVENT;
+
+ //
+ //
+ //
+
+ - current_scene:SCENE;
+
+ - out:FONT;
+
+ - is_running:BOOLEAN;
+ - frame_per_second_max:INTEGER;
+ - time_per_frame:INTEGER;
+
+ - frame_time:UINTEGER_32;
+
+
+ - make r:RENDERER <-
+ ( + buf:STRING;
+
+ renderer := r;
+
+ log := LOG.create "renderer.log" level 3;
+ buf := STRING.create 256;
+
+ buf.append "Video Card Driver:\n";
+ renderer.video_card_name buf;
+ renderer.video_card_vendor buf;
+ renderer.video_card_version buf;
+ log.print buf;
+
+ KEYCODE.make;
+ FRAMEWORK_EVENT.make;
+
+ out := renderer.font.default;
+ );
+
+ - make_for_gui r:RENDERER <-
+ (
+ renderer := r;
+ KEYCODE.make;
+
+ out := renderer.font.default;
+ );
+
+ - attach_scene sc:SCENE <-
+ (
+ current_scene := sc;
+ //
+ sc.initialize;
+ //
+ );
+
+ - set_fps n:INTEGER <-
+ (
+ frame_per_second_max := n;
+ time_per_frame := 1000/frame_per_second_max;
+ );
+
+ //
+ // Application events.
+ //
+
+ - initialize:BOOLEAN <- TRUE;
+
+ - load_config <-
+ (
+ set_fps 60;
+ );
+
+ - init_time <-
+ (
+ frame_time := 0;
+ parent_platform.init_time;
+
+ current_time := get_milliseconds;
+ );
+
+ - update_time <-
+ (
+ prev_time := current_time;
+ current_time := get_milliseconds;
+
+ frame_time := current_time - prev_time;
+ );
+
+ - make_frame <-
+ (
+ begin_frame;
+ //
+ draw_frame;
+ //
+ end_frame;
+ );
+
+ - begin_frame <-
+ (
+ renderer.begin_frame;
+ );
+
+ - end_frame <-
+ (
+ renderer.end_frame;
+
+ report_error.if {
+ //...
+ };
+
+ // sleep to keep constant framerate
+ (frame_per_second_max > 0).if {
+
+ (frame_time < time_per_frame).if {
+ delay (time_per_frame - frame_time);
+ };
+ };
+ );
+
+ - draw_frame <-
+ (
+ (current_scene != NULL).if {
+ current_scene.render (frame_time.to_real/1000.0);
+ };
+ );
+
+ - on_close <-
+ (
+ );
+
+
+ - run <-
+ // main program loop
+ (
+ init_time;
+ load_config;
+
+ initialize.if {
+ is_running := TRUE;
+
+ //
+ // main loop
+ //
+ {
+ FRAMEWORK_EVENT.update;
+
+ // (is_active).if {
+ update_time;
+ make_frame;
+ // else
+ // sleep(100);
+
+ }.do_while {is_running};
+
+ // exit framework
+ close;
+ };
+ );
+
+ - stop <-
+ (
+ is_running := FALSE;
+ );
+
+ - close <-
+ (
+ (current_scene != NULL).if {
+ current_scene.release;
+ };
+ on_close;
+ );
+
+ //
+ // 3D modes handling
+ //
+
+Section Private
+
+ - lighting_mode:BOOLEAN;
+ - blending_mode:BOOLEAN;
+ - fog_mode:BOOLEAN;
+ - wireframe_mode:BOOLEAN;
+ - shading_mode:BOOLEAN;
+
+Section Public
+
+ - toggle_shading <-
+ (
+ shading_mode := ! shading_mode;
+ shading_mode.if {
+ renderer.enable_shading;
+ } else {
+ renderer.disable_shading;
+ };
+ );
+
+ - toggle_lighting <-
+ (
+ lighting_mode := ! lighting_mode;
+ lighting_mode.if {
+ renderer.enable_lighting;
+ } else {
+ renderer.disable_lighting;
+ };
+ );
+
+ - toggle_blending <-
+ (
+ blending_mode := ! blending_mode;
+ blending_mode.if {
+ renderer.blending.enable;
+ renderer.depth_buffer.disable;
+ } else {
+ renderer.blending.disable;
+ renderer.depth_buffer.enable;
+ };
+ );
+
+ - toggle_fog <-
+ (
+ fog_mode := ! fog_mode;
+ fog_mode.if {
+ renderer.fog.enable;
+ } else {
+ renderer.fog.disable;
+ };
+ );
+
+ - toggle_wireframe <-
+ (
+ wireframe_mode := ! wireframe_mode;
+ renderer.wireframe_mode wireframe_mode;
+ );
+
+ //
+ // Event management
+ //
+
+Section Private
+
+ - key_listeners:LINKED_LIST[EVENT_LISTENER];
+ - mouse_listeners:LINKED_LIST[EVENT_LISTENER];
+
+Section Public
+
+ - add_key_listener kl:EVENT_LISTENER <-
+ (
+ (key_listeners = NULL).if {
+ key_listeners := LINKED_LIST[EVENT_LISTENER].create;
+ };
+ key_listeners.add_last kl;
+ );
+
+ - add_mouse_listener ml:EVENT_LISTENER <-
+ (
+ (mouse_listeners = NULL).if {
+ mouse_listeners := LINKED_LIST[EVENT_LISTENER].create;
+ };
+ mouse_listeners.add_last ml;
+ );
+
+ //
+ // Events
+ //
+
+ - on_keydown k:INTEGER <-
+ (
+ (key_listeners != NULL).if {
+ key_listeners.lower.to (key_listeners.upper) do { i:INTEGER;
+ key_listeners.item i.keydown k;
+ };
+ };
+ );
+
+ - on_keyup k:INTEGER <-
+ (
+ (key_listeners != NULL).if {
+ key_listeners.lower.to (key_listeners.upper) do { i:INTEGER;
+ key_listeners.item i.keyup k;
+ };
+ };
+ );
+
+ - on_mousemove (x,y:INTEGER) <-
+ (
+ (mouse_listeners != NULL).if {
+ mouse_listeners.lower.to (mouse_listeners.upper) do { i:INTEGER;
+ mouse_listeners.item i.move (x,y);
+ };
+ };
+ );
+
+ - on_mouseclick b:INTEGER <-
+ (
+ (mouse_listeners != NULL).if {
+ mouse_listeners.lower.to (mouse_listeners.upper) do { i:INTEGER;
+ mouse_listeners.item i.click b;
+ };
+ };
+ );
diff --git a/framework/log.li b/framework/log.li
new file mode 100644
index 0000000..4cbc72a
--- /dev/null
+++ b/framework/log.li
@@ -0,0 +1,77 @@
+///////////////////////////////////////////////////////////////////////////////
+// Application //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+Section Header
+
+ + name := LOG;
+
+ - comment := "Logging System";
+
+Section Inherit
+
+ - parent_object:OBJECT := OBJECT;
+
+Section Public
+
+ - max_level:INTEGER <- 4;
+
+ + file:POINTER;
+ + level:INTEGER;
+
+
+ //
+ // Creation.
+ //
+
+ - create s:ABSTRACT_STRING level l:INTEGER :SELF <-
+ ( + result:SELF;
+ result := clone;
+ result.make (s,l);
+ result
+ );
+
+ - make (s:ABSTRACT_STRING, l:INTEGER) <-
+ (
+ level := l;
+ file := FS_MIN.open_write s;
+ );
+
+ - print msg:ABSTRACT_STRING <-
+ (
+ + buf:STRING;
+
+ buf := STRING.create_from_string msg;
+ buf.append "\n";
+
+ FS_MIN.write file with buf size(buf.count);
+ );
+
+ - print msg:ABSTRACT_STRING level l:INTEGER <-
+ (
+ (level + l >= max_level).if {
+ print msg;
+ };
+ );
+
+ - close <-
+ (
+ FS_MIN.close file;
+ );
+
diff --git a/framework/low_level/abstract_keycode.li b/framework/low_level/abstract_keycode.li
new file mode 100644
index 0000000..79d8622
--- /dev/null
+++ b/framework/low_level/abstract_keycode.li
@@ -0,0 +1,187 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-SDL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := ABSTRACT_KEYCODE;
+ - comment := "Plateform independant key mapping";
+ - author := "Xavier Oswald <x.oswald at free.fr>";
+
+Section Inherit
+
+ - parent_object: OBJECT := OBJECT;
+
+Section Private
+
+ - keys:HASHED_DICTIONARY[INTEGER,INTEGER];
+
+Section Public
+
+ - max_keys: INTEGER := 322;
+
+ - k_backspace : INTEGER <- 8;
+ - k_tab : INTEGER <- 9;
+ - k_clear : INTEGER <- 12;
+ - k_return : INTEGER <- 13;
+ - k_pause : INTEGER <- 19;
+ - k_escape : INTEGER <- 27;
+ - k_space : INTEGER <- 32;
+ - k_exclaim : INTEGER <- 33;
+ - k_quotedbl : INTEGER <- 34;
+ - k_hash : INTEGER <- 35;
+ - k_dollar : INTEGER <- 36;
+ - k_ampersand : INTEGER <- 38;
+ - k_quote : INTEGER <- 39;
+ - k_leftparen : INTEGER <- 40;
+ - k_rightparen : INTEGER <- 41;
+ - k_asterisk : INTEGER <- 42;
+ - k_plus : INTEGER <- 43;
+ - k_comma : INTEGER <- 44;
+ - k_minus : INTEGER <- 45;
+ - k_period : INTEGER <- 46;
+ - k_slash : INTEGER <- 47;
+ - k_0 : INTEGER <- 48;
+ - k_1 : INTEGER <- 49;
+ - k_2 : INTEGER <- 50;
+ - k_3 : INTEGER <- 51;
+ - k_4 : INTEGER <- 52;
+ - k_5 : INTEGER <- 53;
+ - k_6 : INTEGER <- 54;
+ - k_7 : INTEGER <- 55;
+ - k_8 : INTEGER <- 56;
+ - k_9 : INTEGER <- 57;
+ - k_colon : INTEGER <- 58;
+ - k_semicolon : INTEGER <- 59;
+ - k_less : INTEGER <- 60;
+ - k_equals : INTEGER <- 61;
+ - k_greater : INTEGER <- 62;
+ - k_question : INTEGER <- 63;
+ - k_at : INTEGER <- 64;
+ - k_leftbracket : INTEGER <- 91;
+ - k_backslash : INTEGER <- 92;
+ - k_rightbracket : INTEGER <- 93;
+ - k_caret : INTEGER <- 94;
+ - k_underscore : INTEGER <- 95;
+ - k_backquote : INTEGER <- 96;
+ - k_a : INTEGER <- 97;
+ - k_b : INTEGER <- 98;
+ - k_c : INTEGER <- 99;
+ - k_d : INTEGER <- 100;
+ - k_e : INTEGER <- 101;
+ - k_f : INTEGER <- 102;
+ - k_g : INTEGER <- 103;
+ - k_h : INTEGER <- 104;
+ - k_i : INTEGER <- 105;
+ - k_j : INTEGER <- 106;
+ - k_k : INTEGER <- 107;
+ - k_l : INTEGER <- 108;
+ - k_m : INTEGER <- 109;
+ - k_n : INTEGER <- 110;
+ - k_o : INTEGER <- 111;
+ - k_p : INTEGER <- 112;
+ - k_q : INTEGER <- 113;
+ - k_r : INTEGER <- 114;
+ - k_s : INTEGER <- 115;
+ - k_t : INTEGER <- 116;
+ - k_u : INTEGER <- 117;
+ - k_v : INTEGER <- 118;
+ - k_w : INTEGER <- 119;
+ - k_x : INTEGER <- 120;
+ - k_y : INTEGER <- 121;
+ - k_z : INTEGER <- 122;
+ - k_delete : INTEGER <- 127;
+
+ // Numeric keypad
+ - kp_0 : INTEGER <- 256;
+ - kp_1 : INTEGER <- 257;
+ - kp_2 : INTEGER <- 258;
+ - kp_3 : INTEGER <- 259;
+ - kp_4 : INTEGER <- 260;
+ - kp_5 : INTEGER <- 261;
+ - kp_6 : INTEGER <- 262;
+ - kp_7 : INTEGER <- 263;
+ - kp_8 : INTEGER <- 264;
+ - kp_9 : INTEGER <- 265;
+ - kp_period : INTEGER <- 266;
+ - kp_divide : INTEGER <- 267;
+ - kp_multiply : INTEGER <- 268;
+ - kp_minus : INTEGER <- 269;
+ - kp_plus : INTEGER <- 279;
+ - kp_enter : INTEGER <- 271;
+ - kp_equals : INTEGER <- 272;
+
+ // Arrows + Home/End pad
+ - k_up : INTEGER <- 273;
+ - k_down : INTEGER <- 274;
+ - k_right : INTEGER <- 275;
+ - k_left : INTEGER <- 276;
+ - k_insert : INTEGER <- 277;
+ - k_home : INTEGER <- 278;
+ - k_end : INTEGER <- 279;
+ - k_pageup : INTEGER <- 290;
+ - k_pagedown : INTEGER <- 281;
+
+ // Function keys
+ - k_f1 : INTEGER <- 282;
+ - k_f2 : INTEGER <- 283;
+ - k_f3 : INTEGER <- 284;
+ - k_f4 : INTEGER <- 285;
+ - k_f5 : INTEGER <- 286;
+ - k_f6 : INTEGER <- 287;
+ - k_f7 : INTEGER <- 288;
+ - k_f8 : INTEGER <- 289;
+ - k_f9 : INTEGER <- 290;
+ - k_f10 : INTEGER <- 291;
+ - k_f11 : INTEGER <- 292;
+ - k_f12 : INTEGER <- 293;
+ - k_f13 : INTEGER <- 294;
+ - k_f14 : INTEGER <- 295;
+ - k_f15 : INTEGER <- 296;
+
+ // Key state modifier keys
+ - k_numlock : INTEGER <- 300;
+ - k_capslock : INTEGER <- 301;
+ - k_scrollock : INTEGER <- 302;
+ - k_rshift : INTEGER <- 303;
+ - k_lshift : INTEGER <- 304;
+ - k_rctrl : INTEGER <- 305;
+ - k_lctrl : INTEGER <- 306;
+ - k_ralt : INTEGER <- 307;
+ - k_lalt : INTEGER <- 308;
+ - k_rmeta : INTEGER <- 309;
+ - k_lmeta : INTEGER <- 310;
+ - k_lsuper : INTEGER <- 311;
+ - k_rsuper : INTEGER <- 312;
+ - k_mode : INTEGER <- 313;
+ - k_compose : INTEGER <- 314;
+
+ // Miscellaneous function keys
+ - k_help : INTEGER <- 315;
+ - k_print : INTEGER <- 316;
+ - k_sysreq : INTEGER <- 317;
+ - k_break : INTEGER <- 318;
+ - k_menu : INTEGER <- 319;
+ - k_power : INTEGER <- 320;
+ - k_euro : INTEGER <- 321;
+ - k_undo : INTEGER <- 322;
+
+
+ - get_key key:INTEGER :INTEGER <- deferred;
\ No newline at end of file
diff --git a/framework/low_level/framework_any.li b/framework/low_level/framework_any.li
new file mode 100644
index 0000000..cf814d2
--- /dev/null
+++ b/framework/low_level/framework_any.li
@@ -0,0 +1,59 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := FRAMEWORK_ANY;
+
+Section Inherit
+
+ - parent_object:OBJECT := OBJECT;
+
+Section Public
+
+ - renderer:RENDERER; // current renderer
+
+ - log:LOG; // current log file
+
+ - report_error:BOOLEAN; // debug mode
+
+
+ - width:INTEGER <- renderer.width;
+ - height:INTEGER <- renderer.height;
+
+ - screen_width:INTEGER <- width;
+ - screen_height:INTEGER <- height;
+
+ - track_errors <- report_error := TRUE;
+
+
+ - error msg:ABSTRACT_STRING <-
+ (
+ log.print "==== GL Framework Error ====";
+ log.print msg;
+ log.print "============================";
+ );
+
+ - fatal_error msg:ABSTRACT_STRING <-
+ (
+ error msg;
+ renderer.fatal_error msg;
+ );
diff --git a/framework/scene.li b/framework/scene.li
new file mode 100644
index 0000000..ec080e5
--- /dev/null
+++ b/framework/scene.li
@@ -0,0 +1,56 @@
+///////////////////////////////////////////////////////////////////////////////
+// Application //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := SCENE;
+
+ - comment := "basic rendering scene";
+
+Section Inherit
+
+ - parent_object:OBJECT := OBJECT;
+
+Section Public
+
+ - renderer:RENDERER;
+
+ - set_renderer r:RENDERER <-
+ (
+ renderer := r;
+ );
+
+
+ - initialize:BOOLEAN <- TRUE;
+
+ - render t:REAL_32 <-
+ (
+ renderer.begin_frame;
+ //------------
+
+ //------------
+ renderer.end_frame;
+ );
+
+ - release <-
+ (
+ // nothing
+ );
diff --git a/framework/unix/framework_event.li b/framework/unix/framework_event.li
new file mode 100644
index 0000000..03f1ff9
--- /dev/null
+++ b/framework/unix/framework_event.li
@@ -0,0 +1,135 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := FRAMEWORK_EVENT;
+
+ - comment := "GL Framework: handle input";
+
+ - external :=
+ `
+char keybuf[64];
+KeySym keysym;
+ `;
+
+Section Inherit
+
+ - parent_object:OBJECT := OBJECT;
+
+Section Public
+
+ - make <-
+ (
+ );
+
+ - keys:FAST_ARRAY[BOOLEAN] :=
+ ( + result:FAST_ARRAY[BOOLEAN];
+
+ result := FAST_ARRAY[BOOLEAN].create 256;
+ result.set_all_with FALSE;
+ result
+ );
+
+ - mouse_x:INTEGER;
+ - mouse_y:INTEGER;
+
+ - get_mouse_pos:(INTEGER,INTEGER) <-
+ (
+ (mouse_x, mouse_y)
+ );
+
+ - update:BOOLEAN <-
+ (
+ + type,k:INTEGER;
+ + w,h,b:INTEGER;
+
+ {`XPending (win.dpy)`:INTEGER != 0}.while_do {
+ `XNextEvent (win.dpy, &event)`;
+ type := `event.type`:INTEGER;
+
+ type
+
+ //
+ // Event Keyboard
+ //
+ .when `KeyPress`:INTEGER then {
+ `XLookupString(&event.xkey, keybuf, sizeof(keybuf), &keysym, 0)`;
+ k := KEYCODE.get_key (`keysym`:INTEGER);
+
+ keys.put TRUE to k;
+ FRAMEWORK.on_keydown k;
+ }
+ .when `KeyRelease`:INTEGER then {
+ `XLookupString(&event.xkey, keybuf, sizeof(keybuf), &keysym, 0)`;
+ k := KEYCODE.get_key (`keysym`:INTEGER);
+
+ keys.put FALSE to k;
+ FRAMEWORK.on_keyup k;
+ }
+ .when `ButtonPress`:INTEGER then {
+ b := `event.xbutton.button`:INTEGER;
+ FRAMEWORK.on_mouseclick (((b = 1).to_integer <<1) | (b = 3).to_integer);
+ }
+ .when `MotionNotify`:INTEGER then {
+ mouse_x := `event.xmotion.x`:INTEGER;
+ mouse_y := `event.xmotion.y`:INTEGER;
+ FRAMEWORK.on_mousemove (mouse_x,mouse_y);
+ }
+ .when `ConfigureNotify`:INTEGER then {
+ w := `event.xconfigure.width`:INTEGER;
+ h := `event.xconfigure.height`:INTEGER;
+
+ ((w != FRAMEWORK.renderer.width) && {h != FRAMEWORK.renderer.height}).if {
+ FRAMEWORK.renderer.resize (w,h);
+ };
+ }
+ .when `ClientMessage`:INTEGER then {
+ (`*XGetAtomName(win.dpy, event.xclient.message_type) == *"WM_PROTOCOLS"`:BOOLEAN).if {
+ FRAMEWORK.stop;
+ };
+ };
+ };
+ TRUE
+ );
+
+ - keydown k:INTEGER :BOOLEAN <-
+ (
+ keys.item k
+ );
+
+ - keyup k:INTEGER :BOOLEAN <-
+ (
+ ! keys.item k
+ );
+
+ - set_up k:INTEGER <-
+ (
+ keys.put FALSE to k;
+ );
+
+ - warp_mouse (x,y:INTEGER) <-
+ (
+ mouse_x := x;
+ mouse_y := y;
+ `XWarpPointer (win.dpy, None, win.win, 0, 0, 0, 0, @x, @y)`;
+ );
+
diff --git a/framework/unix/gl_font.li b/framework/unix/gl_font.li
new file mode 100644
index 0000000..6adab6a
--- /dev/null
+++ b/framework/unix/gl_font.li
@@ -0,0 +1,66 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := GL_FONT;
+
+ - comment := "X11 - OpenGl rendered font";
+
+ - external := `static XFontStruct *font;`;
+
+Section Inherit
+
+ + parent_font_abstract:Expanded GL_FONT_ABSTRACT;
+
+Section Public
+
+ - default:FONT <-
+ (
+ create "-*-helvetica-bold-r-normal--24-*-*-*-p-*-iso8859-1"
+ );
+
+ - load <-
+ (
+ + fontname:NATIVE_ARRAY[CHARACTER];
+ + b:UINTEGER_32;
+ + n:INTEGER;
+
+ n := nb_chars;
+ base := `glGenLists(@n)`:UINTEGER_32;
+
+ fontname := name.to_external;
+ `font = XLoadQueryFont(win.dpy, @fontname)`;
+ (`font`:POINTER = NULL).if {
+
+ OPENGL.error.print "Error loading font, loading default...";
+
+ // last chance..
+ `font = XLoadQueryFont(win.dpy,"fixed")`;
+ (`font`:POINTER = NULL).if {
+ OPENGL.fatal_error "Can't load font";
+ };
+ };
+ b := base;
+ `glXUseXFont(font->fid, 32, @n, @b)`;// start at char 32 -> build n display lists
+ `XFreeFont(win.dpy, font)`;
+ );
+
diff --git a/framework/unix/keycode.li b/framework/unix/keycode.li
new file mode 100644
index 0000000..e2ca2dd
--- /dev/null
+++ b/framework/unix/keycode.li
@@ -0,0 +1,137 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-SDL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := KEYCODE;
+ - comment := "X11 key mapping";
+
+Section Inherit
+
+ - parent_keycode: Expanded ABSTRACT_KEYCODE;
+
+Section Public
+
+ - make <-
+ (
+ keys := HASHED_DICTIONARY[INTEGER,INTEGER].create;
+
+ keys.add k_backspace to (`XK_BackSpace`:INTEGER);
+ keys.add k_tab to (`XK_Tab`:INTEGER);
+ // keys.add k_clear to (`VK_CLEAR`:INTEGER); ???
+ keys.add k_return to (`XK_Return`:INTEGER);
+ keys.add k_pause to (`XK_Pause`:INTEGER);
+ keys.add k_escape to (`XK_Escape`:INTEGER);
+ keys.add k_space to (`XK_space`:INTEGER);
+
+ //
+ // key 33 to 127: ASCII code ???
+ //
+
+ keys.add k_delete to (`XK_Delete`:INTEGER);
+
+ keys.add kp_0 to (`XK_KP_0`:INTEGER);
+ keys.add kp_1 to (`XK_KP_1`:INTEGER);
+ keys.add kp_2 to (`XK_KP_2`:INTEGER);
+ keys.add kp_3 to (`XK_KP_3`:INTEGER);
+ keys.add kp_4 to (`XK_KP_4`:INTEGER);
+ keys.add kp_5 to (`XK_KP_5`:INTEGER);
+ keys.add kp_6 to (`XK_KP_6`:INTEGER);
+ keys.add kp_7 to (`XK_KP_7`:INTEGER);
+ keys.add kp_8 to (`XK_KP_8`:INTEGER);
+ keys.add kp_9 to (`XK_KP_9`:INTEGER);
+ //keys.add kp_period to (`SDLK_KP_PERIOD`:INTEGER);
+ keys.add kp_divide to (`XK_KP_Divide`:INTEGER);
+ keys.add kp_multiply to (`XK_KP_Multiply`:INTEGER);
+ keys.add kp_minus to (`XK_KP_Subtract`:INTEGER);
+ keys.add kp_plus to (`XK_KP_Add`:INTEGER);
+ // keys.add kp_enter to (`SDLK_KP_ENTER`:INTEGER);
+ //keys.add kp_equals to (`SDLK_KP_EQUALS`:INTEGER);
+
+ keys.add k_up to (`XK_Up`:INTEGER);
+ keys.add k_down to (`XK_Down`:INTEGER);
+ keys.add k_right to (`XK_Right`:INTEGER);
+ keys.add k_left to (`XK_Left`:INTEGER);
+ keys.add k_insert to (`XK_Insert`:INTEGER);
+ keys.add k_home to (`XK_Home`:INTEGER);
+ keys.add k_end to (`XK_End`:INTEGER);
+ //keys.add k_pageup to (`VK_PRIOR`:INTEGER);
+ //keys.add k_pagedown to (`VK_NEXT`:INTEGER);
+
+ keys.add k_f1 to (`XK_F1`:INTEGER);
+ keys.add k_f2 to (`XK_F2`:INTEGER);
+ keys.add k_f3 to (`XK_F3`:INTEGER);
+ keys.add k_f4 to (`XK_F4`:INTEGER);
+ keys.add k_f5 to (`XK_F5`:INTEGER);
+ keys.add k_f6 to (`XK_F6`:INTEGER);
+ keys.add k_f7 to (`XK_F7`:INTEGER);
+ keys.add k_f8 to (`XK_F8`:INTEGER);
+ keys.add k_f9 to (`XK_F9`:INTEGER);
+ keys.add k_f10 to (`XK_F10`:INTEGER);
+ keys.add k_f11 to (`XK_F11`:INTEGER);
+ keys.add k_f12 to (`XK_F12`:INTEGER);
+ keys.add k_f13 to (`XK_F13`:INTEGER);
+ keys.add k_f14 to (`XK_F14`:INTEGER);
+ keys.add k_f15 to (`XK_F15`:INTEGER);
+
+ //keys.add k_numlock to (`VK_NUMLOCK`:INTEGER);
+ //keys.add k_capslock to (`VK_CAPITAL`:INTEGER);
+ //keys.add k_scrollock to (`VK_SCROLL`:INTEGER);
+ keys.add k_rshift to (`XK_Shift_R`:INTEGER);
+ keys.add k_lshift to (`XK_Shift_L`:INTEGER);
+ keys.add k_rctrl to (`XK_Control_R`:INTEGER);
+ keys.add k_lctrl to (`XK_Control_L`:INTEGER);
+ ////////////////// keys.add k_ralt to (`SDLK_LALT`:INTEGER); ///////
+ //keys.add k_lalt to (`VK_MENU`:INTEGER);
+
+ //keys.add k_rmeta to (`SDLK_RMETA`:INTEGER);
+ //keys.add k_lmeta to (`SDLK_LMETA`:INTEGER);
+ //keys.add k_lsuper to (`SDLK_LSUPER`:INTEGER);
+ //keys.add k_rsuper to (`SDLK_RSUPER`:INTEGER);
+ //keys.add k_mode to (`SDLK_MODE`:INTEGER);
+ //keys.add k_compose to (`SDLK_COMPOSE`:INTEGER);
+
+ //keys.add k_help to (`VK_HELP`:INTEGER);
+ //keys.add k_print to (`VK_PRINT`:INTEGER);
+ //keys.add k_sysreq to (`SDLK_SYSREQ`:INTEGER);
+ //keys.add k_break to (`SDLK_BREAK`:INTEGER);
+ //keys.add k_menu to (`VK_MENU`:INTEGER);
+ //keys.add k_power to (`SDLK_POWER`:INTEGER);
+ //keys.add k_euro to (`SDLK_EURO`:INTEGER);
+ //keys.add k_undo to (`SDLK_UNDO`:INTEGER);
+ );
+
+ - get_key key:INTEGER :INTEGER <-
+ (
+ + result:INTEGER;
+
+ keys.has key.if {
+ result := keys.at key;
+ } else {
+ result := `*keybuf`:INTEGER;// conversions...
+ result.in_range ('A'.to_integer) to ('Z'.to_integer).if {
+ result := result - 'A'.to_integer + 'a'.to_integer;
+ }.elseif {result.in_range 1 to 26} then {
+ result := result + 'a'.to_integer - 1;
+ };
+ };
+ result
+ );
diff --git a/framework/unix/opengl.li b/framework/unix/opengl.li
new file mode 100644
index 0000000..22c5ab6
--- /dev/null
+++ b/framework/unix/opengl.li
@@ -0,0 +1,300 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := OPENGL;
+
+ - external :=
+ `#include <GL/glx.h>
+ #include <GL/gl.h>
+ #include <GL/glu.h>
+ #include <X11/Xlib.h>
+ #include <X11/keysym.h>
+ #include <X11/extensions/xf86vmode.h>
+ #include <sys/time.h>
+
+ #define GPA(funcname) glXGetProcAddressARB(funcname);
+
+ struct glx_window_t
+ {
+ Display *dpy;
+ int screen;
+ Window win;
+ GLXContext context;
+ XSetWindowAttributes attributes;
+
+ XF86VidModeModeInfo deskMode;
+ XVisualInfo *vi;
+ };
+
+ struct glx_window_t win;
+ XF86VidModeModeInfo **modes;
+ int numModes, bestMode;
+ int vidModeMajorVersion, vidModeMinorVersion;
+ Atom wmDelete;
+
+ XEvent event;
+
+ static struct timeval start, now, tv;
+
+ static int attribs[32];
+ `;
+
+Section Inherit
+
+ - parent_opengl_abstract:OPENGL_ABSTRACT := OPENGL_ABSTRACT;
+
+Section Public
+
+ - swap_buffers <-
+ // post rendering
+ (
+ // flip double buffer
+ `glXSwapBuffers (win.dpy, win.win)`;
+ );
+
+Section Public
+
+ - make (w,h:INTEGER) <-
+ (
+ do_make (w,h) title "OpenGL application";
+ SCENE.set_renderer Self; // make Self current
+ );
+
+ - make (w,h:INTEGER) title s:ABSTRACT_STRING <-
+ (
+ do_make (w,h) title s;
+ SCENE.set_renderer Self; // make Self current
+ );
+
+ - do_make (w,h:INTEGER) title s:ABSTRACT_STRING <-
+ (
+ + nb_mode,n,size:INTEGER;
+ + title:NATIVE_ARRAY[CHARACTER];
+
+ width := w;
+ height := h;
+ viewport := VIEWPORT.create (0,0,w,h);
+
+ // Creation fenetre X:
+ `win.dpy = XOpenDisplay (NULL)`;
+ `win.screen = DefaultScreen (win.dpy)`;
+ `bestMode = 0`;
+
+ `XF86VidModeQueryVersion(win.dpy, &vidModeMajorVersion,&vidModeMinorVersion)`;
+
+ `XF86VidModeGetAllModeLines (win.dpy, win.screen, &numModes, &modes)`;
+
+ `win.deskMode = *modes[0];`;
+
+ // make OpenGL attributes list
+ `attribs[0] = GLX_RGBA`;
+ `attribs[1] = GLX_RED_SIZE`;
+ size := red_size;
+ `attribs[2] = @size`;
+ `attribs[3] = GLX_GREEN_SIZE`;
+ size := green_size;
+ `attribs[4] = @size`;
+ `attribs[5] = GLX_BLUE_SIZE`;
+ size := blue_size;
+ `attribs[6] = @size`;
+
+ n := 7;
+ has_alpha.if {
+ `attribs[@n] = GLX_ALPHA_SIZE`;
+ n := n+1;
+ size := alpha_size;
+ `attribs[@n] = @size`;
+ n := n+1;
+ };
+ has_doublebuffer.if {
+ `attribs[@n] = GLX_DOUBLEBUFFER`;
+ n := n+1;
+ };
+ has_depth_buffer.if {
+ `attribs[@n] = GLX_DEPTH_SIZE`;
+ n := n+1;
+
+ size := depth_size;
+ `attribs[@n] = @size`;
+ n := n+1;
+ };
+ has_stencil_buffer.if {
+ `attribs[@n] = GLX_STENCIL_SIZE`;
+ n := n+1;
+
+ size := stencil_size;
+ `attribs[@n] = @size`;
+ n := n+1;
+ };
+ has_accum_buffer.if {
+ `attribs[@n] = GLX_ACCUM_RED_SIZE`;
+ n := n+1;
+ size := accum_red_size;
+ `attribs[@n] = @size`;
+ n := n+1;
+
+ `attribs[@n] = GLX_ACCUM_GREEN_SIZE`;
+ n := n+1;
+ size := accum_green_size;
+ `attribs[@n] = @size`;
+ n := n+1;
+
+ `attribs[@n] = GLX_ACCUM_BLUE_SIZE`;
+ n := n+1;
+ size := accum_blue_size;
+ `attribs[@n] = @size`;
+ n := n+1;
+
+ has_alpha.if {
+ `attribs[@n] = GLX_ACCUM_ALPHA_SIZE`;
+ n := n+1;
+ size := accum_alpha_size;
+ `attribs[@n] = @size`;
+ n := n+1;
+ };
+ };
+ // terminate list
+ `attribs[@n] = (int) None`;
+
+ `win.vi = glXChooseVisual (win.dpy, win.screen, attribs)`;
+ (`win.vi`:POINTER = NULL).if {
+ fatal_error "Failed to set XVisual";
+ };
+
+ nb_mode := `numModes`:INTEGER;
+ 0.to (nb_mode-1) do { i:INTEGER;
+ `
+ if ((modes[@i]->hdisplay == @w) &&
+ (modes[@i]->vdisplay == @h))
+ {
+ bestMode = @i;
+ }
+ `;
+ };
+
+ // create OpenGL context
+ `win.context = glXCreateContext (win.dpy, win.vi, 0, GL_TRUE)`;
+ (`win.context`:POINTER = NULL).if {
+ `XDestroyWindow (win.dpy, win.win)`;
+ `XCloseDisplay (win.dpy)`;
+
+ fatal_error "failed to create a rendering context";
+ };
+
+ // create a color map
+ `win.attributes.colormap = XCreateColormap (win.dpy, RootWindow (win.dpy, win.vi->screen),win.vi->visual, AllocNone)`;
+ `win.attributes.border_pixel = 0`;
+ //`win.attributes.background_pixel = 0`;
+
+ is_fullscreen.if {
+ `XF86VidModeSwitchToMode (win.dpy, win.screen, modes[bestMode])`;
+ `XF86VidModeSetViewPort (win.dpy, win.screen, 0, 0)`;
+ width := `modes[bestMode]->hdisplay`:INTEGER;
+ height := `modes[bestMode]->vdisplay`:INTEGER;
+ `XFree (modes)`;
+
+ // create fullscreen window
+ `win.attributes.override_redirect = 1`;
+ `win.attributes.event_mask = ExposureMask | KeyPressMask| ButtonPressMask|ButtonReleaseMask | PointerMotionMask | StructureNotifyMask`;
+
+ `win.win = XCreateWindow (win.dpy, RootWindow (win.dpy, win.vi->screen),0, 0, @w, @h, 0, win.vi->depth, InputOutput, win.vi->visual,CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect, &win.attributes)`;
+
+ // warp mouse at center of the screen
+ `XWarpPointer (win.dpy, None, win.win, 0, 0, 0, 0, @w / 2, @h / 2)`;
+ `XMapRaised (win.dpy, win.win)`;
+ `XGrabKeyboard (win.dpy, win.win, True, GrabModeAsync,GrabModeAsync, CurrentTime)`;
+
+ `XGrabPointer (win.dpy, win.win, True, ButtonPressMask,GrabModeAsync, GrabModeAsync, win.win, None, CurrentTime)`;
+ } else {
+ // window mode
+ `win.attributes.event_mask = ExposureMask | KeyPressMask | ButtonPressMask|ButtonReleaseMask | PointerMotionMask | StructureNotifyMask`;
+
+ // `win.attributes.event_mask |= ClientMessage | KeyReleaseMask`;
+
+ // create simple window
+ `win.win = XCreateWindow (win.dpy, RootWindow (win.dpy, win.vi->screen),0, 0, @w, @h, 0, win.vi->depth, InputOutput, win.vi->visual,CWBorderPixel | CWColormap | CWEventMask, &win.attributes)`;
+
+ `#ifndef GLBINDING__USE_GUI
+ // unbind action of the close window button
+ wmDelete = XInternAtom(win.dpy, "WM_DELETE_WINDOW", True);
+ XSetWMProtocols(win.dpy, win.win, &wmDelete, 1);
+ #endif
+ `;
+ title := s.to_external;
+ `XSetStandardProperties(win.dpy, win.win, @title, @title, None, NULL, 0, NULL)`;
+ `XMapRaised (win.dpy, win.win)`;
+ };
+ // `int x,y,borderDummy`;
+ //`Window winDummy`;
+ `glXMakeCurrent (win.dpy, win.win, win.context)`;
+ // `XGetGeometry(win.dpy, win.win, &winDummy, &x, &y,&x, &y, &borderDummy, &x)`;
+
+ (`glXIsDirect (win.dpy, win.context)`:INTEGER = 0).if {
+ fatal_error "no direct rendering possible\n";
+ };
+ // Title window:
+ // title := s.to_external;
+ //`XStoreName(win.dpy,win.win, at title)`;
+
+ /// for GUI compatibility ///
+ `#ifdef GLBINDING__USE_GUI
+ display = win.dpy;
+ window = win.win;
+ #endif
+ `;
+ ///
+
+ initialize;
+ resize (width,height);
+ );
+
+ - resize (w,h:INTEGER) <-
+ (
+ (h != 0).if {
+ width := w;
+ height := h;
+
+ viewport.make (0, 0, w, h);
+ //
+ reshape.on_resize (w,h);
+ //
+ };
+ );
+
+Section Public
+ - close <-
+ (
+ // release context
+ (`win.context`:POINTER != NULL).if {
+ `glXMakeCurrent (win.dpy, None, NULL)`;
+ `glXDestroyContext (win.dpy, win.context)`;
+ `win.context = NULL`;
+ };
+ is_fullscreen.if {
+ `XF86VidModeSwitchToMode (win.dpy, win.screen, &win.deskMode)`;
+ `XF86VidModeSetViewPort (win.dpy, win.screen, 0, 0)`;
+ };
+ `XDestroyWindow (win.dpy, win.win)`;
+ `XCloseDisplay (win.dpy)`;
+ );
+
diff --git a/framework/unix/platform.li b/framework/unix/platform.li
new file mode 100644
index 0000000..5089fe8
--- /dev/null
+++ b/framework/unix/platform.li
@@ -0,0 +1,89 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := PLATFORM;
+ - comment := "Platform dependant utility toolkit";
+
+ - external := `
+ #include <sys/time.h>
+static struct timeval start, now, tv;
+ `;
+
+Section Inherit
+
+ - parent_object:OBJECT := OBJECT;
+
+Section Public
+
+ //
+ // Time handling.
+ //
+
+ - init_time <-
+ (
+ `gettimeofday(&start, NULL)`;
+ );
+
+ - get_current_time:REAL_32 <-
+ (
+ `gettimeofday(&now, NULL)`;
+ `(float)(now.tv_sec - start.tv_sec) + 0.000001f * (float)(now.tv_usec - start.tv_usec)`:REAL_32
+ );
+
+ - get_milliseconds:UINTEGER_32 <-
+ (
+ `gettimeofday(&now, NULL)`;
+ `( now.tv_sec - start.tv_sec )*1000 + ( now.tv_usec - start.tv_usec )/1000`:UINTEGER_32
+ );
+
+ - delay ms:UINTEGER_32 <-
+ (
+ `tv.tv_sec = @ms/1000`;
+ `tv.tv_usec = (@ms%1000)*1000`;
+ `select(0, NULL, NULL, NULL, &tv)`;
+ );
+
+ - init_random <-
+ (
+ `srand((unsigned)time(NULL))`;
+ );
+ - random:INTEGER <-
+ (
+ `rand()`:INTEGER
+ );
+
+ - random_ratio:REAL_32 <-
+ (
+ `rand() / (float)(RAND_MAX)`:REAL_32
+ );
+
+
+ - frand:REAL_32 <- // 0 to 1
+ (
+ `(rand()&32767) * (1.0/32767)`:REAL_32
+ );
+
+ - crand <- // -1 to 1
+ (
+ `(rand()&32767)* (2.0/32767) - 1`:REAL_32
+ );
diff --git a/framework/windows/framework_event.li b/framework/windows/framework_event.li
new file mode 100644
index 0000000..e15bbd0
--- /dev/null
+++ b/framework/windows/framework_event.li
@@ -0,0 +1,206 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := FRAMEWORK_EVENT;
+
+ - comment := "GL Framework: handle input";
+
+ - external :=
+ `
+ POINT p;
+
+#ifndef GLBINDING__USE_GUI
+ extern void resize (int,int); // pour l'instant
+ extern void event_keydown (int,int);
+ extern void event_keyup (int,int);
+ extern int event_mousemove (int,int);
+ extern int event_mouseclick (int);
+
+ MSG msg;
+
+
+ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+ {
+ LONG lRet = 0;
+ PAINTSTRUCT ps;
+
+
+ switch (uMsg)
+ {
+ case WM_SIZE:
+ if (!fullscreen)
+ // resize only in windowed mode
+ {
+ resize (LOWORD(lParam),HIWORD(lParam));
+ GetClientRect(win.hwnd, &win.rect);
+ }
+ break;
+ case WM_KEYDOWN:
+
+ event_keydown (wParam, lParam);
+
+ break;
+ case WM_KEYUP:
+
+ event_keyup (wParam, lParam);
+ break;
+ // Mouse
+ case WM_MOUSEMOVE:
+
+ event_mousemove ((short)LOWORD(lParam), (short)HIWORD(lParam));
+
+ break;
+
+ case WM_LBUTTONDOWN:
+ case WM_RBUTTONDOWN:
+
+ event_mouseclick ((((wParam & MK_LBUTTON) != 0) << 1) | ((wParam & MK_RBUTTON) != 0));
+
+ break;
+
+ case WM_PAINT:
+ BeginPaint(win.hwnd, &ps);
+ EndPaint(win.hwnd, &ps);
+ break;
+
+ case WM_CLOSE:
+ PostQuitMessage(0);
+ break;
+
+ default:
+ return DefWindowProc(hwnd, uMsg, wParam, lParam);
+ }
+ return 0;
+ }
+#endif
+`;
+
+Section Inherit
+
+ - parent_object:OBJECT := OBJECT;
+
+Section External
+
+ - event_keydown (wparam,lparam:INTEGER) <-
+ (
+ + k:INTEGER;
+
+ k := KEYCODE.get_key wparam;
+ keys.put TRUE to k;
+ FRAMEWORK.on_keydown k;
+ );
+
+ - event_keyup (wparam,lparam:INTEGER) <-
+ (
+ + k:INTEGER;
+
+ k := KEYCODE.get_key wparam;
+ keys.put FALSE to k;
+ FRAMEWORK.on_keyup k;
+ );
+
+ - event_mousemove (x,y:INTEGER) :INTEGER <-
+ (
+ mouse_x := x;
+ mouse_y := y;
+
+ FRAMEWORK.on_mousemove (x,y);
+ `1`:(INTEGER) // hack to make the slot persistent
+ );
+
+ - event_mouseclick b:INTEGER :INTEGER <-
+ (
+ FRAMEWORK.on_mouseclick b;
+ `1`:(INTEGER) // hack to make the slot persistent
+ );
+
+Section Public
+
+ - make <-
+ (
+ // Remove this after compiler has been fixed...
+ event_keydown (0,0);
+ event_keyup (0,0);
+ event_mousemove (0,0);
+ event_mouseclick 0;
+ );
+
+ - keys:FAST_ARRAY[BOOLEAN] :=
+ ( + result:FAST_ARRAY[BOOLEAN];
+
+ result := FAST_ARRAY[BOOLEAN].create 256;
+ result.set_all_with FALSE;
+ result
+ );
+
+ - mouse_x:INTEGER;
+ - mouse_y:INTEGER;
+
+ // hack for windows
+ - get_mouse_pos:(INTEGER,INTEGER) <-
+ (
+ `GetCursorPos(&p)`;
+ (`p.x`:INTEGER, `p.y`:INTEGER)
+ );
+
+ - update:BOOLEAN <-
+ (
+ + go:BOOLEAN;
+
+ go := TRUE;
+ {go && {`PeekMessage (&msg, NULL, 0, 0, PM_REMOVE)` != 0}}.while_do {
+ (`msg.message`:INTEGER = `WM_QUIT`:INTEGER).if {
+ //
+ FRAMEWORK.stop;
+ //
+ go := FALSE;
+ } else {
+ `TranslateMessage (&msg)`;
+ `DispatchMessage (&msg)`;
+ };
+ };
+ go
+ );
+
+ - keydown k:INTEGER :BOOLEAN <-
+ (
+ keys.item k
+ );
+
+ - keyup k:INTEGER :BOOLEAN <-
+ (
+ ! keys.item k
+ );
+
+ - set_up k:INTEGER <-
+ (
+ keys.put FALSE to k;
+ );
+
+ - warp_mouse (x,y:INTEGER) <-
+ (
+ mouse_x := x;
+ mouse_y := y;
+ `SetCursorPos (@x, at y)`;
+ );
+
\ No newline at end of file
diff --git a/framework/windows/gl_font.li b/framework/windows/gl_font.li
new file mode 100644
index 0000000..6ae94e4
--- /dev/null
+++ b/framework/windows/gl_font.li
@@ -0,0 +1,73 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := GL_FONT;
+
+ - comment := "Win32 - OpenGl rendered font";
+
+ - external := `static HFONT hFont,hOldFont;`;
+
+Section Inherit
+
+ + parent_font_abstract:Expanded GL_FONT_ABSTRACT;
+
+Section Public
+
+ - default:FONT <-
+ (
+ create "Arial"
+ );
+
+ - load <-
+ (
+ + fontname:NATIVE_ARRAY[CHARACTER];
+ + b,h:UINTEGER_32;
+ + n:INTEGER;
+
+ n := nb_chars;
+ base := `glGenLists(@n)`:UINTEGER_32;
+
+ h := font_height;
+ fontname := name.to_external;
+ `hFont = CreateFont(@h,0,0,0,FW_BOLD,
+ FALSE,// italic
+ FALSE,// underlined
+ FALSE,// strikeout
+ ANSI_CHARSET,OUT_TT_PRECIS,CLIP_DEFAULT_PRECIS,
+ ANTIALIASED_QUALITY, // font quality
+ FF_DONTCARE|DEFAULT_PITCH,
+ @fontname);
+ `;
+ // select font & save old font to avoid memory leak
+ `hOldFont = (HFONT)SelectObject(win.hdc, hFont)`;
+
+ // cree des bitmaps a partir de la fonte
+ b := base;
+ `wglUseFontBitmaps(win.hdc, 32, @n, @b)`;
+ );
+
+ - unload <-
+ (
+ parent_font_abstract.unload;
+ `SelectObject(win.hdc, hOldFont)`;
+ );
\ No newline at end of file
diff --git a/framework/windows/keycode.li b/framework/windows/keycode.li
new file mode 100644
index 0000000..677be78
--- /dev/null
+++ b/framework/windows/keycode.li
@@ -0,0 +1,132 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-SDL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := KEYCODE;
+ - comment := "win32 key mapping";
+
+Section Inherit
+
+ - parent_keycode: Expanded ABSTRACT_KEYCODE;
+
+Section Public
+
+ - make <-
+ (
+ keys := HASHED_DICTIONARY[INTEGER,INTEGER].create;
+
+ keys.add k_backspace to (`VK_BACK`:INTEGER);
+ keys.add k_tab to (`VK_TAB`:INTEGER);
+ keys.add k_clear to (`VK_CLEAR`:INTEGER);
+ keys.add k_return to (`VK_RETURN`:INTEGER);
+ keys.add k_pause to (`VK_PAUSE`:INTEGER);
+ keys.add k_escape to (`VK_ESCAPE`:INTEGER);
+ keys.add k_space to (`VK_SPACE`:INTEGER);
+
+ //
+ // key 33 to 127: win32 uses ASCII code
+ //
+
+ keys.add k_delete to (`VK_DELETE`:INTEGER);
+
+ keys.add kp_0 to (`VK_NUMPAD0`:INTEGER);
+ keys.add kp_1 to (`VK_NUMPAD1`:INTEGER);
+ keys.add kp_2 to (`VK_NUMPAD2`:INTEGER);
+ keys.add kp_3 to (`VK_NUMPAD3`:INTEGER);
+ keys.add kp_4 to (`VK_NUMPAD4`:INTEGER);
+ keys.add kp_5 to (`VK_NUMPAD5`:INTEGER);
+ keys.add kp_6 to (`VK_NUMPAD6`:INTEGER);
+ keys.add kp_7 to (`VK_NUMPAD7`:INTEGER);
+ keys.add kp_8 to (`VK_NUMPAD8`:INTEGER);
+ keys.add kp_9 to (`VK_NUMPAD9`:INTEGER);
+ //keys.add kp_period to (`SDLK_KP_PERIOD`:INTEGER);
+ keys.add kp_divide to (`VK_DIVIDE`:INTEGER);
+ keys.add kp_multiply to (`VK_MULTIPLY`:INTEGER);
+ keys.add kp_minus to (`VK_SUBTRACT`:INTEGER);
+ keys.add kp_plus to (`VK_ADD`:INTEGER);
+ // keys.add kp_enter to (`SDLK_KP_ENTER`:INTEGER);
+ //keys.add kp_equals to (`SDLK_KP_EQUALS`:INTEGER);
+
+ keys.add k_up to (`VK_UP`:INTEGER);
+ keys.add k_down to (`VK_DOWN`:INTEGER);
+ keys.add k_right to (`VK_RIGHT`:INTEGER);
+ keys.add k_left to (`VK_LEFT`:INTEGER);
+ keys.add k_insert to (`VK_INSERT`:INTEGER);
+ keys.add k_home to (`VK_HOME`:INTEGER);
+ keys.add k_end to (`VK_END`:INTEGER);
+ keys.add k_pageup to (`VK_PRIOR`:INTEGER);
+ keys.add k_pagedown to (`VK_NEXT`:INTEGER);
+
+ keys.add k_f1 to (`VK_F1`:INTEGER);
+ keys.add k_f2 to (`VK_F2`:INTEGER);
+ keys.add k_f3 to (`VK_F3`:INTEGER);
+ keys.add k_f4 to (`VK_F4`:INTEGER);
+ keys.add k_f5 to (`VK_F5`:INTEGER);
+ keys.add k_f6 to (`VK_F6`:INTEGER);
+ keys.add k_f7 to (`VK_F7`:INTEGER);
+ keys.add k_f8 to (`VK_F8`:INTEGER);
+ keys.add k_f9 to (`VK_F9`:INTEGER);
+ keys.add k_f10 to (`VK_F10`:INTEGER);
+ keys.add k_f11 to (`VK_F11`:INTEGER);
+ keys.add k_f12 to (`VK_F12`:INTEGER);
+ keys.add k_f13 to (`VK_F13`:INTEGER);
+ keys.add k_f14 to (`VK_F14`:INTEGER);
+ keys.add k_f15 to (`VK_F15`:INTEGER);
+
+ keys.add k_numlock to (`VK_NUMLOCK`:INTEGER);
+ keys.add k_capslock to (`VK_CAPITAL`:INTEGER);
+ keys.add k_scrollock to (`VK_SCROLL`:INTEGER);
+ keys.add k_rshift to (`VK_RSHIFT`:INTEGER);
+ keys.add k_lshift to (`VK_LSHIFT`:INTEGER);
+ keys.add k_rctrl to (`VK_RCONTROL`:INTEGER);
+ keys.add k_lctrl to (`VK_LCONTROL`:INTEGER);
+ ////////////////// keys.add k_ralt to (`SDLK_LALT`:INTEGER); ///////
+ keys.add k_lalt to (`VK_MENU`:INTEGER);
+
+ //keys.add k_rmeta to (`SDLK_RMETA`:INTEGER);
+ //keys.add k_lmeta to (`SDLK_LMETA`:INTEGER);
+ //keys.add k_lsuper to (`SDLK_LSUPER`:INTEGER);
+ //keys.add k_rsuper to (`SDLK_RSUPER`:INTEGER);
+ //keys.add k_mode to (`SDLK_MODE`:INTEGER);
+ //keys.add k_compose to (`SDLK_COMPOSE`:INTEGER);
+
+ keys.add k_help to (`VK_HELP`:INTEGER);
+ keys.add k_print to (`VK_PRINT`:INTEGER);
+ //keys.add k_sysreq to (`SDLK_SYSREQ`:INTEGER);
+ //keys.add k_break to (`SDLK_BREAK`:INTEGER);
+ //keys.add k_menu to (`VK_MENU`:INTEGER);
+ //keys.add k_power to (`SDLK_POWER`:INTEGER);
+ //keys.add k_euro to (`SDLK_EURO`:INTEGER);
+ //keys.add k_undo to (`SDLK_UNDO`:INTEGER);
+ );
+
+ - get_key key:INTEGER :INTEGER <-
+ (
+ + result:INTEGER;
+
+ keys.has key.if {
+ result := keys.at key;
+ } else {
+ result := key;
+ };
+ result
+ );
\ No newline at end of file
diff --git a/framework/windows/opengl.li b/framework/windows/opengl.li
new file mode 100644
index 0000000..75beca0
--- /dev/null
+++ b/framework/windows/opengl.li
@@ -0,0 +1,269 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := OPENGL;
+
+ - external :=
+ `#include <windows.h>
+ #include <GL/gl.h>
+ #include <GL/glu.h>
+
+ #define GPA(funcname) wglGetProcAddress(funcname);
+
+ struct glwin_window_t
+ {
+ HWND hwnd; // window handle
+ RECT rect; // window rect
+ HDC hdc; // device gdi
+ HGLRC hrc; // device ogl
+
+ HINSTANCE instance;
+ WNDCLASS class;
+ };
+
+ struct glwin_window_t win;
+ DEVMODE settings;
+ int fullscreen;
+
+ PIXELFORMATDESCRIPTOR pfd;
+ int pixelformat;
+ /*
+ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
+ LPSTR lpCmdLine, int nCmdShow)
+ {
+ win.instance = hInstance;
+ main (0, NULL);
+ return 0;
+ }*/
+`;
+
+Section Inherit
+
+ - parent_opengl_abstract:OPENGL_ABSTRACT := OPENGL_ABSTRACT;
+
+Section Public
+
+ - swap_buffers <-
+ // post rendering
+ (
+ // flip double buffer
+ `SwapBuffers (win.hdc)`;
+ );
+
+Section Public
+
+ - auto_make <-
+ (
+ make (800,600);
+ );
+
+ - make (w,h:INTEGER) <-
+ (
+ do_make (w,h) title "OpenGL application";
+ SCENE.set_renderer Self; // make Self current
+ );
+
+ - make (w,h:INTEGER) title s:ABSTRACT_STRING <-
+ (
+ do_make (w,h) title s;
+ SCENE.set_renderer Self; // make Self current
+ );
+
+ - do_make (w,h:INTEGER) title s:ABSTRACT_STRING <-
+ (
+ + style,size:INTEGER;
+ + wintitle:NATIVE_ARRAY[CHARACTER];
+ + b:BOOLEAN;
+
+ width := w;
+ height := h;
+ viewport := VIEWPORT.create (0,0,w,h);
+ b := is_fullscreen;
+
+ // Creation fenetre:
+ `fullscreen = @b;
+
+ memset(&win.class, 0, sizeof(WNDCLASS));
+ win.class.style = CS_HREDRAW | CS_VREDRAW;
+ win.class.lpfnWndProc = MainWndProc;
+ win.class.hInstance = win.instance;
+ win.class.hIcon = LoadIcon(NULL, IDI_APPLICATION);
+ win.class.hCursor = LoadCursor(NULL, IDC_ARROW);
+ win.class.hbrBackground = (HBRUSH) (COLOR_WINDOW+1);
+ win.class.lpszClassName = "IsaacClass";
+
+ RegisterClass(&win.class);`;
+
+ is_fullscreen.if {
+ style := `WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN`:INTEGER;
+
+ gl_fullscreen;
+ //`ShowCursor(FALSE)`;
+ } else {
+ // simple window
+ style := `WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN`:INTEGER;
+ };
+
+ `win.rect.left = 0;
+ win.rect.right = @w;
+ win.rect.top = 0;
+ win.rect.bottom = @h;
+
+ AdjustWindowRect (&win.rect, @style, 0);`;
+
+ // create window
+ wintitle := s.to_external;
+ `win.hwnd = CreateWindow("IsaacClass", @wintitle, @style, 0, 0, win.rect.right - win.rect.left, win.rect.bottom - win.rect.top, NULL, NULL, win.instance, NULL);`;
+ (`win.hwnd`:INTEGER = 0).if {
+ fatal_error "failed to create window";
+ };
+ `ShowWindow (win.hwnd, SW_SHOWNORMAL);
+ UpdateWindow (win.hwnd);
+ SetFocus (win.hwnd);
+
+ win.hdc = GetDC (win.hwnd);`;
+
+ // choose pixel format compatible for OpenGL
+ `pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
+ pfd.nVersion = 1;
+ pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL;`;
+ has_doublebuffer.if {
+ `pfd.dwFlags |= PFD_DOUBLEBUFFER`;
+ };
+ `pfd.dwLayerMask = PFD_MAIN_PLANE;
+ pfd.iPixelType = PFD_TYPE_RGBA;`; // PFD_TYPE_COLORINDEX;
+
+ size := buffer_size;
+ `pfd.cColorBits = @size`;
+
+ has_depth_buffer.if {
+ size := depth_size;
+ `pfd.cDepthBits = @size`;
+ } else {
+ `pfd.cDepthBits = 0`;
+ };
+ has_stencil_buffer.if {
+ size := stencil_size;
+ `pfd.cStencilBits = @size`;
+ } else {
+ `pfd.cStencilBits = 0`;
+ };
+ has_accum_buffer.if {
+ size := accum_red_size;
+ `pfd.cAccumRedBits = @size`;
+ size := accum_green_size;
+ `pfd.cAccumGreenBits = @size`;
+ size := accum_blue_size;
+ `pfd.cAccumBlueBits = @size`;
+ size := accum_alpha_size;
+ `pfd.cAccumAlphaBits = @size`;
+ size := accum_red_size+accum_green_size+accum_blue_size+accum_alpha_size;
+ `pfd.cAccumBits = @size`;
+ } else {
+ `pfd.cAccumBits = 0`;
+ };
+ size := red_size;
+ `pfd.cRedBits = @size`;
+ size := green_size;
+ `pfd.cGreenBits = @size`;
+ size := blue_size;
+ `pfd.cBlueBits = @size`;
+ size := alpha_size;
+ `pfd.cAlphaBits = @size`;
+
+ `pixelformat = ChoosePixelFormat(win.hdc, &pfd);`;
+ (`pixelformat`:INTEGER = 0).if {
+ fatal_error "ChoosePixelFormat failed";
+ };
+ (`SetPixelFormat(win.hdc, pixelformat, &pfd)`:INTEGER = 0).if {
+ fatal_error "SetPixelFormat failed";
+ };
+
+ `DescribePixelFormat(win.hdc, pixelformat, sizeof(pfd), &pfd)`;
+
+ // create OpenGL rendering context
+ `win.hrc = wglCreateContext (win.hdc);
+ wglMakeCurrent(win.hdc, win.hrc);
+ `;
+
+ initialize;
+ resize (width,height);
+ );
+
+ - gl_fullscreen <-
+ (
+ + w,h,result:INTEGER;
+
+ w := width;
+ h := height;
+
+ `memset(&settings,0,sizeof(settings))`;
+ (`EnumDisplaySettings(NULL,ENUM_CURRENT_SETTINGS,&settings)`:INTEGER = 0).if {
+ fatal_error "failed to display display settings";
+ };
+ `settings.dmPelsWidth = @w;
+ settings.dmPelsHeight = @h;
+ settings.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;`;
+
+ result := `ChangeDisplaySettings(&settings,CDS_FULLSCREEN)`:INTEGER;
+ (result != `DISP_CHANGE_SUCCESSFUL`:INTEGER).if {
+ fatal_error "Fullscreen mode not compatible";
+ };
+ );
+
+Section External
+
+ - resize (w,h:INTEGER) <-
+ (
+ (h != 0).if {
+ width := w;
+ height := h;
+
+ viewport.make (0, 0, w, h);
+ //
+ reshape.on_resize (w,h);
+ //
+ };
+ );
+
+Section Public
+
+ - close <-
+ (
+ // release OpenGl context
+ (`win.hrc`:INTEGER != 0).if {
+ `wglMakeCurrent (NULL, NULL)`;
+ `wglDeleteContext (win.hrc)`;
+ };
+ // release gdi context
+ (`win.hdc`:INTEGER != 0).if {
+ `ReleaseDC(win.hwnd, win.hdc)`;
+ };
+ is_fullscreen.if {
+ `ChangeDisplaySettings(NULL,0)`;
+ `ShowCursor(TRUE)`;
+ };
+ `UnregisterClass("IsaacClass", win.instance)`;
+ `PostQuitMessage(0)`;
+ );
+
diff --git a/framework/windows/platform.li b/framework/windows/platform.li
new file mode 100644
index 0000000..8bb3f69
--- /dev/null
+++ b/framework/windows/platform.li
@@ -0,0 +1,122 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := PLATFORM;
+ - comment := "Platform dependant utility toolkit";
+
+ - external := `
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <mmsystem.h>
+
+LARGE_INTEGER freq, count;
+double timer_start;
+ `;
+
+Section Inherit
+
+ - parent_object:OBJECT := OBJECT;
+
+Section Public
+
+ //
+ // Time handling.
+ //
+
+ - init_time <-
+ (
+ (`QueryPerformanceFrequency(&freq)`:INTEGER = 0).if {
+ `freq.QuadPart = 0`;
+ `timer_start = timeGetTime() / 1000.0f`;
+ } else {
+ `QueryPerformanceCounter(&count)`;
+ `timer_start = (double)(count.QuadPart) / (double) (freq.QuadPart)`;
+ };
+ );
+
+ - get_milliseconds:UINTEGER_32 <-
+ (
+ (get_current_time * 1000.0).to_uinteger_32 // fixme
+ );
+
+ - get_current_time:REAL_32 <-
+ ( + result:REAL_32;
+
+ (`freq.QuadPart`:INTEGER = 0).if {
+ // no performance timer
+ result := `(float)(timeGetTime() / 1000.0f - timer_start)`:REAL_32;
+ } else {
+ `QueryPerformanceCounter(&count)`;
+ result := `(float)(((double)(count.QuadPart) / (double)(freq.QuadPart)) - timer_start)`:REAL_32;
+ };
+ result
+ );
+
+ /*
+ - start_ticks <-
+ (
+ start := get_ticks;
+ );
+
+ - get_ticks:UINTEGER_32 <-
+ (
+ now := `timeGetTime()`:UINTEGER_32;
+ (now < start).if {
+ ticks := (`TIME_WRAP_VALUE`:UINTEGER_32 - start) + now;
+ } else {
+ ticks := now - start;
+ };
+ ticks
+ );*/
+
+ - delay ms:UINTEGER_32 <-
+ (
+ `Sleep(@ms)`;
+ );
+
+ - init_random <-
+ (
+ `srand((unsigned)time(NULL))`;
+ );
+ - random:INTEGER <-
+ (
+ `rand()`:INTEGER
+ );
+
+ - random_ratio:REAL_32 <-
+ (
+ `rand() / (float)(RAND_MAX)`:REAL_32
+ );
+
+
+ - frand:REAL_32 <- // 0 to 1
+ (
+ `(rand()&32767) * (1.0/32767)`:REAL_32
+ );
+
+ - crand <- // -1 to 1
+ (
+ `(rand()&32767)* (2.0/32767) - 1`:REAL_32
+ );
+
diff --git a/glspec2li.li b/glspec2li.li
new file mode 100644
index 0000000..6ca4fb2
--- /dev/null
+++ b/glspec2li.li
@@ -0,0 +1,432 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := GLSPEC2LI;
+
+ - comment := "Convert the GL/gl.h C header file into GL prototype";
+
+Section Inherit
+
+ - parent_object:OBJECT := OBJECT;
+
+Section Public
+
+ - main <-
+ ( + s,buffer:STRING;
+ + p:POINTER;
+
+ (COMMAND_LINE.count > 1).if {
+ s := STRING.create_from_string (COMMAND_LINE.item 1);
+ } else {
+ "Syntax: glspec2li <gl.h>\n".print;
+ };
+
+ (s != NULL).if {
+ buffer := STRING.create 2048;
+
+ buffer.append "// **** file generated by glspec2li ****\n";
+ convert_file s into buffer;
+
+ p := FS_MIN.open_write "gl.li";
+ (p != NULL).if {
+ FS_MIN.write p with buffer size (buffer.count);
+ FS_MIN.close p;
+ } else {
+ "glspec2li: can't create gl.li\n".print;
+ };
+ };
+ );
+
+Section Private
+
+ - source:STRING;
+
+
+ - convert_file s:STRING into out:STRING <-
+ (
+ + e:ENTRY;
+ + file:STD_FILE;
+ + buf,type_ret:STRING;
+ + type_arg,name_arg:FAST_ARRAY[STRING];
+ + nb_args:INTEGER;
+ + end:BOOLEAN;
+
+ e := FILE_SYSTEM.get_entry s;
+ (e != NULL).if {
+ file ?= e;
+ file.open;
+
+ source := STRING.create (file.size+1);
+ buf := STRING.create 64;
+
+ file.read source size (file.size);
+ file.close;
+
+ out.append "Section Header\n\n\
+ \ + name := GL;\n\
+ \ - comment := \"OpenGL C Specification\";\n\n\
+ \Section Inherit\n\n\
+ \ - parent_object:OBJECT := OBJECT;\n\n\
+ \Section Public\n\n";
+
+ //
+ // Read constants.
+ //
+
+ out.append "//\n// OpenGL constant.\n//\n\n";
+
+ {
+ (read_symbol "#define").if {
+ read_word;
+ buf.copy last_string;
+
+ read_word;
+ (last_string.first.is_digit).if {
+
+ out.append " - ";
+ buf.to_lower;
+
+ // === some GL lowercased constants have same name with GL functions
+ out.append "cst_";
+ // ===
+
+ out.append buf;
+ out.append ":INTEGER <- ";
+
+ ((last_string.count > 1) &&
+ {last_string.first = '0'} &&
+ {last_string.item (last_string.lower+1) = 'x'}).if {
+ // convert hexa value: 0xFF -> 0FFh
+
+ last_string.remove_first 2;
+ last_string.add_first '0';
+ last_string.add_last 'h';
+ };
+ out.append last_string;
+ out.append ";\n";
+ };
+ } else {
+ // skip token
+ read_word;
+ };
+ }.do_until {position >= source.upper};
+
+ //
+ // Read functions.
+ //
+
+ position := 0;
+ type_ret := STRING.create 16;
+ type_arg := FAST_ARRAY[STRING].create_with_capacity 16;
+ name_arg := FAST_ARRAY[STRING].create_with_capacity 16;
+ 0.to 15 do { i:INTEGER;
+ type_arg.add_last (STRING.create 16);
+ name_arg.add_last (STRING.create 16);
+ };
+
+ out.append "//\n// OpenGL functions.\n//\n\n";
+
+ {
+ (read_symbol "WINGDIAPI").if {
+
+ // read return type
+ read_word;
+ (last_string == "const").if {// ignore 'const' keyword
+ read_word;
+ };
+ type_ret.copy (to_lisaac_type last_string);
+
+ // skip 'APIENTRY' macro
+ read_word;
+
+ // read function name
+ read_word;
+ buf.copy last_string;
+
+ // emit slot
+ out.append " - ";
+ out.append (to_lisaac_name buf);
+
+ // read arguments
+ read_word;
+ nb_args := 0;
+ end := FALSE;
+
+ (last_string == "(void);").if_false {
+ last_string.remove_first 1; // remove '('
+
+ {
+ (last_string == "const").if {// ignore 'const' keyword
+ read_word;
+ };
+
+ // convert to lisaac type
+ type_arg.item nb_args.copy last_string;
+ to_lisaac_type (type_arg.item nb_args);
+
+ // read arg name
+ read_word;
+ (last_string.first = '*').if {
+ type_arg.item nb_args.copy "POINTER";
+ last_string.remove_first 1; // remove '*'
+ };
+ (last_string.last = ',').if {
+ last_string.remove_last 1; // remove ','
+ } else {
+ last_string.remove_last 2; // remove ');'
+ end := TRUE;
+ };
+ name_arg.item nb_args.copy (to_lisaac_name last_string);
+
+ (! end).if {
+ read_word;
+ };
+
+ nb_args := nb_args + 1;
+ }.do_until {end || {nb_args >= 16}};
+ };
+
+ // emit arguments
+ (nb_args > 0).if {
+ out.append " (";
+ 0.to (nb_args-1) do { i:INTEGER;
+ out.append (name_arg.item i);
+ out.append ":";
+ out.append (type_arg.item i);
+ (i < nb_args-1).if {
+ out.append ", ";
+ };
+ };
+ out.append ")";
+ };
+ // emit result type
+ (type_ret == "VOID").if_false {
+ out.append " :";
+ out.append type_ret;
+ };
+
+ (nb_args > 6).if { // avoid lisaac compiler line counter overflow
+ out.append "\n";
+ };
+
+ // emit external call
+ out.append " <- `";
+ out.append buf;
+ out.append "(";
+ 0.to (nb_args-1) do { i:INTEGER;
+ out.append "@";
+ out.append (name_arg.item i);
+ (i < nb_args-1).if {
+ out.append ",";
+ };
+ };
+ out.append ")`";
+
+ // emit external return
+ (type_ret == "VOID").if_false {
+ out.append ":";
+ out.append type_ret;
+ };
+ out.append ";\n";
+
+ } else {
+ // skip token
+ read_word;
+ };
+ }.do_until {position >= source.upper};
+ };
+ );
+
+ - tmp:STRING := STRING.create 32;
+
+ - to_lisaac_name s:STRING :STRING <-
+ (
+ tmp.clear;
+ s.lower.to (s.upper) do { i:INTEGER;
+ (! s.item i.is_upper).if {
+ tmp.add_last (s.item i);
+ } else {
+ tmp.add_last '_';
+ tmp.add_last (s.item i.to_lower);
+ };
+ };
+ tmp
+ );
+
+ - to_lisaac_type s:STRING :STRING <-
+ (
+
+ (s.last == '*').if {
+ s.copy "POINTER";
+ } else {
+ (s == "void").if {
+ s.copy "VOID";
+ }.elseif {s == "GLenum"} then {
+ s.copy "UINTEGER_32";
+ }.elseif {s == "GLboolean"} then {
+ s.copy "UINTEGER_8";
+ }.elseif {s == "GLbitfield"} then {
+ s.copy "UINTEGER_32";
+ }.elseif {s == "GLbyte"} then {
+ s.copy "INTEGER_8";
+ }.elseif {s == "GLshort"} then {
+ s.copy "INTEGER_16";
+ }.elseif {s == "GLint"} then {
+ s.copy "INTEGER";
+ }.elseif {s == "GLsizei"} then {
+ s.copy "INTEGER";
+ }.elseif {s == "GLubyte"} then {
+ s.copy "UINTEGER_8";
+ }.elseif {s == "GLushort"} then {
+ s.copy "UINTEGER_16";
+ }.elseif {s == "GLuint"} then {
+ s.copy "UINTEGER_32";
+ }.elseif {s == "GLfloat"} then {
+ s.copy "REAL_32";
+ }.elseif {s == "GLclampf"} then {
+ s.copy "REAL_32";
+ }.elseif {s == "GLdouble"} then {
+ s.copy "REAL_32"; // double !!!!
+ }.elseif {s == "GLclampd"} then {
+ s.copy "REAL_32"; // double !!!!
+ }.elseif {s == "GLvoid"} then {
+ s.copy "VOID";
+ }.elseif {s == "GLvoid*"} then {
+ s.copy "POINTER"; // FIXME: void** ??
+ } else {
+ "\nglspec2li: Warning: unknown C type: ".print;
+ s.print;
+ };
+ };
+ s
+ );
+
+ //
+ // Parser.
+ //
+
+ - position:INTEGER;
+
+ - string_tmp:STRING := STRING.create 128;
+
+
+ - last_character:CHARACTER <-
+ ( + result:CHARACTER;
+ (position > source.upper).if {
+ result := 0.to_character;
+ } else {
+ result := source.item position;
+ };
+ result
+ );
+
+ - last_string:STRING <- string_tmp;
+
+
+ - read_space:BOOLEAN <-
+ ( + pos,posold:INTEGER;
+ + level_comment:INTEGER;
+
+ pos := position;
+ posold := -1;
+
+ {posold = position}.until_do {
+ posold := position;
+
+ // Skip spaces :
+ {(last_character = 0.to_character) || {last_character > ' '}}.until_do {
+ position := position + 1;
+ };
+
+ (position < source.upper).if {
+ // Skip C comment style :
+
+ ((last_character = '/') && {source.item (position+1) = '*'}).if {
+ position := position + 2;
+ level_comment := 1;
+ {
+ (last_character = 0.to_character) || {level_comment = 0}
+ }.until_do {
+ ((last_character = '/') && {source.item (position+1) = '*'}).if {
+ level_comment := level_comment + 1;
+ position := position + 2;
+ }.elseif {
+ (last_character = '*') && {source.item (position+1) = '/'}
+ } then {
+ level_comment := level_comment - 1;
+ position := position + 2;
+ } else {
+ position := position+1;
+ };
+ };
+ };
+ };
+ };
+ TRUE
+ );
+
+ - read_symbol st:ABSTRACT_STRING :BOOLEAN <-
+ ( + posold,j:INTEGER;
+ + result:BOOLEAN;
+ // On passe les espaces :
+ (! read_space).if {
+ result := FALSE;
+ } else {
+ posold := position;
+ j := st.lower;
+ {(last_character = 0.to_character) ||
+ {(j > st.upper) || {last_character != st.item j}}}.until_do {
+ j := j+1;
+ position := position+1;
+ };
+ (j > st.upper).if {
+ result := TRUE;
+ } else {
+ position := posold;
+ result := FALSE;
+ };
+ };
+ result
+ );
+
+ - read_word:BOOLEAN <-
+ ( + result:BOOLEAN;
+ // On passe les espaces :
+ (! read_space).if {
+ result := FALSE;
+ } else {
+
+ string_tmp.clear;
+ string_tmp.add_last last_character;
+ position := position + 1;
+
+ {(last_character != 0.to_character) &&
+ {! last_character.is_separator}
+ }.while_do {
+ string_tmp.add_last last_character;
+ position := position+1;
+ };
+ result := TRUE;
+ };
+ result
+ );
diff --git a/gui/g_gldraw.li b/gui/g_gldraw.li
new file mode 100644
index 0000000..3a1d327
--- /dev/null
+++ b/gui/g_gldraw.li
@@ -0,0 +1,94 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+Section Header
+
+ + name := G_GLDRAW;
+
+
+ - copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
+
+ - comment := "OpenGL output for GUI.";
+
+Section Inherit
+
+ + parent_area:Expanded AREA;
+
+ + parent_g_expr:Expanded G_EXPR;
+
+Section Public
+
+ + scene:SCENE;
+
+ //
+ // Width / Height
+ //
+
+ - predict_size txt:ABSTRACT_STRING :(INTEGER,INTEGER) <-
+ (
+ (width,height)
+ );
+
+ - width_min:INTEGER <-
+ (
+ width + 50
+ );
+
+ - height_min:INTEGER <-
+ (
+ height + 50
+ );
+
+ //
+ // Creation.
+ //
+
+ - create sc:SCENE :SELF <-
+ ( + result:SELF;
+ result := SELF.clone;
+ result.make sc;
+ result
+ );
+
+ - make sc:SCENE <-
+ (
+ scene := sc;
+ GL_DRIVER.add_gldraw Self;
+ );
+
+ //
+ // Update position.
+ //
+
+ - set_position rac:AREA at (x,y:INTEGER) size (w,h:INTEGER) <-
+ (
+ update rac from (x,y) size (w,h);
+ );
+
+ //
+ // Display.
+ //
+
+ - draw (x0,y0:INTEGER) to (x1,y1:INTEGER) <-
+ (
+ //
+ // Drawn later with opengl framebuffer
+ //
+ );
diff --git a/gui/gl_desk.li b/gui/gl_desk.li
new file mode 100644
index 0000000..9251155
--- /dev/null
+++ b/gui/gl_desk.li
@@ -0,0 +1,144 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+Section Header
+
+ + name := GL_DESK;
+
+ - copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
+
+ - bibliography:="http://IsaacOS.com";
+ - author :="Sonntag Benoit (bsonntag at loria.fr)";
+ - comment :="User Interface and Events managment.";
+
+Section Inherit
+
+ - parent_desk:DESK := DESK;
+
+ - parent_platform:PLATFORM := PLATFORM;
+
+Section Private
+
+ - current_time:UINTEGER_32;
+ - prev_time:UINTEGER_32;
+ - time_per_frame:UINTEGER_32;
+
+Section Public
+
+ // Video.width
+ // +----------+
+ // | Physical |
+ // | Screen | Video.height
+ // +----------+
+ // / \
+ // |\ +----------+
+ // L | Desk | <-- double-buffered GL Desk
+ // Mouse | |
+ // +----------+
+ // |
+ // | Video.width * w
+ // +-----------------------+
+ // | Virtual Screen | Video.height * h
+ // | |
+ // +-----------------------+
+
+
+ - make bmp:ABSTRACT_BITMAP scale (w,h:INTEGER) with elt:G_EXPR <-
+ [
+ -? {w > 0};
+ -? {h > 0};
+ ]
+ ( + msg:EVENT;
+ + input:INPUT;
+ + frame_time:UINTEGER_32;
+
+ set_video_support bmp;
+ physical_screen := AREA.clone;
+ physical_screen.make NULL from (0,0) size (bmp.width,bmp.height);
+ //
+ root := elt;
+ //
+ (GL_DRIVER.is_initialized).if {
+ GL_EVENT_SYSTEM.make;
+ } else {
+ EVENT_SYSTEM.make;
+ };
+ focus := Self;
+ //
+ set_position physical_screen at (0,0)
+ size (physical_screen.width,physical_screen.height);
+
+ virtual_screen := VIRTUAL_SCREEN.create Self scale (w,h);
+ connect_to MOUSE;
+ connect_to KEYBOARD;
+ connect_to TIMER;
+
+ // Timer
+ init_time;
+ set_fps 60;
+ current_time := get_milliseconds;
+
+ {
+ (GL_DRIVER.is_initialized).if {
+ GL_EVENT_SYSTEM.get_event;
+ } else {
+ EVENT_SYSTEM.get_event;
+ };
+
+ {storage_message.is_empty}.until_do {
+ msg := storage_message.first;
+ storage_message.remove_first;
+ msg.set_destination focus;
+ focus.receive msg;
+ input ?= msg.source;
+ input.acknowledge;
+ };
+
+ (GL_DRIVER.is_initialized).if {
+
+ // update timer
+ prev_time := current_time;
+ current_time := get_milliseconds;
+ frame_time := current_time - prev_time;
+ (frame_time <= 0).if {
+ frame_time := 1;
+ };
+
+ //
+ GL_DRIVER.render (frame_time.to_real/1000.0);
+ //
+
+ // sleep to keep constant framerate
+ (time_per_frame > 0).if {
+ (frame_time < time_per_frame).if {
+ delay (time_per_frame - frame_time);
+ };
+ };
+ };
+ }.do_while {`1`:BOOLEAN(TRUE,FALSE)}; // Infinity Loop
+
+ // unreachable !!!
+ VIDEO.close;
+ );
+
+ - set_fps n:INTEGER <-
+ (
+ time_per_frame := 1000/n;
+ );
diff --git a/gui/gl_driver.li b/gui/gl_driver.li
new file mode 100644
index 0000000..8310b05
--- /dev/null
+++ b/gui/gl_driver.li
@@ -0,0 +1,218 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := GL_DRIVER;
+
+ - external := `#define GLBINDING__USE_GUI`;
+
+Section Inherit
+
+ + parent_opengl:Expanded OPENGL;
+
+ - parent_video_driver:VIDEO_DRIVER := VIDEO_DRIVER;
+
+Section Private
+
+ // GUI calls affects this virtual bitmap
+ - gui_screen:FAST_ARRAY[UINTEGER_8];// BITMAP[PIXEL_32];
+
+Section Public
+
+ - is_initialized:BOOLEAN;
+
+
+ - make (w,h:INTEGER) <-
+ (
+ parent_opengl.make (w,h);
+ gui_init (w,h);
+ );
+
+ - make (w,h:INTEGER) title s:ABSTRACT_STRING <-
+ (
+ parent_opengl.make (w,h) title s;
+ gui_init (w,h);
+ );
+
+ - gui_init (w,h:INTEGER) <-
+ (
+ gui_screen := FAST_ARRAY[UINTEGER_8].create (w*h*3);
+ `glPixelStorei(GL_UNPACK_ALIGNMENT, 1)`;
+
+ width := w;
+ height := h;
+
+ // init minimmal Framework (used by 3D stuff)
+ FRAMEWORK.make_for_gui Self;
+
+ is_initialized := TRUE;
+ );
+
+ - render t:REAL_32 <-
+ ( + p:POINTER;
+ + w,h:INTEGER;
+
+ parent_opengl.begin_frame;
+
+ `glMatrixMode(GL_PROJECTION)`;
+ `glPushMatrix()`;
+ `glLoadIdentity()`;
+
+ `glOrtho(0, at w, at h,0,-99999,99999)`;
+ `glMatrixMode(GL_MODELVIEW)`;
+ `glLoadIdentity()`;
+
+ w := width;
+ h := height;
+
+ p := gui_screen.to_external;
+ `glDrawPixels(@w, @h, GL_RGB, GL_UNSIGNED_BYTE, @p)`; // SLOW !!!!
+ `glFlush()`;
+
+ `glMatrixMode(GL_PROJECTION)`;
+ `glPopMatrix()`;
+
+ `glMatrixMode(GL_MODELVIEW)`;
+ `glLoadIdentity()`;
+
+ render_gldraw t;
+ );
+
+ - render_gldraw t:REAL_32 <-
+ ( + x0,x1,y0,y1:INTEGER;
+ + h:INTEGER;
+ + r,f:REAL_32;
+
+ (gl_components != NULL).if {
+ gl_components.lower.to (gl_components.upper) do { i:INTEGER;
+ x0 := gl_components.item i.x_window;
+ y0 := gl_components.item i.y_window-1;
+ x1 := gl_components.item i.width + x0;
+ y1 := gl_components.item i.height + y0;
+
+ h := height;
+ viewport.make (x0, h - y1, x1 - x0, y1 - y0);
+
+ `glViewport(@x0, @h - @y1, @x1 - @x0, @y1 - @y0)`;
+ `glScissor(@x0, @h - @y1, @x1 - @x0, @y1 - @y0)`;
+ `glEnable(GL_SCISSOR_TEST)`;
+
+ `glMatrixMode(GL_PROJECTION)`;
+ `glLoadIdentity()`;
+
+ r := (x1-x0).to_real / (y1-y0).to_real;
+ f := fov;
+ `gluPerspective(@f, @r, 0.1, 1000)`;
+
+ `glMatrixMode(GL_MODELVIEW)`;
+ `glLoadIdentity()`;
+
+ `glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);`;
+
+ // draw component
+ gl_components.item i.scene.render t;
+
+ `glDisable(GL_SCISSOR_TEST)`;
+ };
+ };
+ parent_opengl.end_frame;
+ );
+
+ - close <-
+ (
+ (gl_components != NULL).if {
+ gl_components.lower.to (gl_components.upper) do { i:INTEGER;
+ gl_components.item i.scene.release;
+ };
+ };
+ parent_opengl.close;
+ );
+
+ //
+ // GUI-OpenGL components
+ //
+
+Section Public
+
+ - gl_components:LINKED_LIST[G_GLDRAW];
+
+ - add_gldraw c:G_GLDRAW <-
+ (
+ (gl_components = NULL).if {
+ gl_components := LINKED_LIST[G_GLDRAW].create;
+ };
+ gl_components.add_last c;
+
+ //
+ c.scene.initialize;
+ //
+ );
+
+
+ //
+ // Redefine Low level Bitmap.
+ //
+
+Section Public
+
+ - pixel_hard (x,y:INTEGER) color col:UINTEGER_32 <-
+ ( + p:FAST_ARRAY[UINTEGER_8];
+ + xx,yy:INTEGER;
+ //GL_DRIVER.gui_screen.pixel_hard (x,y) color col;
+
+ xx := x;
+ yy := height - y;
+
+ p := GL_DRIVER.gui_screen;
+ PIXEL_32.make col;
+
+ p.put (PIXEL_32.red) to ((yy*width+xx)*3);
+ p.put (PIXEL_32.green) to ((yy*width+xx)*3+1);
+ p.put (PIXEL_32.blue) to ((yy*width+xx)*3+2);
+ );
+
+ - line_h_hard (x,y:INTEGER) until x1:INTEGER color col:UINTEGER_32 <-
+ (
+ //GL_DRIVER.gui_screen.line_h_hard (x,y) until x1 color col;
+
+ x.to x1 do { i:INTEGER;
+ pixel_hard (i,y) color col;
+ };
+ );
+
+ - line_h_hard (x,y:INTEGER) until x1:INTEGER
+ image line:ABSTRACT_BMP_LINE offset ofs:INTEGER <-
+ (
+ //GL_DRIVER.gui_screen.line_h_hard (x,y) until x1 image line offset ofs;
+
+ x.to x1 do { i:INTEGER;
+ pixel_hard (i,y) color ((line.item (ofs+i)).rgbcolor);
+ };
+ );
+
+ - get_pixel_hard (x,y:INTEGER) :PIXEL <-
+ (
+ // GL_DRIVER.gui_screen.get_pixel_hard (x,y)
+
+ PIXEL_32.make (gui_screen.item (x+ y*width));
+ PIXEL_32
+ );
diff --git a/gui/unix/gl_event_system.li b/gui/unix/gl_event_system.li
new file mode 100644
index 0000000..047db92
--- /dev/null
+++ b/gui/unix/gl_event_system.li
@@ -0,0 +1,136 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac OS Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+Section Header
+
+ + name := GL_EVENT_SYSTEM;
+
+ - copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
+
+ - comment := "X11 - Event System";
+
+Section Inherit
+
+ - parent_event_system:EVENT_SYSTEM := EVENT_SYSTEM;
+
+Section Public
+
+ - make <- ();
+
+ - get_event <-
+ (
+ + type:INTEGER;
+ + x0,y0,x1,y1:INTEGER;
+ + mouse_set:BOOLEAN;
+ + mouse_motion_x, mouse_motion_y:INTEGER;
+
+ {`XPending (win.dpy)`:INTEGER != 0}.while_do { // pb avec les bouttons...
+ // (`XPending (win.dpy)`:INTEGER != 0).if { // rame !!!
+ `XNextEvent (win.dpy, &event)`;
+ type := `event.type`:INTEGER;
+
+ type
+
+ //
+ // Event Keyboard
+ //
+
+ .when `KeyPress`:INTEGER then {
+ KEYBOARD.key `event.xkey.keycode`:UINTEGER_8 press TRUE;
+ }
+ .when `KeyRelease`:INTEGER then {
+ KEYBOARD.key `event.xkey.keycode`:UINTEGER_8 press FALSE;
+ }
+
+ //
+ // Event Mouse
+ //
+ .when `ButtonPress`:INTEGER then {
+ mouse_set := TRUE;
+ (`event.xbutton.button`:INTEGER = 1).if {
+ MOUSE.set (`event.xbutton.x`:INTEGER,`event.xbutton.y`:INTEGER) with (TRUE,(MOUSE.right));
+ } else {
+ MOUSE.set (`event.xbutton.x`:INTEGER,`event.xbutton.y`:INTEGER) with ((MOUSE.left),TRUE);
+ };
+ }
+ .when `ButtonRelease`:INTEGER then {
+ mouse_set := TRUE;
+ (`event.xbutton.button`:INTEGER = 1).if {
+ MOUSE.set (`event.xbutton.x`:INTEGER,`event.xbutton.y`:INTEGER) with (FALSE,(MOUSE.right));
+ } else {
+ MOUSE.set (`event.xbutton.x`:INTEGER,`event.xbutton.y`:INTEGER) with ((MOUSE.left),FALSE);
+ };
+ }
+ .when `MotionNotify`:INTEGER then {
+ mouse_motion_x := `event.xmotion.x`:INTEGER;
+ mouse_motion_y := `event.xmotion.y`:INTEGER;
+ //MOUSE.set (`event.xmotion.x`:INTEGER,`event.xmotion.y`:INTEGER) with ((MOUSE.left),(MOUSE.right));
+ }
+
+ //
+ // Event Window
+ //
+ .when `Expose`:INTEGER then {
+ // Refresh X Window
+ x0 := `event.xexpose.x`:INTEGER;
+ y0 := `event.xexpose.y`:INTEGER;
+ x1 := x0 + `event.xexpose.width` :INTEGER - 1;
+ y1 := y0 + `event.xexpose.height`:INTEGER - 1;
+ GL_DESK.physical_screen.redraw (x0,y0) to (x1,y1);
+ }
+ .when `ResizeRequest`:INTEGER then {
+ // Resize X Window
+ x1 := `event.xresizerequest.width`:INTEGER;
+ y1 := `event.xresizerequest.height`:INTEGER;
+
+ GL_DRIVER.resize (x1,y1);
+ `XResizeWindow(display,window, at x1, at y1)`;
+
+ VIDEO.pixel_hard (x1,10) color 0FF0000h;
+ GL_DESK.resize_window (x1,y1);
+ }
+ .when `ConfigureNotify`:INTEGER then {
+ // Resize X Window
+ x1 := `event.xconfigure.width`:INTEGER;
+ y1 := `event.xconfigure.height`:INTEGER;
+
+ GL_DRIVER.resize (x1,y1);
+ GL_DESK.resize_window (x1,y1);
+ }
+ .when `ClientMessage`:INTEGER then {
+ // TIMER.get_event;
+ };
+ };
+ ((! mouse_set) && {(mouse_motion_x != 0) && {mouse_motion_y != 0}}).if { // mouse hack
+ MOUSE.set (mouse_motion_x, mouse_motion_y) with ((MOUSE.left),(MOUSE.right));
+ };
+ );
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/gui/windows/gl_event_system.li b/gui/windows/gl_event_system.li
new file mode 100644
index 0000000..7b1e9a7
--- /dev/null
+++ b/gui/windows/gl_event_system.li
@@ -0,0 +1,65 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac OS Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+Section Header
+
+ + name := GL_EVENT_SYSTEM;
+
+ - copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
+
+ - comment := "OpenGL-win32 - Event System";
+
+ - bibliography:= "http://IsaacOS.com";
+ - author := "Benoit Sonntag (bsonntag at loria.fr)";
+
+Section Inherit
+
+ - parent_event_system:EVENT_SYSTEM := EVENT_SYSTEM;
+
+Section Public
+
+ - get_event <-
+ ( + go:BOOLEAN;
+
+ go := TRUE;
+ {go && {`PeekMessage (&msg_glob, NULL, 0, 0, PM_REMOVE)` != 0}}.while_do {
+ (`msg_glob.message`:INTEGER = `WM_QUIT`:INTEGER).if {
+ //
+ //// ????
+ //
+ go := FALSE;
+ } else {
+ `TranslateMessage (&msg_glob)`;
+ `DispatchMessage (&msg_glob)`;
+ };
+ };
+ );
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/images/bmp.li b/images/bmp.li
new file mode 100644
index 0000000..faaabf6
--- /dev/null
+++ b/images/bmp.li
@@ -0,0 +1,104 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := BMP;
+
+ - comment := "bmp loader";
+
+ /*
+ En construction...
+ */
+
+Section Inherit
+
+ - parent_format:IMAGE_FORMAT := IMAGE_FORMAT;
+
+Section Public
+
+ - format:STRING_CONSTANT := "bmp";
+
+
+ - load image:IMAGE :BOOLEAN <-
+ (
+ + result:BOOLEAN;
+ + bmp_buffer:FAST_ARRAY[UINTEGER_8];
+ + header:BMP_HEADER;
+
+ + columns,rows,stride:UINTEGER_32;
+ + image_data:FAST_ARRAY[UINTEGER_8];
+ + base,k:INTEGER;
+
+ + e:ENTRY;
+ + file:STD_FILE;
+
+ e := FILE_SYSTEM.get_entry (image.name);
+ (e != NULL).if {
+ file ?= e;
+ file.open;
+
+ bmp_buffer := FAST_ARRAY[UINTEGER_8].create_with_capacity (file.size+1);
+
+ (file.read bmp_buffer size (file.size) > 0).if {
+
+ header := CONVERT[NATIVE_ARRAY[UINTEGER_8],BMP_HEADER].on (bmp_buffer.storage);
+
+ image.set_size (header.width, header.height);
+ image.set_channels (header.bits_per_pixel >> 3);
+
+ ((!header.is_valid) || {header.is_rle8_compressed}).if {
+ error "Only uncompressed BMP files supported";
+ };
+
+ (image.channels = 3).if {
+ // load 24bit bitmap
+
+ columns := header.width;
+ rows := header.height;
+
+ stride := image.calculate_stride;
+
+ image_data := FAST_ARRAY[UINTEGER_8].create (stride * rows);
+ base := BMP_HEADER.object_size;
+
+ 0.to (rows-1) do { row:INTEGER;
+ k := row * stride;
+ 0.to (columns-1) do { i:INTEGER;
+ // swap bytes 0 & 2
+ image_data.put (bmp_buffer.item (base+k+i*3+2)) to (k+i*3);
+ image_data.put (bmp_buffer.item (base+k+i*3+1)) to (k+i*3+1);
+ image_data.put (bmp_buffer.item (base+k+i*3)) to (k+i*3+2);
+ };
+ };
+ image.set_data image_data;
+ result := TRUE;
+ }.elseif {image.channels = 1} then {
+ // load8
+
+ error "8bit bitmap not yet supported";
+ } else {
+ error "Unsupported bitmap";
+ };
+ };
+ };
+ result
+ );
\ No newline at end of file
diff --git a/images/image.li b/images/image.li
new file mode 100644
index 0000000..9de8e58
--- /dev/null
+++ b/images/image.li
@@ -0,0 +1,171 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := IMAGE;
+
+Section Inherit
+
+ + parent_image_format:IMAGE_FORMAT := IMAGE_FORMAT;
+
+Section IMAGE
+
+ + image_data:FAST_ARRAY[UINTEGER_8];
+
+Section Public
+
+ + name:STRING;
+
+ + width:INTEGER;
+ + height:INTEGER;
+
+ + channels:INTEGER;
+
+
+ - create s:ABSTRACT_STRING :SELF <-
+ ( + result:SELF;
+ result := SELF.clone;
+ result.make s;
+ result
+ );
+
+ - make s:ABSTRACT_STRING <-
+ (
+ name := STRING.create_from_string s;
+
+ set_format (IMAGE_FORMAT.get_format s);
+ load Self.if_false {
+ OPENGL.fatal_error ("Can't load image: "+s);
+ };
+ );
+
+ - create_empty s:ABSTRACT_STRING size (w,h:INTEGER) type n:INTEGER allocate b:BOOLEAN :SELF <-
+ ( + result:SELF;
+ result := SELF.clone;
+ result.make_empty (s,w,h,n,b);
+ result
+ );
+
+ - make_empty (s:ABSTRACT_STRING,w,h,n:INTEGER,allocate:BOOLEAN) <-
+ (
+ name := STRING.create_from_string s;
+ width := w;
+ height := h;
+ channels := n;
+
+ allocate.if {
+ image_data := FAST_ARRAY[UINTEGER_8].create (w*h*n);
+ };
+ );
+
+ - get_red_value (x,y:INTEGER) :UINTEGER_8 <-
+ (
+ ? {channels >= 3};
+ image_data.item (channels * (x*width+y))
+ );
+
+ - get_green_value (x,y:INTEGER) :UINTEGER_8 <-
+ (
+ ? {channels >= 3};
+ image_data.item (channels * (x*width+y)+1)
+ );
+
+ - get_blue_value (x,y:INTEGER) :UINTEGER_8 <-
+ (
+ ? {channels >= 3};
+ image_data.item (channels * (x*width+y)+2)
+ );
+
+ - get_alpha_value (x,y:INTEGER) :UINTEGER_8 <-
+ (
+ ? {channels > 3};
+ image_data.item (channels * (x*width+y)+3)
+ );
+
+ - get_value (x,y:INTEGER) :UINTEGER_8 <-
+ (
+ image_data.item (channels * (x*width+y))
+ );
+
+ - item val:INTEGER <-
+ (
+ image_data.item val;
+ );
+
+ - get_pixels:FAST_ARRAY[UINTEGER_8] <- image_data;
+
+
+ - set_size (w,h:INTEGER) <-
+ (
+ width := w;
+ height := h;
+ );
+
+ - set_channels ch:INTEGER <- channels := ch;
+
+
+ - set_format fmt:IMAGE_FORMAT <-
+ (
+ parent_image_format := fmt;
+ );
+
+ - set_data data:FAST_ARRAY[UINTEGER_8] <-
+ (
+ image_data := data;
+ );
+
+ - calculate_stride :UINTEGER_32 <-
+ (
+ + bits_per_line,bits_to_add:UINTEGER_32;
+
+ bits_per_line := width * (channels << 3);
+ ((bits_per_line % 32) != 0).if {
+ bits_to_add := 32 - (bits_per_line%32);
+ };
+ // return stride
+ (bits_per_line + bits_to_add) / 8
+ );
+
+ - to_greyscale:IMAGE <-
+ (
+ + result:IMAGE;
+ + grey:UINTEGER_8;
+ + j:INTEGER;
+
+ (channels = 1).if {
+ result := Self;
+ } else {
+ // create new image
+ result := create_empty name size (width,height) type 1 allocate TRUE;
+
+ j := 0;
+ 0.to (width*height) do { i:INTEGER;
+ // convert pixels: 0.3*R + 0.59*G + 0.11*B
+
+ grey := ((0.30 * image_data.item j.to_integer) + (0.59 * image_data.item (j+1).to_integer) + (0.11 * image_data.item (j+2).to_integer)).to_uinteger_8;
+ result.image_data.put grey to i;
+
+ j := j + channels;
+ };
+ };
+ result
+ );
\ No newline at end of file
diff --git a/images/image_format.li b/images/image_format.li
new file mode 100644
index 0000000..b6aa2e6
--- /dev/null
+++ b/images/image_format.li
@@ -0,0 +1,59 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := IMAGE_FORMAT;
+
+Section Inherit
+
+ - parent_object:OBJECT := OBJECT;
+
+Section Public
+
+ - format:STRING_CONSTANT <- deferred;
+
+ - load image:IMAGE :BOOLEAN <-
+ (
+ error "Unknown format";
+ FALSE
+ );
+
+
+ - get_format fmt:ABSTRACT_STRING :IMAGE_FORMAT <-
+ (
+ + result:IMAGE_FORMAT;
+
+ (fmt.has_substring ".bmp").if {
+ result := BMP;
+ }.elseif {fmt.has_substring ".tga"} then {
+ result := TGA;
+ } else {
+
+ result := Self;
+ };
+ result
+ );
+
+ - error err:ABSTRACT_STRING <-
+ (
+ err.print;
+ );
\ No newline at end of file
diff --git a/images/tga.li b/images/tga.li
new file mode 100644
index 0000000..ccb84e3
--- /dev/null
+++ b/images/tga.li
@@ -0,0 +1,221 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := TGA;
+
+ - comment := "tga loader";
+ /*
+ En construction...
+ */
+Section Inherit
+
+ - parent_format:IMAGE_FORMAT := IMAGE_FORMAT;
+
+Section Public
+
+ - format:STRING_CONSTANT := "tga";
+
+ - load image:IMAGE :BOOLEAN <-
+ (
+ + result:BOOLEAN;
+ + tga_buffer:FAST_ARRAY[UINTEGER_8];
+
+ + buffer_pos:INTEGER;
+ + header:TGA_HEADER;
+
+ + image_data:FAST_ARRAY[UINTEGER_8];
+ + temp:UINTEGER_8;
+
+ + e:ENTRY;
+ + file:STD_FILE;
+
+ + channels:INTEGER;
+ + stride,i,line_idx:INTEGER;
+
+ e := FILE_SYSTEM.get_entry (image.name);
+ (e != NULL).if {
+ file ?= e;
+ file.open;
+
+ tga_buffer := FAST_ARRAY[UINTEGER_8].create_with_capacity (file.size+1);
+
+ (file.read tga_buffer size (file.size) > 0).if {
+
+ header := CONVERT[NATIVE_ARRAY[UINTEGER_8],TGA_HEADER].on (tga_buffer.storage);
+
+ buffer_pos := TGA_HEADER.object_size;
+
+ channels := header.bits_per_pixel >> 3;
+ image.set_size (header.width, header.height);
+ image.set_channels channels;
+
+ (! header.is_compressed).if {
+ ((channels = 3) || {channels = 4}).if {
+
+ stride := image.calculate_stride;//channels * header.width;
+
+ image_data := FAST_ARRAY[UINTEGER_8].create (stride * header.height);
+
+ // read data line by line
+ 0.to (header.height-1) do { y:INTEGER;
+
+ line_idx := stride*y;
+
+ // read current line
+ 0.to (stride-1) do { k:INTEGER;
+ image_data.put (tga_buffer.item buffer_pos) to (line_idx+k);
+ buffer_pos := buffer_pos + 1;
+ };
+
+ // swap bgr to rgb colors
+ i := 0;
+ {i < stride}.while_do {
+
+ temp := image_data.item (line_idx + i);
+ image_data.put (image_data.item (line_idx+i+2)) to (line_idx+i);
+ image_data.put temp to (line_idx+i+2);
+
+ i := i + channels;
+ };
+ };
+ result := TRUE;
+
+ }.elseif {channels = 2} then {
+ // 16bit tga
+
+ + r,g,b:UINTEGER_8;
+
+ stride := image.calculate_stride;//channels * header.width;
+
+ image_data := FAST_ARRAY[UINTEGER_8].create (stride * header.height);
+ // read data
+ 0.to (header.width*header.height-1) do { y:INTEGER;
+
+ temp := tga_buffer.item buffer_pos;
+ buffer_pos := buffer_pos + 1;
+
+ b := (temp & 01Fh) << 3;
+ g := ((temp >> 5) & 01Fh) << 3;
+ r := ((temp >> 10) & 01Fh) << 3;
+
+ image_data.put r to (y*3);
+ image_data.put g to (y*3+1);
+ image_data.put b to (y*3+2);
+ };
+ result := TRUE;
+ };
+ } else {
+ //
+ // load compressed tga
+ //
+
+ + temp_data:FAST_ARRAY[UINTEGER_8];
+ + nb_pixels,current_pixel:INTEGER;
+ + color_buffer:FAST_ARRAY[UINTEGER_8];
+ + rle_id:UINTEGER_8;
+
+ ((channels = 3) || {channels = 4}).if {
+ temp_data := FAST_ARRAY[UINTEGER_8].create_with_capacity (header.width * header.height*channels);
+ nb_pixels := header.width * header.height;
+ color_buffer := FAST_ARRAY[UINTEGER_8].create_with_capacity channels;
+
+ {
+ // read RLE chunk header
+ rle_id := tga_buffer.item buffer_pos;
+ buffer_pos := buffer_pos + 1;
+
+ (rle_id < 128).if {
+ // read raw colour values
+
+ 0.to rle_id do { counter:INTEGER;
+ color_buffer.clear;
+
+ 1.to channels do { w:INTEGER;
+ color_buffer.add_last (tga_buffer.item buffer_pos);
+ buffer_pos := buffer_pos + 1;
+ };
+ // transfer pixel colour & swap BGR to RGB
+ temp_data.add_last (color_buffer.item 2);
+ temp_data.add_last (color_buffer.item 1);
+ temp_data.add_last (color_buffer.item 0);
+
+ (channels = 4).if {
+ temp_data.add_last (color_buffer.item 3);
+ };
+ current_pixel := current_pixel + 1;
+
+ (current_pixel > nb_pixels).if {
+ error "too many pixels";
+ };
+ };
+ } else {
+ // rle_id >= 128
+
+ rle_id := rle_id - 127;
+
+ // read chunk color
+ color_buffer.clear;
+ 1.to channels do { w:INTEGER;
+ color_buffer.add_last (tga_buffer.item buffer_pos);
+ buffer_pos := buffer_pos + 1;
+ };
+
+ // duplicate pixel value rle_id 'times
+ 0.to (rle_id-1) do { counter:INTEGER;
+
+ // swap BGR to RGB
+ temp_data.add_last (color_buffer.item 2);
+ temp_data.add_last (color_buffer.item 1);
+ temp_data.add_last (color_buffer.item 0);
+
+ (channels = 4).if {
+ temp_data.add_last (color_buffer.item 3);
+ };
+ current_pixel := current_pixel + 1;
+
+ (current_pixel > nb_pixels).if {
+ error "too many pixels";
+ };
+ };
+ };
+ }.do_while {current_pixel < nb_pixels};
+
+ stride := image.calculate_stride;
+ image_data := FAST_ARRAY[UINTEGER_8].create (stride * header.height);
+ // line by line copy with 32bit aligned
+ 0.to (header.height-1) do { row:INTEGER;
+ i := header.width * channels;
+ 0.to i do { j:INTEGER;
+ image_data.put (temp_data.item (row*header.width*channels+j)) to (row*stride+j);
+ };
+ };
+ result := TRUE;
+ } else {
+ error "image not supported";
+ };
+ };
+ };
+ image.set_data image_data;
+ };
+ result
+ );
\ No newline at end of file
diff --git a/images/tga_header.li b/images/tga_header.li
new file mode 100644
index 0000000..2768786
--- /dev/null
+++ b/images/tga_header.li
@@ -0,0 +1,74 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := TGA_HEADER;
+
+ - comment := "Mapping TGA Image File Header structure";
+
+Section Inherit
+
+ - parent_object:OBJECT := OBJECT;
+
+Section Mapping
+
+ //
+ // TGA Header
+ //
+
+ + data_offset:UINTEGER_8;
+ + reserved:UINTEGER_8;
+
+ + type:UINTEGER_8;
+
+ + not_used1:UINTEGER_32;// skip 9byte
+ + not_used2:UINTEGER_32;
+ + not_used3:UINTEGER_8;
+
+ + map_width:UINTEGER_16;
+ + map_height:UINTEGER_16;
+ + bpp:UINTEGER_8;
+
+ + flags:UINTEGER_8;
+
+Section Public
+
+ - width:INTEGER <- map_width;
+ - height:INTEGER <- map_height;
+
+ - bits_per_pixel:INTEGER <- bpp;
+
+ - is_compressed:BOOLEAN <-
+ (
+ type = 10
+ );
+
+ - need_flip:BOOLEAN <-
+ (
+ flags & 020h = 1
+ );
+
+ - print <-
+ (
+
+ '\n'.print;
+ );
diff --git a/opengl/extensions/arb_fragment_shader.li b/opengl/extensions/arb_fragment_shader.li
new file mode 100644
index 0000000..e731dfc
--- /dev/null
+++ b/opengl/extensions/arb_fragment_shader.li
@@ -0,0 +1,44 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := ARB_FRAGMENT_SHADER;
+
+ - comment := "GL_ARB_fragment_shader extension";
+
+ - external := `
+
+ #define GL_FRAGMENT_SHADER_ARB 0x8B30
+ `;
+
+Section Inherit
+
+ - parent_gl_extension:GL_EXTENSION := GL_EXTENSION;
+
+Section Public
+
+ - name:STRING_CONSTANT := "GL_ARB_fragment_shader";
+
+ - make <-
+ (
+ );
+
\ No newline at end of file
diff --git a/opengl/extensions/arb_multitexture.li b/opengl/extensions/arb_multitexture.li
new file mode 100644
index 0000000..7e1d2e5
--- /dev/null
+++ b/opengl/extensions/arb_multitexture.li
@@ -0,0 +1,77 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := ARB_MULTITEXTURE;
+
+ - comment := "GL_ARB_multitexture extension";
+
+ - external := `
+
+ #define GL_TEXTURE0_ARB 0x84C0
+ typedef void (APIENTRY * PFNGLACTIVETEXTUREARBPROC) (GLenum target);
+ typedef void (APIENTRY * PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture);
+ typedef void (APIENTRY * PFNGLMULTITEXCOORD2FARBPROC) (GLenum target,float s,float t);
+
+ PFNGLACTIVETEXTUREARBPROC liglActiveTextureARB = NULL;
+ PFNGLCLIENTACTIVETEXTUREARBPROC liglClientActiveTextureARB = NULL;
+ PFNGLMULTITEXCOORD2FARBPROC liglMultiTexCoord2fARB = NULL;
+ `;
+
+Section Inherit
+
+ - parent_gl_extension:GL_EXTENSION := GL_EXTENSION;
+
+Section Public
+
+ - name:STRING_CONSTANT := "GL_ARB_multitexture";
+
+ - make <-
+ (
+ `liglActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC) GPA("glActiveTextureARB")`;
+ `liglClientActiveTextureARB = (PFNGLCLIENTACTIVETEXTUREARBPROC) GPA("glClientActiveTextureARB")`;
+ `liglMultiTexCoord2fARB = (PFNGLMULTITEXCOORD2FARBPROC) GPA("glMultiTexCoord2fARB")`;
+ );
+
+ - active_texture n:INTEGER <-
+ (
+ + unit:INTEGER;
+
+ unit := `GL_TEXTURE0_ARB`:INTEGER + n;
+ `liglActiveTextureARB(@unit)`;
+ );
+
+ - client_active_texture n:INTEGER <-
+ (
+ + unit:INTEGER;
+
+ unit := `GL_TEXTURE0_ARB`:INTEGER + n;
+ `liglClientActiveTextureARB(@unit)`;
+ );
+
+ - texcoord2f (s,t:REAL_32) unit n:INTEGER <-
+ (
+ + unit:INTEGER;
+
+ unit := `GL_TEXTURE0_ARB`:INTEGER + n;
+ `liglMultiTexCoord2fARB(@unit, @s, @t)`;
+ );
\ No newline at end of file
diff --git a/opengl/extensions/arb_shader_object.li b/opengl/extensions/arb_shader_object.li
new file mode 100644
index 0000000..9695bb0
--- /dev/null
+++ b/opengl/extensions/arb_shader_object.li
@@ -0,0 +1,223 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := ARB_SHADER_OBJECT;
+
+ - comment := "GL_ARB_shader_object extension";
+
+ - external := `
+
+ #define GL_OBJECT_COMPILE_STATUS_ARB 0x8B81
+ #define GL_OBJECT_INFO_LOG_LENGTH_ARB 0x8B84
+
+ typedef GLuint (APIENTRY * LIGLCREATESHADERARBPROC) (GLenum target);
+ typedef void (APIENTRY * LIGLSHADERSOURCEARBPROC) (GLuint shader, int numOfStrings, char** strings, int* lenOfStrings);
+ typedef void (APIENTRY * LIGLCOMPILESHADERARBPROC) (GLuint shader);
+ typedef GLuint (APIENTRY * LIGLCREATEPROGRAMARBPROC) (void);
+ typedef void (APIENTRY * LIGLATTACHOBJECTARBPROC) (GLuint program, GLuint shader);
+ typedef void (APIENTRY * LIGLLINKPROGRAMARBPROC) (GLuint program);
+ typedef void (APIENTRY * LIGLUSEPROGRAMARBPROC) (GLuint program);
+ typedef void (APIENTRY * LIGLDELETEOBJECTBPROC) (GLuint object);
+
+ typedef void (APIENTRY * LIGLGETINFOLOGARBPROC) (GLuint obj, GLint sz, GLint* len, char* infolog);
+ typedef void (APIENTRY * LIGLPARAMARBPROC) (GLuint obj, GLenum name, GLint* params);
+
+ typedef GLint (APIENTRY * LIGLGETUNIFORMLOCATIONARBPROC) (GLuint pgm, char* name);
+ typedef void (APIENTRY * LIGLUNIFORM1FARBPROC) (GLint loc,GLfloat v0);
+ typedef void (APIENTRY * LIGLUNIFORM2FARBPROC) (GLint loc,GLfloat v0,GLfloat v1);
+ typedef void (APIENTRY * LIGLUNIFORM3FARBPROC) (GLint loc,GLfloat v0,GLfloat v1,GLfloat v2);
+ typedef void (APIENTRY * LIGLUNIFORM4FARBPROC) (GLint loc,GLfloat v0,GLfloat v1,GLfloat v2,GLfloat v3);
+
+ LIGLCREATESHADERARBPROC liglCreateShaderARB = NULL;
+ LIGLSHADERSOURCEARBPROC liglShaderSourceARB = NULL;
+ LIGLCOMPILESHADERARBPROC liglCompileShaderARB = NULL;
+ LIGLCREATEPROGRAMARBPROC liglCreateProgramObjectARB = NULL;
+ LIGLATTACHOBJECTARBPROC liglAttachObjectARB = NULL;
+ LIGLLINKPROGRAMARBPROC liglLinkProgramARB = NULL;
+ LIGLUSEPROGRAMARBPROC liglUseProgramObjectARB = NULL;
+ LIGLDELETEOBJECTBPROC liglDeleteObjectARB = NULL;
+ LIGLGETINFOLOGARBPROC liglGetInfoLogARB = NULL;
+ LIGLPARAMARBPROC liglGetParameterivARB = NULL;
+
+ LIGLGETUNIFORMLOCATIONARBPROC liglGetUniformLocationARB = NULL;
+ LIGLUNIFORM1FARBPROC liglUniform1fARB = NULL;
+ LIGLUNIFORM2FARBPROC liglUniform2fARB = NULL;
+ LIGLUNIFORM3FARBPROC liglUniform3fARB = NULL;
+ LIGLUNIFORM4FARBPROC liglUniform4fARB = NULL;
+ int GL_ARB_shader_object_dummy;
+ `;
+
+Section Inherit
+
+ - parent_gl_extension:GL_EXTENSION := GL_EXTENSION;
+
+Section Public
+
+ - name:STRING_CONSTANT := "GL_ARB_shader_object";
+
+ - make <-
+ (
+ `liglCreateShaderARB = (LIGLCREATESHADERARBPROC) GPA("glCreateShaderObjectARB")`;
+ `liglShaderSourceARB = (LIGLSHADERSOURCEARBPROC) GPA("glShaderSourceARB")`;
+ `liglCompileShaderARB = (LIGLCOMPILESHADERARBPROC) GPA("glCompileShaderARB")`;
+ `liglCreateProgramObjectARB = (LIGLCREATEPROGRAMARBPROC) GPA("glCreateProgramObjectARB")`;
+ `liglAttachObjectARB = (LIGLATTACHOBJECTARBPROC) GPA("glAttachObjectARB")`;
+ `liglLinkProgramARB = (LIGLLINKPROGRAMARBPROC) GPA("glLinkProgramARB")`;
+ `liglUseProgramObjectARB = (LIGLUSEPROGRAMARBPROC) GPA("glUseProgramObjectARB")`;
+ `liglDeleteObjectARB = (LIGLDELETEOBJECTBPROC) GPA("glDeleteObjectARB")`;
+ `liglGetInfoLogARB = (LIGLGETINFOLOGARBPROC) GPA("glGetInfoLogARB")`;
+ `liglGetParameterivARB = (LIGLPARAMARBPROC) GPA("glGetObjectParameterivARB")`;
+
+ `liglGetUniformLocationARB = (LIGLGETUNIFORMLOCATIONARBPROC) GPA("glGetUniformLocationARB")`;
+ `liglUniform1fARB = (LIGLUNIFORM1FARBPROC) GPA("glUniform1fARB")`;
+ `liglUniform2fARB = (LIGLUNIFORM2FARBPROC) GPA("glUniform2fARB")`;
+ `liglUniform3fARB = (LIGLUNIFORM3FARBPROC) GPA("glUniform3fARB")`;
+ `liglUniform4fARB = (LIGLUNIFORM4FARBPROC) GPA("glUniform4fARB")`;
+ );
+
+ - create_program:UINTEGER_32 <-
+ (
+ `liglCreateProgramObjectARB()`:UINTEGER_32
+ );
+
+ - attach_object (program,shader:UINTEGER_32) <-
+ (
+ `liglAttachObjectARB(@program, @shader)`;
+ );
+
+ - link_program program:UINTEGER_32 <-
+ (
+ `liglLinkProgramARB(@program)`;
+ );
+
+ - use_program program:UINTEGER_32 <-
+ (
+ `liglUseProgramObjectARB(@program)`;
+ );
+
+ - create_vertex_shader:UINTEGER_32 <-
+ (
+ `liglCreateShaderARB(GL_VERTEX_SHADER_ARB)`:UINTEGER_32
+ );
+
+ - create_fragment_shader:UINTEGER_32 <-
+ (
+ `liglCreateShaderARB(GL_FRAGMENT_SHADER_ARB)`:UINTEGER_32
+ );
+ /*
+ - shader_source shader:INTEGER strings src:FAST_ARRAY[STRING] size sz:FAST_ARRAY[INTEGER]<-
+ (
+ + n:INTEGER;
+ + p,p2:POINTER;
+
+ n := src.count;
+ p := src.to_external;
+ p2 := sz.to_external;
+ `liglShaderSourceARB(@shader, @n, @p, @p2)`;
+ );
+ */
+ - shader_source shader:INTEGER string src:STRING <-
+ (
+ + p:NATIVE_ARRAY[CHARACTER];
+
+ p := src.to_external;
+ `liglShaderSourceARB(@shader, 1, (char**)(&@p), NULL)`;
+ );
+ /*
+ - shader_source shader:INTEGER string src:STRING size n:INTEGER <-
+ (
+ + p:NATIVE_ARRAY[CHARACTER];
+
+ p := src.to_external;
+ `liglShaderSourceARB(@shader, 1, (char**)(&@p), @n)`;
+ );
+ */
+ - compile shader:UINTEGER_32 <-
+ (
+ `liglCompileShaderARB(@shader)`;
+ );
+
+ - delete_object obj:UINTEGER_32 <-
+ (
+ `liglDeleteObjectARB(@obj)`;
+ );
+
+ - get_parameteri (obj,pname:UINTEGER_32) :INTEGER <-
+ (
+ `liglGetParameterivARB(@obj, @pname, &GL_ARB_shader_object_dummy)`;
+ `GL_ARB_shader_object_dummy`:INTEGER
+ );
+
+ - get_parameteriv (obj,pname:UINTEGER_32) in buf:FAST_ARRAY[INTEGER] <- // ??
+ ( + p:POINTER;
+
+ p := buf.to_external;
+ `liglGetParameterivARB(@obj, @pname, @p)`;
+ );
+
+ - get_infolog_status obj:UINTEGER_32 :INTEGER <-
+ (
+ get_parameteri (obj,`GL_OBJECT_COMPILE_STATUS_ARB`:UINTEGER_32)
+ );
+
+ - get_infolog_length obj:UINTEGER_32 :INTEGER <-
+ (
+ get_parameteri (obj,`GL_OBJECT_INFO_LOG_LENGTH_ARB`:UINTEGER_32)
+ );
+
+ - get_infolog obj:UINTEGER_32 in buffer:FAST_ARRAY[CHARACTER] size sz:INTEGER <-
+ ( + p:POINTER;
+
+ p := buffer.to_external;
+ `liglGetInfoLogARB(@obj, @sz, &GL_ARB_shader_object_dummy, @p)`;
+ );
+
+ - get_uniform_location (program:UINTEGER_32, name:ABSTRACT_STRING) :INTEGER <-
+ ( + p:NATIVE_ARRAY[CHARACTER];
+
+ p := name.to_external;
+ `liglGetUniformLocationARB(@program, @p)`:INTEGER
+ );
+
+ - uniform1f (location:INTEGER, v0:REAL_32) <-
+ (
+ `liglUniform1fARB(@location, @v0)`;
+ );
+
+ - uniform2f (location:INTEGER, v0,v1:REAL_32) <-
+ (
+ `liglUniform2fARB(@location, @v0, @v1)`;
+ );
+
+ - uniform3f (location:INTEGER, v0,v1,v2:REAL_32) <-
+ (
+ `liglUniform3fARB(@location, @v0, @v1, @v2)`;
+ );
+
+ - uniform4f (location:INTEGER, v0,v1,v2,v3:REAL_32) <-
+ (
+ `liglUniform4fARB(@location, @v0, @v1, @v2, @v3)`;
+ );
+
+
+
\ No newline at end of file
diff --git a/opengl/extensions/arb_shading_language_100.li b/opengl/extensions/arb_shading_language_100.li
new file mode 100644
index 0000000..ef229c7
--- /dev/null
+++ b/opengl/extensions/arb_shading_language_100.li
@@ -0,0 +1,40 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := ARB_SHADING_LANGUAGE_100;
+
+ - comment := "GL_ARB_shading_language_100 extension";
+
+Section Inherit
+
+ - parent_gl_extension:GL_EXTENSION := GL_EXTENSION;
+
+Section Public
+
+ - name:STRING_CONSTANT := "GL_ARB_shading_language_100";
+
+ - make <-
+ (
+ // nothing
+ );
+
\ No newline at end of file
diff --git a/opengl/extensions/arb_vertex_buffer_object.li b/opengl/extensions/arb_vertex_buffer_object.li
new file mode 100644
index 0000000..fedf865
--- /dev/null
+++ b/opengl/extensions/arb_vertex_buffer_object.li
@@ -0,0 +1,122 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := ARB_VERTEX_BUFFER_OBJECT;
+
+ - comment := "ARB_vertex_buffer_object extension";
+
+ - external := `
+
+ // VBO Extension Definitions, From glext.h
+ #define GL_ARRAY_BUFFER_ARB 0x8892
+ #define GL_ELEMENT_ARRAY_BUFFER_ARB 0x8893
+ #define GL_STATIC_DRAW_ARB 0x88E4
+ typedef void (APIENTRY * PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer);
+ typedef void (APIENTRY * PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers);
+ typedef void (APIENTRY * PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint *buffers);
+ typedef void (APIENTRY * PFNGLBUFFERDATAARBPROC) (GLenum target, int size, const GLvoid *data, GLenum usage);
+
+ // VBO Extension Function Pointers
+ PFNGLGENBUFFERSARBPROC liglGenBuffersARB = NULL;
+ PFNGLBINDBUFFERARBPROC liglBindBufferARB = NULL;
+ PFNGLBUFFERDATAARBPROC liglBufferDataARB = NULL;
+ PFNGLDELETEBUFFERSARBPROC liglDeleteBuffersARB = NULL;
+ unsigned int ARB_vertex_buffer_object_id;
+ `;
+
+Section Inherit
+
+ - parent_gl_extension:GL_EXTENSION := GL_EXTENSION;
+
+Section Public
+
+ - name:STRING_CONSTANT := "ARB_vertex_buffer_object";
+
+ - make <-
+ (
+ // Get Pointers To The GL Functions
+ `liglGenBuffersARB = (PFNGLGENBUFFERSARBPROC) GPA("glGenBuffersARB");
+ liglBindBufferARB = (PFNGLBINDBUFFERARBPROC) GPA("glBindBufferARB");
+ liglBufferDataARB = (PFNGLBUFFERDATAARBPROC) GPA("glBufferDataARB");
+ liglDeleteBuffersARB = (PFNGLDELETEBUFFERSARBPROC) GPA("glDeleteBuffersARB");`;
+ );
+
+ - genbuffer:UINTEGER_32 <-
+ (
+ `liglGenBuffersARB(1, &ARB_vertex_buffer_object_id)`;
+ `ARB_vertex_buffer_object_id`:UINTEGER_32
+ );
+
+ - genbuffers n:INTEGER :FAST_ARRAY[UINTEGER_32] <-
+ (
+ + p:POINTER;
+ + result:FAST_ARRAY[UINTEGER_32];
+
+ result := FAST_ARRAY[UINTEGER_32].create n;
+ p := result.to_external;
+ `liglGenBuffersARB(@n, @p)`;
+ result
+ );
+
+ - bind buffer:UINTEGER_32 <-
+ (
+ `liglBindBufferARB(GL_ARRAY_BUFFER_ARB, @buffer)`;
+ );
+
+ - bind_index buffer:UINTEGER_32 <-
+ (
+ `liglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, @buffer)`;
+ );
+
+ - disable <-
+ (
+ `liglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0)`;
+ );
+
+ - disable_index <-
+ (
+ `liglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0)`;
+ );
+
+ - buffer_data data:POINTER size sz:INTEGER <-
+ (
+ `liglBufferDataARB(GL_ARRAY_BUFFER_ARB, @sz, @data, GL_STATIC_DRAW_ARB)`;
+ );
+
+ - buffer_index_data data:POINTER size sz:INTEGER <-
+ (
+ `liglBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, @sz, @data, GL_STATIC_DRAW_ARB)`;
+ );
+
+ - delete id:UINTEGER_32 <-
+ (
+ `liglDeleteBuffersARB(1, (GLuint*)@id)`;
+ );
+
+ - delete_buffers ids:FAST_ARRAY[UINTEGER_32] count n:INTEGER <-
+ (
+ + p:POINTER;
+
+ p := ids.to_external;
+ `liglDeleteBuffersARB(@n, @p)`;
+ );
\ No newline at end of file
diff --git a/opengl/extensions/arb_vertex_shader.li b/opengl/extensions/arb_vertex_shader.li
new file mode 100644
index 0000000..9005a8b
--- /dev/null
+++ b/opengl/extensions/arb_vertex_shader.li
@@ -0,0 +1,44 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := ARB_VERTEX_SHADER;
+
+ - comment := "GL_ARB_vertex_shader extension";
+
+ - external := `
+
+ #define GL_VERTEX_SHADER_ARB 0x8B31
+ `;
+
+Section Inherit
+
+ - parent_gl_extension:GL_EXTENSION := GL_EXTENSION;
+
+Section Public
+
+ - name:STRING_CONSTANT := "GL_ARB_vertex_shader";
+
+ - make <-
+ (
+ );
+
\ No newline at end of file
diff --git a/opengl/gl.li b/opengl/gl.li
new file mode 100644
index 0000000..5ab6682
--- /dev/null
+++ b/opengl/gl.li
@@ -0,0 +1,946 @@
+// **** file generated by glspec2li ****
+Section Header
+
+ + name := GL;
+ - comment := "OpenGL C Specification";
+
+Section Inherit
+
+ - parent_object:OBJECT := OBJECT;
+
+Section Public
+
+//
+// OpenGL constant.
+//
+
+ - cst_gl_version_1_1:INTEGER <- 1;
+ - cst_gl_accum:INTEGER <- 00100h;
+ - cst_gl_load:INTEGER <- 00101h;
+ - cst_gl_return:INTEGER <- 00102h;
+ - cst_gl_mult:INTEGER <- 00103h;
+ - cst_gl_add:INTEGER <- 00104h;
+ - cst_gl_never:INTEGER <- 00200h;
+ - cst_gl_less:INTEGER <- 00201h;
+ - cst_gl_equal:INTEGER <- 00202h;
+ - cst_gl_lequal:INTEGER <- 00203h;
+ - cst_gl_greater:INTEGER <- 00204h;
+ - cst_gl_notequal:INTEGER <- 00205h;
+ - cst_gl_gequal:INTEGER <- 00206h;
+ - cst_gl_always:INTEGER <- 00207h;
+ - cst_gl_current_bit:INTEGER <- 000000001h;
+ - cst_gl_point_bit:INTEGER <- 000000002h;
+ - cst_gl_line_bit:INTEGER <- 000000004h;
+ - cst_gl_polygon_bit:INTEGER <- 000000008h;
+ - cst_gl_polygon_stipple_bit:INTEGER <- 000000010h;
+ - cst_gl_pixel_mode_bit:INTEGER <- 000000020h;
+ - cst_gl_lighting_bit:INTEGER <- 000000040h;
+ - cst_gl_fog_bit:INTEGER <- 000000080h;
+ - cst_gl_depth_buffer_bit:INTEGER <- 000000100h;
+ - cst_gl_accum_buffer_bit:INTEGER <- 000000200h;
+ - cst_gl_stencil_buffer_bit:INTEGER <- 000000400h;
+ - cst_gl_viewport_bit:INTEGER <- 000000800h;
+ - cst_gl_transform_bit:INTEGER <- 000001000h;
+ - cst_gl_enable_bit:INTEGER <- 000002000h;
+ - cst_gl_color_buffer_bit:INTEGER <- 000004000h;
+ - cst_gl_hint_bit:INTEGER <- 000008000h;
+ - cst_gl_eval_bit:INTEGER <- 000010000h;
+ - cst_gl_list_bit:INTEGER <- 000020000h;
+ - cst_gl_texture_bit:INTEGER <- 000040000h;
+ - cst_gl_scissor_bit:INTEGER <- 000080000h;
+ - cst_gl_all_attrib_bits:INTEGER <- 0000fffffh;
+ - cst_gl_points:INTEGER <- 00000h;
+ - cst_gl_lines:INTEGER <- 00001h;
+ - cst_gl_line_loop:INTEGER <- 00002h;
+ - cst_gl_line_strip:INTEGER <- 00003h;
+ - cst_gl_triangles:INTEGER <- 00004h;
+ - cst_gl_triangle_strip:INTEGER <- 00005h;
+ - cst_gl_triangle_fan:INTEGER <- 00006h;
+ - cst_gl_quads:INTEGER <- 00007h;
+ - cst_gl_quad_strip:INTEGER <- 00008h;
+ - cst_gl_polygon:INTEGER <- 00009h;
+ - cst_gl_zero:INTEGER <- 0;
+ - cst_gl_one:INTEGER <- 1;
+ - cst_gl_src_color:INTEGER <- 00300h;
+ - cst_gl_one_minus_src_color:INTEGER <- 00301h;
+ - cst_gl_src_alpha:INTEGER <- 00302h;
+ - cst_gl_one_minus_src_alpha:INTEGER <- 00303h;
+ - cst_gl_dst_alpha:INTEGER <- 00304h;
+ - cst_gl_one_minus_dst_alpha:INTEGER <- 00305h;
+ - cst_gl_dst_color:INTEGER <- 00306h;
+ - cst_gl_one_minus_dst_color:INTEGER <- 00307h;
+ - cst_gl_src_alpha_saturate:INTEGER <- 00308h;
+ - cst_gl_true:INTEGER <- 1;
+ - cst_gl_false:INTEGER <- 0;
+ - cst_gl_clip_plane0:INTEGER <- 03000h;
+ - cst_gl_clip_plane1:INTEGER <- 03001h;
+ - cst_gl_clip_plane2:INTEGER <- 03002h;
+ - cst_gl_clip_plane3:INTEGER <- 03003h;
+ - cst_gl_clip_plane4:INTEGER <- 03004h;
+ - cst_gl_clip_plane5:INTEGER <- 03005h;
+ - cst_gl_byte:INTEGER <- 01400h;
+ - cst_gl_unsigned_byte:INTEGER <- 01401h;
+ - cst_gl_short:INTEGER <- 01402h;
+ - cst_gl_unsigned_short:INTEGER <- 01403h;
+ - cst_gl_int:INTEGER <- 01404h;
+ - cst_gl_unsigned_int:INTEGER <- 01405h;
+ - cst_gl_float:INTEGER <- 01406h;
+ - cst_gl_2_bytes:INTEGER <- 01407h;
+ - cst_gl_3_bytes:INTEGER <- 01408h;
+ - cst_gl_4_bytes:INTEGER <- 01409h;
+ - cst_gl_double:INTEGER <- 0140Ah;
+ - cst_gl_none:INTEGER <- 0;
+ - cst_gl_front_left:INTEGER <- 00400h;
+ - cst_gl_front_right:INTEGER <- 00401h;
+ - cst_gl_back_left:INTEGER <- 00402h;
+ - cst_gl_back_right:INTEGER <- 00403h;
+ - cst_gl_front:INTEGER <- 00404h;
+ - cst_gl_back:INTEGER <- 00405h;
+ - cst_gl_left:INTEGER <- 00406h;
+ - cst_gl_right:INTEGER <- 00407h;
+ - cst_gl_front_and_back:INTEGER <- 00408h;
+ - cst_gl_aux0:INTEGER <- 00409h;
+ - cst_gl_aux1:INTEGER <- 0040Ah;
+ - cst_gl_aux2:INTEGER <- 0040Bh;
+ - cst_gl_aux3:INTEGER <- 0040Ch;
+ - cst_gl_no_error:INTEGER <- 0;
+ - cst_gl_invalid_enum:INTEGER <- 00500h;
+ - cst_gl_invalid_value:INTEGER <- 00501h;
+ - cst_gl_invalid_operation:INTEGER <- 00502h;
+ - cst_gl_stack_overflow:INTEGER <- 00503h;
+ - cst_gl_stack_underflow:INTEGER <- 00504h;
+ - cst_gl_out_of_memory:INTEGER <- 00505h;
+ - cst_gl_2d:INTEGER <- 00600h;
+ - cst_gl_3d:INTEGER <- 00601h;
+ - cst_gl_3d_color:INTEGER <- 00602h;
+ - cst_gl_3d_color_texture:INTEGER <- 00603h;
+ - cst_gl_4d_color_texture:INTEGER <- 00604h;
+ - cst_gl_pass_through_token:INTEGER <- 00700h;
+ - cst_gl_point_token:INTEGER <- 00701h;
+ - cst_gl_line_token:INTEGER <- 00702h;
+ - cst_gl_polygon_token:INTEGER <- 00703h;
+ - cst_gl_bitmap_token:INTEGER <- 00704h;
+ - cst_gl_draw_pixel_token:INTEGER <- 00705h;
+ - cst_gl_copy_pixel_token:INTEGER <- 00706h;
+ - cst_gl_line_reset_token:INTEGER <- 00707h;
+ - cst_gl_exp:INTEGER <- 00800h;
+ - cst_gl_exp2:INTEGER <- 00801h;
+ - cst_gl_cw:INTEGER <- 00900h;
+ - cst_gl_ccw:INTEGER <- 00901h;
+ - cst_gl_coeff:INTEGER <- 00A00h;
+ - cst_gl_order:INTEGER <- 00A01h;
+ - cst_gl_domain:INTEGER <- 00A02h;
+ - cst_gl_current_color:INTEGER <- 00B00h;
+ - cst_gl_current_index:INTEGER <- 00B01h;
+ - cst_gl_current_normal:INTEGER <- 00B02h;
+ - cst_gl_current_texture_coords:INTEGER <- 00B03h;
+ - cst_gl_current_raster_color:INTEGER <- 00B04h;
+ - cst_gl_current_raster_index:INTEGER <- 00B05h;
+ - cst_gl_current_raster_texture_coords:INTEGER <- 00B06h;
+ - cst_gl_current_raster_position:INTEGER <- 00B07h;
+ - cst_gl_current_raster_position_valid:INTEGER <- 00B08h;
+ - cst_gl_current_raster_distance:INTEGER <- 00B09h;
+ - cst_gl_point_smooth:INTEGER <- 00B10h;
+ - cst_gl_point_size:INTEGER <- 00B11h;
+ - cst_gl_point_size_range:INTEGER <- 00B12h;
+ - cst_gl_point_size_granularity:INTEGER <- 00B13h;
+ - cst_gl_line_smooth:INTEGER <- 00B20h;
+ - cst_gl_line_width:INTEGER <- 00B21h;
+ - cst_gl_line_width_range:INTEGER <- 00B22h;
+ - cst_gl_line_width_granularity:INTEGER <- 00B23h;
+ - cst_gl_line_stipple:INTEGER <- 00B24h;
+ - cst_gl_line_stipple_pattern:INTEGER <- 00B25h;
+ - cst_gl_line_stipple_repeat:INTEGER <- 00B26h;
+ - cst_gl_list_mode:INTEGER <- 00B30h;
+ - cst_gl_max_list_nesting:INTEGER <- 00B31h;
+ - cst_gl_list_base:INTEGER <- 00B32h;
+ - cst_gl_list_index:INTEGER <- 00B33h;
+ - cst_gl_polygon_mode:INTEGER <- 00B40h;
+ - cst_gl_polygon_smooth:INTEGER <- 00B41h;
+ - cst_gl_polygon_stipple:INTEGER <- 00B42h;
+ - cst_gl_edge_flag:INTEGER <- 00B43h;
+ - cst_gl_cull_face:INTEGER <- 00B44h;
+ - cst_gl_cull_face_mode:INTEGER <- 00B45h;
+ - cst_gl_front_face:INTEGER <- 00B46h;
+ - cst_gl_lighting:INTEGER <- 00B50h;
+ - cst_gl_light_model_local_viewer:INTEGER <- 00B51h;
+ - cst_gl_light_model_two_side:INTEGER <- 00B52h;
+ - cst_gl_light_model_ambient:INTEGER <- 00B53h;
+ - cst_gl_shade_model:INTEGER <- 00B54h;
+ - cst_gl_color_material_face:INTEGER <- 00B55h;
+ - cst_gl_color_material_parameter:INTEGER <- 00B56h;
+ - cst_gl_color_material:INTEGER <- 00B57h;
+ - cst_gl_fog:INTEGER <- 00B60h;
+ - cst_gl_fog_index:INTEGER <- 00B61h;
+ - cst_gl_fog_density:INTEGER <- 00B62h;
+ - cst_gl_fog_start:INTEGER <- 00B63h;
+ - cst_gl_fog_end:INTEGER <- 00B64h;
+ - cst_gl_fog_mode:INTEGER <- 00B65h;
+ - cst_gl_fog_color:INTEGER <- 00B66h;
+ - cst_gl_depth_range:INTEGER <- 00B70h;
+ - cst_gl_depth_test:INTEGER <- 00B71h;
+ - cst_gl_depth_writemask:INTEGER <- 00B72h;
+ - cst_gl_depth_clear_value:INTEGER <- 00B73h;
+ - cst_gl_depth_func:INTEGER <- 00B74h;
+ - cst_gl_accum_clear_value:INTEGER <- 00B80h;
+ - cst_gl_stencil_test:INTEGER <- 00B90h;
+ - cst_gl_stencil_clear_value:INTEGER <- 00B91h;
+ - cst_gl_stencil_func:INTEGER <- 00B92h;
+ - cst_gl_stencil_value_mask:INTEGER <- 00B93h;
+ - cst_gl_stencil_fail:INTEGER <- 00B94h;
+ - cst_gl_stencil_pass_depth_fail:INTEGER <- 00B95h;
+ - cst_gl_stencil_pass_depth_pass:INTEGER <- 00B96h;
+ - cst_gl_stencil_ref:INTEGER <- 00B97h;
+ - cst_gl_stencil_writemask:INTEGER <- 00B98h;
+ - cst_gl_matrix_mode:INTEGER <- 00BA0h;
+ - cst_gl_normalize:INTEGER <- 00BA1h;
+ - cst_gl_viewport:INTEGER <- 00BA2h;
+ - cst_gl_modelview_stack_depth:INTEGER <- 00BA3h;
+ - cst_gl_projection_stack_depth:INTEGER <- 00BA4h;
+ - cst_gl_texture_stack_depth:INTEGER <- 00BA5h;
+ - cst_gl_modelview_matrix:INTEGER <- 00BA6h;
+ - cst_gl_projection_matrix:INTEGER <- 00BA7h;
+ - cst_gl_texture_matrix:INTEGER <- 00BA8h;
+ - cst_gl_attrib_stack_depth:INTEGER <- 00BB0h;
+ - cst_gl_client_attrib_stack_depth:INTEGER <- 00BB1h;
+ - cst_gl_alpha_test:INTEGER <- 00BC0h;
+ - cst_gl_alpha_test_func:INTEGER <- 00BC1h;
+ - cst_gl_alpha_test_ref:INTEGER <- 00BC2h;
+ - cst_gl_dither:INTEGER <- 00BD0h;
+ - cst_gl_blend_dst:INTEGER <- 00BE0h;
+ - cst_gl_blend_src:INTEGER <- 00BE1h;
+ - cst_gl_blend:INTEGER <- 00BE2h;
+ - cst_gl_logic_op_mode:INTEGER <- 00BF0h;
+ - cst_gl_index_logic_op:INTEGER <- 00BF1h;
+ - cst_gl_color_logic_op:INTEGER <- 00BF2h;
+ - cst_gl_aux_buffers:INTEGER <- 00C00h;
+ - cst_gl_draw_buffer:INTEGER <- 00C01h;
+ - cst_gl_read_buffer:INTEGER <- 00C02h;
+ - cst_gl_scissor_box:INTEGER <- 00C10h;
+ - cst_gl_scissor_test:INTEGER <- 00C11h;
+ - cst_gl_index_clear_value:INTEGER <- 00C20h;
+ - cst_gl_index_writemask:INTEGER <- 00C21h;
+ - cst_gl_color_clear_value:INTEGER <- 00C22h;
+ - cst_gl_color_writemask:INTEGER <- 00C23h;
+ - cst_gl_index_mode:INTEGER <- 00C30h;
+ - cst_gl_rgba_mode:INTEGER <- 00C31h;
+ - cst_gl_doublebuffer:INTEGER <- 00C32h;
+ - cst_gl_stereo:INTEGER <- 00C33h;
+ - cst_gl_render_mode:INTEGER <- 00C40h;
+ - cst_gl_perspective_correction_hint:INTEGER <- 00C50h;
+ - cst_gl_point_smooth_hint:INTEGER <- 00C51h;
+ - cst_gl_line_smooth_hint:INTEGER <- 00C52h;
+ - cst_gl_polygon_smooth_hint:INTEGER <- 00C53h;
+ - cst_gl_fog_hint:INTEGER <- 00C54h;
+ - cst_gl_texture_gen_s:INTEGER <- 00C60h;
+ - cst_gl_texture_gen_t:INTEGER <- 00C61h;
+ - cst_gl_texture_gen_r:INTEGER <- 00C62h;
+ - cst_gl_texture_gen_q:INTEGER <- 00C63h;
+ - cst_gl_pixel_map_i_to_i:INTEGER <- 00C70h;
+ - cst_gl_pixel_map_s_to_s:INTEGER <- 00C71h;
+ - cst_gl_pixel_map_i_to_r:INTEGER <- 00C72h;
+ - cst_gl_pixel_map_i_to_g:INTEGER <- 00C73h;
+ - cst_gl_pixel_map_i_to_b:INTEGER <- 00C74h;
+ - cst_gl_pixel_map_i_to_a:INTEGER <- 00C75h;
+ - cst_gl_pixel_map_r_to_r:INTEGER <- 00C76h;
+ - cst_gl_pixel_map_g_to_g:INTEGER <- 00C77h;
+ - cst_gl_pixel_map_b_to_b:INTEGER <- 00C78h;
+ - cst_gl_pixel_map_a_to_a:INTEGER <- 00C79h;
+ - cst_gl_pixel_map_i_to_i_size:INTEGER <- 00CB0h;
+ - cst_gl_pixel_map_s_to_s_size:INTEGER <- 00CB1h;
+ - cst_gl_pixel_map_i_to_r_size:INTEGER <- 00CB2h;
+ - cst_gl_pixel_map_i_to_g_size:INTEGER <- 00CB3h;
+ - cst_gl_pixel_map_i_to_b_size:INTEGER <- 00CB4h;
+ - cst_gl_pixel_map_i_to_a_size:INTEGER <- 00CB5h;
+ - cst_gl_pixel_map_r_to_r_size:INTEGER <- 00CB6h;
+ - cst_gl_pixel_map_g_to_g_size:INTEGER <- 00CB7h;
+ - cst_gl_pixel_map_b_to_b_size:INTEGER <- 00CB8h;
+ - cst_gl_pixel_map_a_to_a_size:INTEGER <- 00CB9h;
+ - cst_gl_unpack_swap_bytes:INTEGER <- 00CF0h;
+ - cst_gl_unpack_lsb_first:INTEGER <- 00CF1h;
+ - cst_gl_unpack_row_length:INTEGER <- 00CF2h;
+ - cst_gl_unpack_skip_rows:INTEGER <- 00CF3h;
+ - cst_gl_unpack_skip_pixels:INTEGER <- 00CF4h;
+ - cst_gl_unpack_alignment:INTEGER <- 00CF5h;
+ - cst_gl_pack_swap_bytes:INTEGER <- 00D00h;
+ - cst_gl_pack_lsb_first:INTEGER <- 00D01h;
+ - cst_gl_pack_row_length:INTEGER <- 00D02h;
+ - cst_gl_pack_skip_rows:INTEGER <- 00D03h;
+ - cst_gl_pack_skip_pixels:INTEGER <- 00D04h;
+ - cst_gl_pack_alignment:INTEGER <- 00D05h;
+ - cst_gl_map_color:INTEGER <- 00D10h;
+ - cst_gl_map_stencil:INTEGER <- 00D11h;
+ - cst_gl_index_shift:INTEGER <- 00D12h;
+ - cst_gl_index_offset:INTEGER <- 00D13h;
+ - cst_gl_red_scale:INTEGER <- 00D14h;
+ - cst_gl_red_bias:INTEGER <- 00D15h;
+ - cst_gl_zoom_x:INTEGER <- 00D16h;
+ - cst_gl_zoom_y:INTEGER <- 00D17h;
+ - cst_gl_green_scale:INTEGER <- 00D18h;
+ - cst_gl_green_bias:INTEGER <- 00D19h;
+ - cst_gl_blue_scale:INTEGER <- 00D1Ah;
+ - cst_gl_blue_bias:INTEGER <- 00D1Bh;
+ - cst_gl_alpha_scale:INTEGER <- 00D1Ch;
+ - cst_gl_alpha_bias:INTEGER <- 00D1Dh;
+ - cst_gl_depth_scale:INTEGER <- 00D1Eh;
+ - cst_gl_depth_bias:INTEGER <- 00D1Fh;
+ - cst_gl_max_eval_order:INTEGER <- 00D30h;
+ - cst_gl_max_lights:INTEGER <- 00D31h;
+ - cst_gl_max_clip_planes:INTEGER <- 00D32h;
+ - cst_gl_max_texture_size:INTEGER <- 00D33h;
+ - cst_gl_max_pixel_map_table:INTEGER <- 00D34h;
+ - cst_gl_max_attrib_stack_depth:INTEGER <- 00D35h;
+ - cst_gl_max_modelview_stack_depth:INTEGER <- 00D36h;
+ - cst_gl_max_name_stack_depth:INTEGER <- 00D37h;
+ - cst_gl_max_projection_stack_depth:INTEGER <- 00D38h;
+ - cst_gl_max_texture_stack_depth:INTEGER <- 00D39h;
+ - cst_gl_max_viewport_dims:INTEGER <- 00D3Ah;
+ - cst_gl_max_client_attrib_stack_depth:INTEGER <- 00D3Bh;
+ - cst_gl_subpixel_bits:INTEGER <- 00D50h;
+ - cst_gl_index_bits:INTEGER <- 00D51h;
+ - cst_gl_red_bits:INTEGER <- 00D52h;
+ - cst_gl_green_bits:INTEGER <- 00D53h;
+ - cst_gl_blue_bits:INTEGER <- 00D54h;
+ - cst_gl_alpha_bits:INTEGER <- 00D55h;
+ - cst_gl_depth_bits:INTEGER <- 00D56h;
+ - cst_gl_stencil_bits:INTEGER <- 00D57h;
+ - cst_gl_accum_red_bits:INTEGER <- 00D58h;
+ - cst_gl_accum_green_bits:INTEGER <- 00D59h;
+ - cst_gl_accum_blue_bits:INTEGER <- 00D5Ah;
+ - cst_gl_accum_alpha_bits:INTEGER <- 00D5Bh;
+ - cst_gl_name_stack_depth:INTEGER <- 00D70h;
+ - cst_gl_auto_normal:INTEGER <- 00D80h;
+ - cst_gl_map1_color_4:INTEGER <- 00D90h;
+ - cst_gl_map1_index:INTEGER <- 00D91h;
+ - cst_gl_map1_normal:INTEGER <- 00D92h;
+ - cst_gl_map1_texture_coord_1:INTEGER <- 00D93h;
+ - cst_gl_map1_texture_coord_2:INTEGER <- 00D94h;
+ - cst_gl_map1_texture_coord_3:INTEGER <- 00D95h;
+ - cst_gl_map1_texture_coord_4:INTEGER <- 00D96h;
+ - cst_gl_map1_vertex_3:INTEGER <- 00D97h;
+ - cst_gl_map1_vertex_4:INTEGER <- 00D98h;
+ - cst_gl_map2_color_4:INTEGER <- 00DB0h;
+ - cst_gl_map2_index:INTEGER <- 00DB1h;
+ - cst_gl_map2_normal:INTEGER <- 00DB2h;
+ - cst_gl_map2_texture_coord_1:INTEGER <- 00DB3h;
+ - cst_gl_map2_texture_coord_2:INTEGER <- 00DB4h;
+ - cst_gl_map2_texture_coord_3:INTEGER <- 00DB5h;
+ - cst_gl_map2_texture_coord_4:INTEGER <- 00DB6h;
+ - cst_gl_map2_vertex_3:INTEGER <- 00DB7h;
+ - cst_gl_map2_vertex_4:INTEGER <- 00DB8h;
+ - cst_gl_map1_grid_domain:INTEGER <- 00DD0h;
+ - cst_gl_map1_grid_segments:INTEGER <- 00DD1h;
+ - cst_gl_map2_grid_domain:INTEGER <- 00DD2h;
+ - cst_gl_map2_grid_segments:INTEGER <- 00DD3h;
+ - cst_gl_texture_1d:INTEGER <- 00DE0h;
+ - cst_gl_texture_2d:INTEGER <- 00DE1h;
+ - cst_gl_feedback_buffer_pointer:INTEGER <- 00DF0h;
+ - cst_gl_feedback_buffer_size:INTEGER <- 00DF1h;
+ - cst_gl_feedback_buffer_type:INTEGER <- 00DF2h;
+ - cst_gl_selection_buffer_pointer:INTEGER <- 00DF3h;
+ - cst_gl_selection_buffer_size:INTEGER <- 00DF4h;
+ - cst_gl_texture_width:INTEGER <- 01000h;
+ - cst_gl_texture_height:INTEGER <- 01001h;
+ - cst_gl_texture_internal_format:INTEGER <- 01003h;
+ - cst_gl_texture_border_color:INTEGER <- 01004h;
+ - cst_gl_texture_border:INTEGER <- 01005h;
+ - cst_gl_dont_care:INTEGER <- 01100h;
+ - cst_gl_fastest:INTEGER <- 01101h;
+ - cst_gl_nicest:INTEGER <- 01102h;
+ - cst_gl_light0:INTEGER <- 04000h;
+ - cst_gl_light1:INTEGER <- 04001h;
+ - cst_gl_light2:INTEGER <- 04002h;
+ - cst_gl_light3:INTEGER <- 04003h;
+ - cst_gl_light4:INTEGER <- 04004h;
+ - cst_gl_light5:INTEGER <- 04005h;
+ - cst_gl_light6:INTEGER <- 04006h;
+ - cst_gl_light7:INTEGER <- 04007h;
+ - cst_gl_ambient:INTEGER <- 01200h;
+ - cst_gl_diffuse:INTEGER <- 01201h;
+ - cst_gl_specular:INTEGER <- 01202h;
+ - cst_gl_position:INTEGER <- 01203h;
+ - cst_gl_spot_direction:INTEGER <- 01204h;
+ - cst_gl_spot_exponent:INTEGER <- 01205h;
+ - cst_gl_spot_cutoff:INTEGER <- 01206h;
+ - cst_gl_constant_attenuation:INTEGER <- 01207h;
+ - cst_gl_linear_attenuation:INTEGER <- 01208h;
+ - cst_gl_quadratic_attenuation:INTEGER <- 01209h;
+ - cst_gl_compile:INTEGER <- 01300h;
+ - cst_gl_compile_and_execute:INTEGER <- 01301h;
+ - cst_gl_clear:INTEGER <- 01500h;
+ - cst_gl_and:INTEGER <- 01501h;
+ - cst_gl_and_reverse:INTEGER <- 01502h;
+ - cst_gl_copy:INTEGER <- 01503h;
+ - cst_gl_and_inverted:INTEGER <- 01504h;
+ - cst_gl_noop:INTEGER <- 01505h;
+ - cst_gl_xor:INTEGER <- 01506h;
+ - cst_gl_or:INTEGER <- 01507h;
+ - cst_gl_nor:INTEGER <- 01508h;
+ - cst_gl_equiv:INTEGER <- 01509h;
+ - cst_gl_invert:INTEGER <- 0150Ah;
+ - cst_gl_or_reverse:INTEGER <- 0150Bh;
+ - cst_gl_copy_inverted:INTEGER <- 0150Ch;
+ - cst_gl_or_inverted:INTEGER <- 0150Dh;
+ - cst_gl_nand:INTEGER <- 0150Eh;
+ - cst_gl_set:INTEGER <- 0150Fh;
+ - cst_gl_emission:INTEGER <- 01600h;
+ - cst_gl_shininess:INTEGER <- 01601h;
+ - cst_gl_ambient_and_diffuse:INTEGER <- 01602h;
+ - cst_gl_color_indexes:INTEGER <- 01603h;
+ - cst_gl_modelview:INTEGER <- 01700h;
+ - cst_gl_projection:INTEGER <- 01701h;
+ - cst_gl_texture:INTEGER <- 01702h;
+ - cst_gl_color:INTEGER <- 01800h;
+ - cst_gl_depth:INTEGER <- 01801h;
+ - cst_gl_stencil:INTEGER <- 01802h;
+ - cst_gl_color_index:INTEGER <- 01900h;
+ - cst_gl_stencil_index:INTEGER <- 01901h;
+ - cst_gl_depth_component:INTEGER <- 01902h;
+ - cst_gl_red:INTEGER <- 01903h;
+ - cst_gl_green:INTEGER <- 01904h;
+ - cst_gl_blue:INTEGER <- 01905h;
+ - cst_gl_alpha:INTEGER <- 01906h;
+ - cst_gl_rgb:INTEGER <- 01907h;
+ - cst_gl_rgba:INTEGER <- 01908h;
+ - cst_gl_luminance:INTEGER <- 01909h;
+ - cst_gl_luminance_alpha:INTEGER <- 0190Ah;
+ - cst_gl_bitmap:INTEGER <- 01A00h;
+ - cst_gl_point:INTEGER <- 01B00h;
+ - cst_gl_line:INTEGER <- 01B01h;
+ - cst_gl_fill:INTEGER <- 01B02h;
+ - cst_gl_render:INTEGER <- 01C00h;
+ - cst_gl_feedback:INTEGER <- 01C01h;
+ - cst_gl_select:INTEGER <- 01C02h;
+ - cst_gl_flat:INTEGER <- 01D00h;
+ - cst_gl_smooth:INTEGER <- 01D01h;
+ - cst_gl_keep:INTEGER <- 01E00h;
+ - cst_gl_replace:INTEGER <- 01E01h;
+ - cst_gl_incr:INTEGER <- 01E02h;
+ - cst_gl_decr:INTEGER <- 01E03h;
+ - cst_gl_vendor:INTEGER <- 01F00h;
+ - cst_gl_renderer:INTEGER <- 01F01h;
+ - cst_gl_version:INTEGER <- 01F02h;
+ - cst_gl_extensions:INTEGER <- 01F03h;
+ - cst_gl_s:INTEGER <- 02000h;
+ - cst_gl_t:INTEGER <- 02001h;
+ - cst_gl_r:INTEGER <- 02002h;
+ - cst_gl_q:INTEGER <- 02003h;
+ - cst_gl_modulate:INTEGER <- 02100h;
+ - cst_gl_decal:INTEGER <- 02101h;
+ - cst_gl_texture_env_mode:INTEGER <- 02200h;
+ - cst_gl_texture_env_color:INTEGER <- 02201h;
+ - cst_gl_texture_env:INTEGER <- 02300h;
+ - cst_gl_eye_linear:INTEGER <- 02400h;
+ - cst_gl_object_linear:INTEGER <- 02401h;
+ - cst_gl_sphere_map:INTEGER <- 02402h;
+ - cst_gl_texture_gen_mode:INTEGER <- 02500h;
+ - cst_gl_object_plane:INTEGER <- 02501h;
+ - cst_gl_eye_plane:INTEGER <- 02502h;
+ - cst_gl_nearest:INTEGER <- 02600h;
+ - cst_gl_linear:INTEGER <- 02601h;
+ - cst_gl_nearest_mipmap_nearest:INTEGER <- 02700h;
+ - cst_gl_linear_mipmap_nearest:INTEGER <- 02701h;
+ - cst_gl_nearest_mipmap_linear:INTEGER <- 02702h;
+ - cst_gl_linear_mipmap_linear:INTEGER <- 02703h;
+ - cst_gl_texture_mag_filter:INTEGER <- 02800h;
+ - cst_gl_texture_min_filter:INTEGER <- 02801h;
+ - cst_gl_texture_wrap_s:INTEGER <- 02802h;
+ - cst_gl_texture_wrap_t:INTEGER <- 02803h;
+ - cst_gl_clamp:INTEGER <- 02900h;
+ - cst_gl_repeat:INTEGER <- 02901h;
+ - cst_gl_client_pixel_store_bit:INTEGER <- 000000001h;
+ - cst_gl_client_vertex_array_bit:INTEGER <- 000000002h;
+ - cst_gl_client_all_attrib_bits:INTEGER <- 0ffffffffh;
+ - cst_gl_polygon_offset_factor:INTEGER <- 08038h;
+ - cst_gl_polygon_offset_units:INTEGER <- 02A00h;
+ - cst_gl_polygon_offset_point:INTEGER <- 02A01h;
+ - cst_gl_polygon_offset_line:INTEGER <- 02A02h;
+ - cst_gl_polygon_offset_fill:INTEGER <- 08037h;
+ - cst_gl_alpha4:INTEGER <- 0803Bh;
+ - cst_gl_alpha8:INTEGER <- 0803Ch;
+ - cst_gl_alpha12:INTEGER <- 0803Dh;
+ - cst_gl_alpha16:INTEGER <- 0803Eh;
+ - cst_gl_luminance4:INTEGER <- 0803Fh;
+ - cst_gl_luminance8:INTEGER <- 08040h;
+ - cst_gl_luminance12:INTEGER <- 08041h;
+ - cst_gl_luminance16:INTEGER <- 08042h;
+ - cst_gl_luminance4_alpha4:INTEGER <- 08043h;
+ - cst_gl_luminance6_alpha2:INTEGER <- 08044h;
+ - cst_gl_luminance8_alpha8:INTEGER <- 08045h;
+ - cst_gl_luminance12_alpha4:INTEGER <- 08046h;
+ - cst_gl_luminance12_alpha12:INTEGER <- 08047h;
+ - cst_gl_luminance16_alpha16:INTEGER <- 08048h;
+ - cst_gl_intensity:INTEGER <- 08049h;
+ - cst_gl_intensity4:INTEGER <- 0804Ah;
+ - cst_gl_intensity8:INTEGER <- 0804Bh;
+ - cst_gl_intensity12:INTEGER <- 0804Ch;
+ - cst_gl_intensity16:INTEGER <- 0804Dh;
+ - cst_gl_r3_g3_b2:INTEGER <- 02A10h;
+ - cst_gl_rgb4:INTEGER <- 0804Fh;
+ - cst_gl_rgb5:INTEGER <- 08050h;
+ - cst_gl_rgb8:INTEGER <- 08051h;
+ - cst_gl_rgb10:INTEGER <- 08052h;
+ - cst_gl_rgb12:INTEGER <- 08053h;
+ - cst_gl_rgb16:INTEGER <- 08054h;
+ - cst_gl_rgba2:INTEGER <- 08055h;
+ - cst_gl_rgba4:INTEGER <- 08056h;
+ - cst_gl_rgb5_a1:INTEGER <- 08057h;
+ - cst_gl_rgba8:INTEGER <- 08058h;
+ - cst_gl_rgb10_a2:INTEGER <- 08059h;
+ - cst_gl_rgba12:INTEGER <- 0805Ah;
+ - cst_gl_rgba16:INTEGER <- 0805Bh;
+ - cst_gl_texture_red_size:INTEGER <- 0805Ch;
+ - cst_gl_texture_green_size:INTEGER <- 0805Dh;
+ - cst_gl_texture_blue_size:INTEGER <- 0805Eh;
+ - cst_gl_texture_alpha_size:INTEGER <- 0805Fh;
+ - cst_gl_texture_luminance_size:INTEGER <- 08060h;
+ - cst_gl_texture_intensity_size:INTEGER <- 08061h;
+ - cst_gl_proxy_texture_1d:INTEGER <- 08063h;
+ - cst_gl_proxy_texture_2d:INTEGER <- 08064h;
+ - cst_gl_texture_priority:INTEGER <- 08066h;
+ - cst_gl_texture_resident:INTEGER <- 08067h;
+ - cst_gl_texture_binding_1d:INTEGER <- 08068h;
+ - cst_gl_texture_binding_2d:INTEGER <- 08069h;
+ - cst_gl_vertex_array:INTEGER <- 08074h;
+ - cst_gl_normal_array:INTEGER <- 08075h;
+ - cst_gl_color_array:INTEGER <- 08076h;
+ - cst_gl_index_array:INTEGER <- 08077h;
+ - cst_gl_texture_coord_array:INTEGER <- 08078h;
+ - cst_gl_edge_flag_array:INTEGER <- 08079h;
+ - cst_gl_vertex_array_size:INTEGER <- 0807Ah;
+ - cst_gl_vertex_array_type:INTEGER <- 0807Bh;
+ - cst_gl_vertex_array_stride:INTEGER <- 0807Ch;
+ - cst_gl_normal_array_type:INTEGER <- 0807Eh;
+ - cst_gl_normal_array_stride:INTEGER <- 0807Fh;
+ - cst_gl_color_array_size:INTEGER <- 08081h;
+ - cst_gl_color_array_type:INTEGER <- 08082h;
+ - cst_gl_color_array_stride:INTEGER <- 08083h;
+ - cst_gl_index_array_type:INTEGER <- 08085h;
+ - cst_gl_index_array_stride:INTEGER <- 08086h;
+ - cst_gl_texture_coord_array_size:INTEGER <- 08088h;
+ - cst_gl_texture_coord_array_type:INTEGER <- 08089h;
+ - cst_gl_texture_coord_array_stride:INTEGER <- 0808Ah;
+ - cst_gl_edge_flag_array_stride:INTEGER <- 0808Ch;
+ - cst_gl_vertex_array_pointer:INTEGER <- 0808Eh;
+ - cst_gl_normal_array_pointer:INTEGER <- 0808Fh;
+ - cst_gl_color_array_pointer:INTEGER <- 08090h;
+ - cst_gl_index_array_pointer:INTEGER <- 08091h;
+ - cst_gl_texture_coord_array_pointer:INTEGER <- 08092h;
+ - cst_gl_edge_flag_array_pointer:INTEGER <- 08093h;
+ - cst_gl_v2f:INTEGER <- 02A20h;
+ - cst_gl_v3f:INTEGER <- 02A21h;
+ - cst_gl_c4ub_v2f:INTEGER <- 02A22h;
+ - cst_gl_c4ub_v3f:INTEGER <- 02A23h;
+ - cst_gl_c3f_v3f:INTEGER <- 02A24h;
+ - cst_gl_n3f_v3f:INTEGER <- 02A25h;
+ - cst_gl_c4f_n3f_v3f:INTEGER <- 02A26h;
+ - cst_gl_t2f_v3f:INTEGER <- 02A27h;
+ - cst_gl_t4f_v4f:INTEGER <- 02A28h;
+ - cst_gl_t2f_c4ub_v3f:INTEGER <- 02A29h;
+ - cst_gl_t2f_c3f_v3f:INTEGER <- 02A2Ah;
+ - cst_gl_t2f_n3f_v3f:INTEGER <- 02A2Bh;
+ - cst_gl_t2f_c4f_n3f_v3f:INTEGER <- 02A2Ch;
+ - cst_gl_t4f_c4f_n3f_v4f:INTEGER <- 02A2Dh;
+ - cst_gl_ext_vertex_array:INTEGER <- 1;
+ - cst_gl_win_swap_hint:INTEGER <- 1;
+ - cst_gl_ext_bgra:INTEGER <- 1;
+ - cst_gl_ext_paletted_texture:INTEGER <- 1;
+ - cst_gl_vertex_array_ext:INTEGER <- 08074h;
+ - cst_gl_normal_array_ext:INTEGER <- 08075h;
+ - cst_gl_color_array_ext:INTEGER <- 08076h;
+ - cst_gl_index_array_ext:INTEGER <- 08077h;
+ - cst_gl_texture_coord_array_ext:INTEGER <- 08078h;
+ - cst_gl_edge_flag_array_ext:INTEGER <- 08079h;
+ - cst_gl_vertex_array_size_ext:INTEGER <- 0807Ah;
+ - cst_gl_vertex_array_type_ext:INTEGER <- 0807Bh;
+ - cst_gl_vertex_array_stride_ext:INTEGER <- 0807Ch;
+ - cst_gl_vertex_array_count_ext:INTEGER <- 0807Dh;
+ - cst_gl_normal_array_type_ext:INTEGER <- 0807Eh;
+ - cst_gl_normal_array_stride_ext:INTEGER <- 0807Fh;
+ - cst_gl_normal_array_count_ext:INTEGER <- 08080h;
+ - cst_gl_color_array_size_ext:INTEGER <- 08081h;
+ - cst_gl_color_array_type_ext:INTEGER <- 08082h;
+ - cst_gl_color_array_stride_ext:INTEGER <- 08083h;
+ - cst_gl_color_array_count_ext:INTEGER <- 08084h;
+ - cst_gl_index_array_type_ext:INTEGER <- 08085h;
+ - cst_gl_index_array_stride_ext:INTEGER <- 08086h;
+ - cst_gl_index_array_count_ext:INTEGER <- 08087h;
+ - cst_gl_texture_coord_array_size_ext:INTEGER <- 08088h;
+ - cst_gl_texture_coord_array_type_ext:INTEGER <- 08089h;
+ - cst_gl_texture_coord_array_stride_ext:INTEGER <- 0808Ah;
+ - cst_gl_texture_coord_array_count_ext:INTEGER <- 0808Bh;
+ - cst_gl_edge_flag_array_stride_ext:INTEGER <- 0808Ch;
+ - cst_gl_edge_flag_array_count_ext:INTEGER <- 0808Dh;
+ - cst_gl_vertex_array_pointer_ext:INTEGER <- 0808Eh;
+ - cst_gl_normal_array_pointer_ext:INTEGER <- 0808Fh;
+ - cst_gl_color_array_pointer_ext:INTEGER <- 08090h;
+ - cst_gl_index_array_pointer_ext:INTEGER <- 08091h;
+ - cst_gl_texture_coord_array_pointer_ext:INTEGER <- 08092h;
+ - cst_gl_edge_flag_array_pointer_ext:INTEGER <- 08093h;
+ - cst_gl_bgr_ext:INTEGER <- 080E0h;
+ - cst_gl_bgra_ext:INTEGER <- 080E1h;
+ - cst_gl_color_table_format_ext:INTEGER <- 080D8h;
+ - cst_gl_color_table_width_ext:INTEGER <- 080D9h;
+ - cst_gl_color_table_red_size_ext:INTEGER <- 080DAh;
+ - cst_gl_color_table_green_size_ext:INTEGER <- 080DBh;
+ - cst_gl_color_table_blue_size_ext:INTEGER <- 080DCh;
+ - cst_gl_color_table_alpha_size_ext:INTEGER <- 080DDh;
+ - cst_gl_color_table_luminance_size_ext:INTEGER <- 080DEh;
+ - cst_gl_color_table_intensity_size_ext:INTEGER <- 080DFh;
+ - cst_gl_color_index1_ext:INTEGER <- 080E2h;
+ - cst_gl_color_index2_ext:INTEGER <- 080E3h;
+ - cst_gl_color_index4_ext:INTEGER <- 080E4h;
+ - cst_gl_color_index8_ext:INTEGER <- 080E5h;
+ - cst_gl_color_index12_ext:INTEGER <- 080E6h;
+ - cst_gl_color_index16_ext:INTEGER <- 080E7h;
+//
+// OpenGL functions.
+//
+
+ - gl_accum (op:UINTEGER_32, value:REAL_32) <- `glAccum(@op, at value)`;
+ - gl_alpha_func (func:UINTEGER_32, ref:REAL_32) <- `glAlphaFunc(@func, at ref)`;
+ - gl_are_textures_resident (n:INTEGER, textures:POINTER, residences:POINTER) :UINTEGER_8 <- `glAreTexturesResident(@n, at textures, at residences)`:UINTEGER_8;
+ - gl_array_element (i:INTEGER) <- `glArrayElement(@i)`;
+ - gl_begin (mode:UINTEGER_32) <- `glBegin(@mode)`;
+ - gl_bind_texture (target:UINTEGER_32, texture:UINTEGER_32) <- `glBindTexture(@target, at texture)`;
+ - gl_bitmap (width:INTEGER, height:INTEGER, xorig:REAL_32, yorig:REAL_32, xmove:REAL_32, ymove:REAL_32, bitmap:POINTER)
+ <- `glBitmap(@width, at height, at xorig, at yorig, at xmove, at ymove, at bitmap)`;
+ - gl_blend_func (sfactor:UINTEGER_32, dfactor:UINTEGER_32) <- `glBlendFunc(@sfactor, at dfactor)`;
+ - gl_call_list (list:UINTEGER_32) <- `glCallList(@list)`;
+ - gl_call_lists (n:INTEGER, type:UINTEGER_32, lists:POINTER) <- `glCallLists(@n, at type, at lists)`;
+ - gl_clear (mask:UINTEGER_32) <- `glClear(@mask)`;
+ - gl_clear_accum (red:REAL_32, green:REAL_32, blue:REAL_32, alpha:REAL_32) <- `glClearAccum(@red, at green, at blue, at alpha)`;
+ - gl_clear_color (red:REAL_32, green:REAL_32, blue:REAL_32, alpha:REAL_32) <- `glClearColor(@red, at green, at blue, at alpha)`;
+ - gl_clear_depth (depth:REAL_32) <- `glClearDepth(@depth)`;
+ - gl_clear_index (c:REAL_32) <- `glClearIndex(@c)`;
+ - gl_clear_stencil (s:INTEGER) <- `glClearStencil(@s)`;
+ - gl_clip_plane (plane:UINTEGER_32, equation:POINTER) <- `glClipPlane(@plane, at equation)`;
+ - gl_color3b (red:INTEGER_8, green:INTEGER_8, blue:INTEGER_8) <- `glColor3b(@red, at green, at blue)`;
+ - gl_color3bv (v:POINTER) <- `glColor3bv(@v)`;
+ - gl_color3d (red:REAL_32, green:REAL_32, blue:REAL_32) <- `glColor3d(@red, at green, at blue)`;
+ - gl_color3dv (v:POINTER) <- `glColor3dv(@v)`;
+ - gl_color3f (red:REAL_32, green:REAL_32, blue:REAL_32) <- `glColor3f(@red, at green, at blue)`;
+ - gl_color3fv (v:POINTER) <- `glColor3fv(@v)`;
+ - gl_color3i (red:INTEGER, green:INTEGER, blue:INTEGER) <- `glColor3i(@red, at green, at blue)`;
+ - gl_color3iv (v:POINTER) <- `glColor3iv(@v)`;
+ - gl_color3s (red:INTEGER_16, green:INTEGER_16, blue:INTEGER_16) <- `glColor3s(@red, at green, at blue)`;
+ - gl_color3sv (v:POINTER) <- `glColor3sv(@v)`;
+ - gl_color3ub (red:UINTEGER_8, green:UINTEGER_8, blue:UINTEGER_8) <- `glColor3ub(@red, at green, at blue)`;
+ - gl_color3ubv (v:POINTER) <- `glColor3ubv(@v)`;
+ - gl_color3ui (red:UINTEGER_32, green:UINTEGER_32, blue:UINTEGER_32) <- `glColor3ui(@red, at green, at blue)`;
+ - gl_color3uiv (v:POINTER) <- `glColor3uiv(@v)`;
+ - gl_color3us (red:UINTEGER_16, green:UINTEGER_16, blue:UINTEGER_16) <- `glColor3us(@red, at green, at blue)`;
+ - gl_color3usv (v:POINTER) <- `glColor3usv(@v)`;
+ - gl_color4b (red:INTEGER_8, green:INTEGER_8, blue:INTEGER_8, alpha:INTEGER_8) <- `glColor4b(@red, at green, at blue, at alpha)`;
+ - gl_color4bv (v:POINTER) <- `glColor4bv(@v)`;
+ - gl_color4d (red:REAL_32, green:REAL_32, blue:REAL_32, alpha:REAL_32) <- `glColor4d(@red, at green, at blue, at alpha)`;
+ - gl_color4dv (v:POINTER) <- `glColor4dv(@v)`;
+ - gl_color4f (red:REAL_32, green:REAL_32, blue:REAL_32, alpha:REAL_32) <- `glColor4f(@red, at green, at blue, at alpha)`;
+ - gl_color4fv (v:POINTER) <- `glColor4fv(@v)`;
+ - gl_color4i (red:INTEGER, green:INTEGER, blue:INTEGER, alpha:INTEGER) <- `glColor4i(@red, at green, at blue, at alpha)`;
+ - gl_color4iv (v:POINTER) <- `glColor4iv(@v)`;
+ - gl_color4s (red:INTEGER_16, green:INTEGER_16, blue:INTEGER_16, alpha:INTEGER_16) <- `glColor4s(@red, at green, at blue, at alpha)`;
+ - gl_color4sv (v:POINTER) <- `glColor4sv(@v)`;
+ - gl_color4ub (red:UINTEGER_8, green:UINTEGER_8, blue:UINTEGER_8, alpha:UINTEGER_8) <- `glColor4ub(@red, at green, at blue, at alpha)`;
+ - gl_color4ubv (v:POINTER) <- `glColor4ubv(@v)`;
+ - gl_color4ui (red:UINTEGER_32, green:UINTEGER_32, blue:UINTEGER_32, alpha:UINTEGER_32) <- `glColor4ui(@red, at green, at blue, at alpha)`;
+ - gl_color4uiv (v:POINTER) <- `glColor4uiv(@v)`;
+ - gl_color4us (red:UINTEGER_16, green:UINTEGER_16, blue:UINTEGER_16, alpha:UINTEGER_16) <- `glColor4us(@red, at green, at blue, at alpha)`;
+ - gl_color4usv (v:POINTER) <- `glColor4usv(@v)`;
+ - gl_color_mask (red:UINTEGER_8, green:UINTEGER_8, blue:UINTEGER_8, alpha:UINTEGER_8) <- `glColorMask(@red, at green, at blue, at alpha)`;
+ - gl_color_material (face:UINTEGER_32, mode:UINTEGER_32) <- `glColorMaterial(@face, at mode)`;
+ - gl_color_pointer (size:INTEGER, type:UINTEGER_32, stride:INTEGER, pointer:POINTER) <- `glColorPointer(@size, at type, at stride, at pointer)`;
+ - gl_copy_pixels (x:INTEGER, y:INTEGER, width:INTEGER, height:INTEGER, type:UINTEGER_32) <- `glCopyPixels(@x, at y, at width, at height, at type)`;
+ - gl_copy_tex_image1_d (target:UINTEGER_32, level:INTEGER, internal_format:UINTEGER_32, x:INTEGER, y:INTEGER, width:INTEGER, border:INTEGER)
+ <- `glCopyTexImage1D(@target, at level, at internal_format, at x, at y, at width, at border)`;
+ - gl_copy_tex_image2_d (target:UINTEGER_32, level:INTEGER, internal_format:UINTEGER_32, x:INTEGER, y:INTEGER, width:INTEGER, height:INTEGER, border:INTEGER)
+ <- `glCopyTexImage2D(@target, at level, at internal_format, at x, at y, at width, at height, at border)`;
+ - gl_copy_tex_sub_image1_d (target:UINTEGER_32, level:INTEGER, xoffset:INTEGER, x:INTEGER, y:INTEGER, width:INTEGER) <- `glCopyTexSubImage1D(@target, at level, at xoffset, at x, at y, at width)`;
+ - gl_copy_tex_sub_image2_d (target:UINTEGER_32, level:INTEGER, xoffset:INTEGER, yoffset:INTEGER, x:INTEGER, y:INTEGER, width:INTEGER, height:INTEGER)
+ <- `glCopyTexSubImage2D(@target, at level, at xoffset, at yoffset, at x, at y, at width, at height)`;
+ - gl_cull_face (mode:UINTEGER_32) <- `glCullFace(@mode)`;
+ - gl_delete_lists (list:UINTEGER_32, range:INTEGER) <- `glDeleteLists(@list, at range)`;
+ - gl_delete_textures (n:INTEGER, textures:POINTER) <- `glDeleteTextures(@n, at textures)`;
+ - gl_depth_func (func:UINTEGER_32) <- `glDepthFunc(@func)`;
+ - gl_depth_mask (flag:UINTEGER_8) <- `glDepthMask(@flag)`;
+ - gl_depth_range (z_near:REAL_32, z_far:REAL_32) <- `glDepthRange(@z_near, at z_far)`;
+ - gl_disable (cap:UINTEGER_32) <- `glDisable(@cap)`;
+ - gl_disable_client_state (array:UINTEGER_32) <- `glDisableClientState(@array)`;
+ - gl_draw_arrays (mode:UINTEGER_32, first:INTEGER, count:INTEGER) <- `glDrawArrays(@mode, at first, at count)`;
+ - gl_draw_buffer (mode:UINTEGER_32) <- `glDrawBuffer(@mode)`;
+ - gl_draw_elements (mode:UINTEGER_32, count:INTEGER, type:UINTEGER_32, indices:POINTER) <- `glDrawElements(@mode, at count, at type, at indices)`;
+ - gl_draw_pixels (width:INTEGER, height:INTEGER, format:UINTEGER_32, type:UINTEGER_32, pixels:POINTER) <- `glDrawPixels(@width, at height, at format, at type, at pixels)`;
+ - gl_edge_flag (flag:UINTEGER_8) <- `glEdgeFlag(@flag)`;
+ - gl_edge_flag_pointer (stride:INTEGER, pointer:POINTER) <- `glEdgeFlagPointer(@stride, at pointer)`;
+ - gl_edge_flagv (flag:POINTER) <- `glEdgeFlagv(@flag)`;
+ - gl_enable (cap:UINTEGER_32) <- `glEnable(@cap)`;
+ - gl_enable_client_state (array:UINTEGER_32) <- `glEnableClientState(@array)`;
+ - gl_end <- `glEnd()`;
+ - gl_end_list <- `glEndList()`;
+ - gl_eval_coord1d (u:REAL_32) <- `glEvalCoord1d(@u)`;
+ - gl_eval_coord1dv (u:POINTER) <- `glEvalCoord1dv(@u)`;
+ - gl_eval_coord1f (u:REAL_32) <- `glEvalCoord1f(@u)`;
+ - gl_eval_coord1fv (u:POINTER) <- `glEvalCoord1fv(@u)`;
+ - gl_eval_coord2d (u:REAL_32, v:REAL_32) <- `glEvalCoord2d(@u, at v)`;
+ - gl_eval_coord2dv (u:POINTER) <- `glEvalCoord2dv(@u)`;
+ - gl_eval_coord2f (u:REAL_32, v:REAL_32) <- `glEvalCoord2f(@u, at v)`;
+ - gl_eval_coord2fv (u:POINTER) <- `glEvalCoord2fv(@u)`;
+ - gl_eval_mesh1 (mode:UINTEGER_32, i1:INTEGER, i2:INTEGER) <- `glEvalMesh1(@mode, at i1, at i2)`;
+ - gl_eval_mesh2 (mode:UINTEGER_32, i1:INTEGER, i2:INTEGER, j1:INTEGER, j2:INTEGER) <- `glEvalMesh2(@mode, at i1, at i2, at j1, at j2)`;
+ - gl_eval_point1 (i:INTEGER) <- `glEvalPoint1(@i)`;
+ - gl_eval_point2 (i:INTEGER, j:INTEGER) <- `glEvalPoint2(@i, at j)`;
+ - gl_feedback_buffer (size:INTEGER, type:UINTEGER_32, buffer:POINTER) <- `glFeedbackBuffer(@size, at type, at buffer)`;
+ - gl_finish <- `glFinish()`;
+ - gl_flush <- `glFlush()`;
+ - gl_fogf (pname:UINTEGER_32, param:REAL_32) <- `glFogf(@pname, at param)`;
+ - gl_fogfv (pname:UINTEGER_32, params:POINTER) <- `glFogfv(@pname, at params)`;
+ - gl_fogi (pname:UINTEGER_32, param:INTEGER) <- `glFogi(@pname, at param)`;
+ - gl_fogiv (pname:UINTEGER_32, params:POINTER) <- `glFogiv(@pname, at params)`;
+ - gl_front_face (mode:UINTEGER_32) <- `glFrontFace(@mode)`;
+ - gl_frustum (left:REAL_32, right:REAL_32, bottom:REAL_32, top:REAL_32, z_near:REAL_32, z_far:REAL_32) <- `glFrustum(@left, at right, at bottom, at top, at z_near, at z_far)`;
+ - gl_gen_lists (range:INTEGER) :UINTEGER_32 <- `glGenLists(@range)`:UINTEGER_32;
+ - gl_gen_textures (n:INTEGER, textures:POINTER) <- `glGenTextures(@n, at textures)`;
+ - gl_get_booleanv (pname:UINTEGER_32, params:POINTER) <- `glGetBooleanv(@pname, at params)`;
+ - gl_get_clip_plane (plane:UINTEGER_32, equation:POINTER) <- `glGetClipPlane(@plane, at equation)`;
+ - gl_get_doublev (pname:UINTEGER_32, params:POINTER) <- `glGetDoublev(@pname, at params)`;
+ - gl_get_error :UINTEGER_32 <- `glGetError()`:UINTEGER_32;
+ - gl_get_floatv (pname:UINTEGER_32, params:POINTER) <- `glGetFloatv(@pname, at params)`;
+ - gl_get_integerv (pname:UINTEGER_32, params:POINTER) <- `glGetIntegerv(@pname, at params)`;
+ - gl_get_lightfv (light:UINTEGER_32, pname:UINTEGER_32, params:POINTER) <- `glGetLightfv(@light, at pname, at params)`;
+ - gl_get_lightiv (light:UINTEGER_32, pname:UINTEGER_32, params:POINTER) <- `glGetLightiv(@light, at pname, at params)`;
+ - gl_get_mapdv (target:UINTEGER_32, query:UINTEGER_32, v:POINTER) <- `glGetMapdv(@target, at query, at v)`;
+ - gl_get_mapfv (target:UINTEGER_32, query:UINTEGER_32, v:POINTER) <- `glGetMapfv(@target, at query, at v)`;
+ - gl_get_mapiv (target:UINTEGER_32, query:UINTEGER_32, v:POINTER) <- `glGetMapiv(@target, at query, at v)`;
+ - gl_get_materialfv (face:UINTEGER_32, pname:UINTEGER_32, params:POINTER) <- `glGetMaterialfv(@face, at pname, at params)`;
+ - gl_get_materialiv (face:UINTEGER_32, pname:UINTEGER_32, params:POINTER) <- `glGetMaterialiv(@face, at pname, at params)`;
+ - gl_get_pixel_mapfv (map:UINTEGER_32, values:POINTER) <- `glGetPixelMapfv(@map, at values)`;
+ - gl_get_pixel_mapuiv (map:UINTEGER_32, values:POINTER) <- `glGetPixelMapuiv(@map, at values)`;
+ - gl_get_pixel_mapusv (map:UINTEGER_32, values:POINTER) <- `glGetPixelMapusv(@map, at values)`;
+ - gl_get_pointerv (pname:UINTEGER_32, params:POINTER) <- `glGetPointerv(@pname, at params)`;
+ - gl_get_polygon_stipple (mask:POINTER) <- `glGetPolygonStipple(@mask)`;
+ - gl_get_string (name:UINTEGER_32) :POINTER <- `glGetString(@name)`:POINTER;
+ - gl_get_tex_envfv (target:UINTEGER_32, pname:UINTEGER_32, params:POINTER) <- `glGetTexEnvfv(@target, at pname, at params)`;
+ - gl_get_tex_enviv (target:UINTEGER_32, pname:UINTEGER_32, params:POINTER) <- `glGetTexEnviv(@target, at pname, at params)`;
+ - gl_get_tex_gendv (coord:UINTEGER_32, pname:UINTEGER_32, params:POINTER) <- `glGetTexGendv(@coord, at pname, at params)`;
+ - gl_get_tex_genfv (coord:UINTEGER_32, pname:UINTEGER_32, params:POINTER) <- `glGetTexGenfv(@coord, at pname, at params)`;
+ - gl_get_tex_geniv (coord:UINTEGER_32, pname:UINTEGER_32, params:POINTER) <- `glGetTexGeniv(@coord, at pname, at params)`;
+ - gl_get_tex_image (target:UINTEGER_32, level:INTEGER, format:UINTEGER_32, type:UINTEGER_32, pixels:POINTER) <- `glGetTexImage(@target, at level, at format, at type, at pixels)`;
+ - gl_get_tex_level_parameterfv (target:UINTEGER_32, level:INTEGER, pname:UINTEGER_32, params:POINTER) <- `glGetTexLevelParameterfv(@target, at level, at pname, at params)`;
+ - gl_get_tex_level_parameteriv (target:UINTEGER_32, level:INTEGER, pname:UINTEGER_32, params:POINTER) <- `glGetTexLevelParameteriv(@target, at level, at pname, at params)`;
+ - gl_get_tex_parameterfv (target:UINTEGER_32, pname:UINTEGER_32, params:POINTER) <- `glGetTexParameterfv(@target, at pname, at params)`;
+ - gl_get_tex_parameteriv (target:UINTEGER_32, pname:UINTEGER_32, params:POINTER) <- `glGetTexParameteriv(@target, at pname, at params)`;
+ - gl_hint (target:UINTEGER_32, mode:UINTEGER_32) <- `glHint(@target, at mode)`;
+ - gl_index_mask (mask:UINTEGER_32) <- `glIndexMask(@mask)`;
+ - gl_index_pointer (type:UINTEGER_32, stride:INTEGER, pointer:POINTER) <- `glIndexPointer(@type, at stride, at pointer)`;
+ - gl_indexd (c:REAL_32) <- `glIndexd(@c)`;
+ - gl_indexdv (c:POINTER) <- `glIndexdv(@c)`;
+ - gl_indexf (c:REAL_32) <- `glIndexf(@c)`;
+ - gl_indexfv (c:POINTER) <- `glIndexfv(@c)`;
+ - gl_indexi (c:INTEGER) <- `glIndexi(@c)`;
+ - gl_indexiv (c:POINTER) <- `glIndexiv(@c)`;
+ - gl_indexs (c:INTEGER_16) <- `glIndexs(@c)`;
+ - gl_indexsv (c:POINTER) <- `glIndexsv(@c)`;
+ - gl_indexub (c:UINTEGER_8) <- `glIndexub(@c)`;
+ - gl_indexubv (c:POINTER) <- `glIndexubv(@c)`;
+ - gl_init_names <- `glInitNames()`;
+ - gl_interleaved_arrays (format:UINTEGER_32, stride:INTEGER, pointer:POINTER) <- `glInterleavedArrays(@format, at stride, at pointer)`;
+ - gl_is_enabled (cap:UINTEGER_32) :UINTEGER_8 <- `glIsEnabled(@cap)`:UINTEGER_8;
+ - gl_is_list (list:UINTEGER_32) :UINTEGER_8 <- `glIsList(@list)`:UINTEGER_8;
+ - gl_is_texture (texture:UINTEGER_32) :UINTEGER_8 <- `glIsTexture(@texture)`:UINTEGER_8;
+ - gl_light_modelf (pname:UINTEGER_32, param:REAL_32) <- `glLightModelf(@pname, at param)`;
+ - gl_light_modelfv (pname:UINTEGER_32, params:POINTER) <- `glLightModelfv(@pname, at params)`;
+ - gl_light_modeli (pname:UINTEGER_32, param:INTEGER) <- `glLightModeli(@pname, at param)`;
+ - gl_light_modeliv (pname:UINTEGER_32, params:POINTER) <- `glLightModeliv(@pname, at params)`;
+ - gl_lightf (light:UINTEGER_32, pname:UINTEGER_32, param:REAL_32) <- `glLightf(@light, at pname, at param)`;
+ - gl_lightfv (light:UINTEGER_32, pname:UINTEGER_32, params:POINTER) <- `glLightfv(@light, at pname, at params)`;
+ - gl_lighti (light:UINTEGER_32, pname:UINTEGER_32, param:INTEGER) <- `glLighti(@light, at pname, at param)`;
+ - gl_lightiv (light:UINTEGER_32, pname:UINTEGER_32, params:POINTER) <- `glLightiv(@light, at pname, at params)`;
+ - gl_line_stipple (factor:INTEGER, pattern:UINTEGER_16) <- `glLineStipple(@factor, at pattern)`;
+ - gl_line_width (width:REAL_32) <- `glLineWidth(@width)`;
+ - gl_list_base (base:UINTEGER_32) <- `glListBase(@base)`;
+ - gl_load_identity <- `glLoadIdentity()`;
+ - gl_load_matrixd (m:POINTER) <- `glLoadMatrixd(@m)`;
+ - gl_load_matrixf (m:POINTER) <- `glLoadMatrixf(@m)`;
+ - gl_load_name (name:UINTEGER_32) <- `glLoadName(@name)`;
+ - gl_logic_op (opcode:UINTEGER_32) <- `glLogicOp(@opcode)`;
+ - gl_map1d (target:UINTEGER_32, u1:REAL_32, u2:REAL_32, stride:INTEGER, order:INTEGER, points:POINTER) <- `glMap1d(@target, at u1, at u2, at stride, at order, at points)`;
+ - gl_map1f (target:UINTEGER_32, u1:REAL_32, u2:REAL_32, stride:INTEGER, order:INTEGER, points:POINTER) <- `glMap1f(@target, at u1, at u2, at stride, at order, at points)`;
+ - gl_map2d (target:UINTEGER_32, u1:REAL_32, u2:REAL_32, ustride:INTEGER, uorder:INTEGER, v1:REAL_32, v2:REAL_32, vstride:INTEGER, vorder:INTEGER, points:POINTER)
+ <- `glMap2d(@target, at u1, at u2, at ustride, at uorder, at v1, at v2, at vstride, at vorder, at points)`;
+ - gl_map2f (target:UINTEGER_32, u1:REAL_32, u2:REAL_32, ustride:INTEGER, uorder:INTEGER, v1:REAL_32, v2:REAL_32, vstride:INTEGER, vorder:INTEGER, points:POINTER)
+ <- `glMap2f(@target, at u1, at u2, at ustride, at uorder, at v1, at v2, at vstride, at vorder, at points)`;
+ - gl_map_grid1d (un:INTEGER, u1:REAL_32, u2:REAL_32) <- `glMapGrid1d(@un, at u1, at u2)`;
+ - gl_map_grid1f (un:INTEGER, u1:REAL_32, u2:REAL_32) <- `glMapGrid1f(@un, at u1, at u2)`;
+ - gl_map_grid2d (un:INTEGER, u1:REAL_32, u2:REAL_32, vn:INTEGER, v1:REAL_32, v2:REAL_32) <- `glMapGrid2d(@un, at u1, at u2, at vn, at v1, at v2)`;
+ - gl_map_grid2f (un:INTEGER, u1:REAL_32, u2:REAL_32, vn:INTEGER, v1:REAL_32, v2:REAL_32) <- `glMapGrid2f(@un, at u1, at u2, at vn, at v1, at v2)`;
+ - gl_materialf (face:UINTEGER_32, pname:UINTEGER_32, param:REAL_32) <- `glMaterialf(@face, at pname, at param)`;
+ - gl_materialfv (face:UINTEGER_32, pname:UINTEGER_32, params:POINTER) <- `glMaterialfv(@face, at pname, at params)`;
+ - gl_materiali (face:UINTEGER_32, pname:UINTEGER_32, param:INTEGER) <- `glMateriali(@face, at pname, at param)`;
+ - gl_materialiv (face:UINTEGER_32, pname:UINTEGER_32, params:POINTER) <- `glMaterialiv(@face, at pname, at params)`;
+ - gl_matrix_mode (mode:UINTEGER_32) <- `glMatrixMode(@mode)`;
+ - gl_mult_matrixd (m:POINTER) <- `glMultMatrixd(@m)`;
+ - gl_mult_matrixf (m:POINTER) <- `glMultMatrixf(@m)`;
+ - gl_new_list (list:UINTEGER_32, mode:UINTEGER_32) <- `glNewList(@list, at mode)`;
+ - gl_normal3b (nx:INTEGER_8, ny:INTEGER_8, nz:INTEGER_8) <- `glNormal3b(@nx, at ny, at nz)`;
+ - gl_normal3bv (v:POINTER) <- `glNormal3bv(@v)`;
+ - gl_normal3d (nx:REAL_32, ny:REAL_32, nz:REAL_32) <- `glNormal3d(@nx, at ny, at nz)`;
+ - gl_normal3dv (v:POINTER) <- `glNormal3dv(@v)`;
+ - gl_normal3f (nx:REAL_32, ny:REAL_32, nz:REAL_32) <- `glNormal3f(@nx, at ny, at nz)`;
+ - gl_normal3fv (v:POINTER) <- `glNormal3fv(@v)`;
+ - gl_normal3i (nx:INTEGER, ny:INTEGER, nz:INTEGER) <- `glNormal3i(@nx, at ny, at nz)`;
+ - gl_normal3iv (v:POINTER) <- `glNormal3iv(@v)`;
+ - gl_normal3s (nx:INTEGER_16, ny:INTEGER_16, nz:INTEGER_16) <- `glNormal3s(@nx, at ny, at nz)`;
+ - gl_normal3sv (v:POINTER) <- `glNormal3sv(@v)`;
+ - gl_normal_pointer (type:UINTEGER_32, stride:INTEGER, pointer:POINTER) <- `glNormalPointer(@type, at stride, at pointer)`;
+ - gl_ortho (left:REAL_32, right:REAL_32, bottom:REAL_32, top:REAL_32, z_near:REAL_32, z_far:REAL_32) <- `glOrtho(@left, at right, at bottom, at top, at z_near, at z_far)`;
+ - gl_pass_through (token:REAL_32) <- `glPassThrough(@token)`;
+ - gl_pixel_mapfv (map:UINTEGER_32, mapsize:INTEGER, values:POINTER) <- `glPixelMapfv(@map, at mapsize, at values)`;
+ - gl_pixel_mapuiv (map:UINTEGER_32, mapsize:INTEGER, values:POINTER) <- `glPixelMapuiv(@map, at mapsize, at values)`;
+ - gl_pixel_mapusv (map:UINTEGER_32, mapsize:INTEGER, values:POINTER) <- `glPixelMapusv(@map, at mapsize, at values)`;
+ - gl_pixel_storef (pname:UINTEGER_32, param:REAL_32) <- `glPixelStoref(@pname, at param)`;
+ - gl_pixel_storei (pname:UINTEGER_32, param:INTEGER) <- `glPixelStorei(@pname, at param)`;
+ - gl_pixel_transferf (pname:UINTEGER_32, param:REAL_32) <- `glPixelTransferf(@pname, at param)`;
+ - gl_pixel_transferi (pname:UINTEGER_32, param:INTEGER) <- `glPixelTransferi(@pname, at param)`;
+ - gl_pixel_zoom (xfactor:REAL_32, yfactor:REAL_32) <- `glPixelZoom(@xfactor, at yfactor)`;
+ - gl_point_size (size:REAL_32) <- `glPointSize(@size)`;
+ - gl_polygon_mode (face:UINTEGER_32, mode:UINTEGER_32) <- `glPolygonMode(@face, at mode)`;
+ - gl_polygon_offset (factor:REAL_32, units:REAL_32) <- `glPolygonOffset(@factor, at units)`;
+ - gl_polygon_stipple (mask:POINTER) <- `glPolygonStipple(@mask)`;
+ - gl_pop_attrib <- `glPopAttrib()`;
+ - gl_pop_client_attrib <- `glPopClientAttrib()`;
+ - gl_pop_matrix <- `glPopMatrix()`;
+ - gl_pop_name <- `glPopName()`;
+ - gl_prioritize_textures (n:INTEGER, textures:POINTER, priorities:POINTER) <- `glPrioritizeTextures(@n, at textures, at priorities)`;
+ - gl_push_attrib (mask:UINTEGER_32) <- `glPushAttrib(@mask)`;
+ - gl_push_client_attrib (mask:UINTEGER_32) <- `glPushClientAttrib(@mask)`;
+ - gl_push_matrix <- `glPushMatrix()`;
+ - gl_push_name (name:UINTEGER_32) <- `glPushName(@name)`;
+ - gl_raster_pos2d (x:REAL_32, y:REAL_32) <- `glRasterPos2d(@x, at y)`;
+ - gl_raster_pos2dv (v:POINTER) <- `glRasterPos2dv(@v)`;
+ - gl_raster_pos2f (x:REAL_32, y:REAL_32) <- `glRasterPos2f(@x, at y)`;
+ - gl_raster_pos2fv (v:POINTER) <- `glRasterPos2fv(@v)`;
+ - gl_raster_pos2i (x:INTEGER, y:INTEGER) <- `glRasterPos2i(@x, at y)`;
+ - gl_raster_pos2iv (v:POINTER) <- `glRasterPos2iv(@v)`;
+ - gl_raster_pos2s (x:INTEGER_16, y:INTEGER_16) <- `glRasterPos2s(@x, at y)`;
+ - gl_raster_pos2sv (v:POINTER) <- `glRasterPos2sv(@v)`;
+ - gl_raster_pos3d (x:REAL_32, y:REAL_32, z:REAL_32) <- `glRasterPos3d(@x, at y, at z)`;
+ - gl_raster_pos3dv (v:POINTER) <- `glRasterPos3dv(@v)`;
+ - gl_raster_pos3f (x:REAL_32, y:REAL_32, z:REAL_32) <- `glRasterPos3f(@x, at y, at z)`;
+ - gl_raster_pos3fv (v:POINTER) <- `glRasterPos3fv(@v)`;
+ - gl_raster_pos3i (x:INTEGER, y:INTEGER, z:INTEGER) <- `glRasterPos3i(@x, at y, at z)`;
+ - gl_raster_pos3iv (v:POINTER) <- `glRasterPos3iv(@v)`;
+ - gl_raster_pos3s (x:INTEGER_16, y:INTEGER_16, z:INTEGER_16) <- `glRasterPos3s(@x, at y, at z)`;
+ - gl_raster_pos3sv (v:POINTER) <- `glRasterPos3sv(@v)`;
+ - gl_raster_pos4d (x:REAL_32, y:REAL_32, z:REAL_32, w:REAL_32) <- `glRasterPos4d(@x, at y, at z, at w)`;
+ - gl_raster_pos4dv (v:POINTER) <- `glRasterPos4dv(@v)`;
+ - gl_raster_pos4f (x:REAL_32, y:REAL_32, z:REAL_32, w:REAL_32) <- `glRasterPos4f(@x, at y, at z, at w)`;
+ - gl_raster_pos4fv (v:POINTER) <- `glRasterPos4fv(@v)`;
+ - gl_raster_pos4i (x:INTEGER, y:INTEGER, z:INTEGER, w:INTEGER) <- `glRasterPos4i(@x, at y, at z, at w)`;
+ - gl_raster_pos4iv (v:POINTER) <- `glRasterPos4iv(@v)`;
+ - gl_raster_pos4s (x:INTEGER_16, y:INTEGER_16, z:INTEGER_16, w:INTEGER_16) <- `glRasterPos4s(@x, at y, at z, at w)`;
+ - gl_raster_pos4sv (v:POINTER) <- `glRasterPos4sv(@v)`;
+ - gl_read_buffer (mode:UINTEGER_32) <- `glReadBuffer(@mode)`;
+ - gl_read_pixels (x:INTEGER, y:INTEGER, width:INTEGER, height:INTEGER, format:UINTEGER_32, type:UINTEGER_32, pixels:POINTER)
+ <- `glReadPixels(@x, at y, at width, at height, at format, at type, at pixels)`;
+ - gl_rectd (x1:REAL_32, y1:REAL_32, x2:REAL_32, y2:REAL_32) <- `glRectd(@x1, at y1, at x2, at y2)`;
+ - gl_rectdv (v1:POINTER, v2:POINTER) <- `glRectdv(@v1, at v2)`;
+ - gl_rectf (x1:REAL_32, y1:REAL_32, x2:REAL_32, y2:REAL_32) <- `glRectf(@x1, at y1, at x2, at y2)`;
+ - gl_rectfv (v1:POINTER, v2:POINTER) <- `glRectfv(@v1, at v2)`;
+ - gl_recti (x1:INTEGER, y1:INTEGER, x2:INTEGER, y2:INTEGER) <- `glRecti(@x1, at y1, at x2, at y2)`;
+ - gl_rectiv (v1:POINTER, v2:POINTER) <- `glRectiv(@v1, at v2)`;
+ - gl_rects (x1:INTEGER_16, y1:INTEGER_16, x2:INTEGER_16, y2:INTEGER_16) <- `glRects(@x1, at y1, at x2, at y2)`;
+ - gl_rectsv (v1:POINTER, v2:POINTER) <- `glRectsv(@v1, at v2)`;
+ - gl_render_mode (mode:UINTEGER_32) :INTEGER <- `glRenderMode(@mode)`:INTEGER;
+ - gl_rotated (angle:REAL_32, x:REAL_32, y:REAL_32, z:REAL_32) <- `glRotated(@angle, at x, at y, at z)`;
+ - gl_rotatef (angle:REAL_32, x:REAL_32, y:REAL_32, z:REAL_32) <- `glRotatef(@angle, at x, at y, at z)`;
+ - gl_scaled (x:REAL_32, y:REAL_32, z:REAL_32) <- `glScaled(@x, at y, at z)`;
+ - gl_scalef (x:REAL_32, y:REAL_32, z:REAL_32) <- `glScalef(@x, at y, at z)`;
+ - gl_scissor (x:INTEGER, y:INTEGER, width:INTEGER, height:INTEGER) <- `glScissor(@x, at y, at width, at height)`;
+ - gl_select_buffer (size:INTEGER, buffer:POINTER) <- `glSelectBuffer(@size, at buffer)`;
+ - gl_shade_model (mode:UINTEGER_32) <- `glShadeModel(@mode)`;
+ - gl_stencil_func (func:UINTEGER_32, ref:INTEGER, mask:UINTEGER_32) <- `glStencilFunc(@func, at ref, at mask)`;
+ - gl_stencil_mask (mask:UINTEGER_32) <- `glStencilMask(@mask)`;
+ - gl_stencil_op (fail:UINTEGER_32, zfail:UINTEGER_32, zpass:UINTEGER_32) <- `glStencilOp(@fail, at zfail, at zpass)`;
+ - gl_tex_coord1d (s:REAL_32) <- `glTexCoord1d(@s)`;
+ - gl_tex_coord1dv (v:POINTER) <- `glTexCoord1dv(@v)`;
+ - gl_tex_coord1f (s:REAL_32) <- `glTexCoord1f(@s)`;
+ - gl_tex_coord1fv (v:POINTER) <- `glTexCoord1fv(@v)`;
+ - gl_tex_coord1i (s:INTEGER) <- `glTexCoord1i(@s)`;
+ - gl_tex_coord1iv (v:POINTER) <- `glTexCoord1iv(@v)`;
+ - gl_tex_coord1s (s:INTEGER_16) <- `glTexCoord1s(@s)`;
+ - gl_tex_coord1sv (v:POINTER) <- `glTexCoord1sv(@v)`;
+ - gl_tex_coord2d (s:REAL_32, t:REAL_32) <- `glTexCoord2d(@s, at t)`;
+ - gl_tex_coord2dv (v:POINTER) <- `glTexCoord2dv(@v)`;
+ - gl_tex_coord2f (s:REAL_32, t:REAL_32) <- `glTexCoord2f(@s, at t)`;
+ - gl_tex_coord2fv (v:POINTER) <- `glTexCoord2fv(@v)`;
+ - gl_tex_coord2i (s:INTEGER, t:INTEGER) <- `glTexCoord2i(@s, at t)`;
+ - gl_tex_coord2iv (v:POINTER) <- `glTexCoord2iv(@v)`;
+ - gl_tex_coord2s (s:INTEGER_16, t:INTEGER_16) <- `glTexCoord2s(@s, at t)`;
+ - gl_tex_coord2sv (v:POINTER) <- `glTexCoord2sv(@v)`;
+ - gl_tex_coord3d (s:REAL_32, t:REAL_32, r:REAL_32) <- `glTexCoord3d(@s, at t, at r)`;
+ - gl_tex_coord3dv (v:POINTER) <- `glTexCoord3dv(@v)`;
+ - gl_tex_coord3f (s:REAL_32, t:REAL_32, r:REAL_32) <- `glTexCoord3f(@s, at t, at r)`;
+ - gl_tex_coord3fv (v:POINTER) <- `glTexCoord3fv(@v)`;
+ - gl_tex_coord3i (s:INTEGER, t:INTEGER, r:INTEGER) <- `glTexCoord3i(@s, at t, at r)`;
+ - gl_tex_coord3iv (v:POINTER) <- `glTexCoord3iv(@v)`;
+ - gl_tex_coord3s (s:INTEGER_16, t:INTEGER_16, r:INTEGER_16) <- `glTexCoord3s(@s, at t, at r)`;
+ - gl_tex_coord3sv (v:POINTER) <- `glTexCoord3sv(@v)`;
+ - gl_tex_coord4d (s:REAL_32, t:REAL_32, r:REAL_32, q:REAL_32) <- `glTexCoord4d(@s, at t, at r, at q)`;
+ - gl_tex_coord4dv (v:POINTER) <- `glTexCoord4dv(@v)`;
+ - gl_tex_coord4f (s:REAL_32, t:REAL_32, r:REAL_32, q:REAL_32) <- `glTexCoord4f(@s, at t, at r, at q)`;
+ - gl_tex_coord4fv (v:POINTER) <- `glTexCoord4fv(@v)`;
+ - gl_tex_coord4i (s:INTEGER, t:INTEGER, r:INTEGER, q:INTEGER) <- `glTexCoord4i(@s, at t, at r, at q)`;
+ - gl_tex_coord4iv (v:POINTER) <- `glTexCoord4iv(@v)`;
+ - gl_tex_coord4s (s:INTEGER_16, t:INTEGER_16, r:INTEGER_16, q:INTEGER_16) <- `glTexCoord4s(@s, at t, at r, at q)`;
+ - gl_tex_coord4sv (v:POINTER) <- `glTexCoord4sv(@v)`;
+ - gl_tex_coord_pointer (size:INTEGER, type:UINTEGER_32, stride:INTEGER, pointer:POINTER) <- `glTexCoordPointer(@size, at type, at stride, at pointer)`;
+ - gl_tex_envf (target:UINTEGER_32, pname:UINTEGER_32, param:REAL_32) <- `glTexEnvf(@target, at pname, at param)`;
+ - gl_tex_envfv (target:UINTEGER_32, pname:UINTEGER_32, params:POINTER) <- `glTexEnvfv(@target, at pname, at params)`;
+ - gl_tex_envi (target:UINTEGER_32, pname:UINTEGER_32, param:INTEGER) <- `glTexEnvi(@target, at pname, at param)`;
+ - gl_tex_enviv (target:UINTEGER_32, pname:UINTEGER_32, params:POINTER) <- `glTexEnviv(@target, at pname, at params)`;
+ - gl_tex_gend (coord:UINTEGER_32, pname:UINTEGER_32, param:REAL_32) <- `glTexGend(@coord, at pname, at param)`;
+ - gl_tex_gendv (coord:UINTEGER_32, pname:UINTEGER_32, params:POINTER) <- `glTexGendv(@coord, at pname, at params)`;
+ - gl_tex_genf (coord:UINTEGER_32, pname:UINTEGER_32, param:REAL_32) <- `glTexGenf(@coord, at pname, at param)`;
+ - gl_tex_genfv (coord:UINTEGER_32, pname:UINTEGER_32, params:POINTER) <- `glTexGenfv(@coord, at pname, at params)`;
+ - gl_tex_geni (coord:UINTEGER_32, pname:UINTEGER_32, param:INTEGER) <- `glTexGeni(@coord, at pname, at param)`;
+ - gl_tex_geniv (coord:UINTEGER_32, pname:UINTEGER_32, params:POINTER) <- `glTexGeniv(@coord, at pname, at params)`;
+ - gl_tex_image1_d (target:UINTEGER_32, level:INTEGER, internalformat:INTEGER, width:INTEGER, border:INTEGER, format:UINTEGER_32, type:UINTEGER_32, pixels:POINTER)
+ <- `glTexImage1D(@target, at level, at internalformat, at width, at border, at format, at type, at pixels)`;
+ - gl_tex_image2_d (target:UINTEGER_32, level:INTEGER, internalformat:INTEGER, width:INTEGER, height:INTEGER, border:INTEGER, format:UINTEGER_32, type:UINTEGER_32, pixels:POINTER)
+ <- `glTexImage2D(@target, at level, at internalformat, at width, at height, at border, at format, at type, at pixels)`;
+ - gl_tex_parameterf (target:UINTEGER_32, pname:UINTEGER_32, param:REAL_32) <- `glTexParameterf(@target, at pname, at param)`;
+ - gl_tex_parameterfv (target:UINTEGER_32, pname:UINTEGER_32, params:POINTER) <- `glTexParameterfv(@target, at pname, at params)`;
+ - gl_tex_parameteri (target:UINTEGER_32, pname:UINTEGER_32, param:INTEGER) <- `glTexParameteri(@target, at pname, at param)`;
+ - gl_tex_parameteriv (target:UINTEGER_32, pname:UINTEGER_32, params:POINTER) <- `glTexParameteriv(@target, at pname, at params)`;
+ - gl_tex_sub_image1_d (target:UINTEGER_32, level:INTEGER, xoffset:INTEGER, width:INTEGER, format:UINTEGER_32, type:UINTEGER_32, pixels:POINTER)
+ <- `glTexSubImage1D(@target, at level, at xoffset, at width, at format, at type, at pixels)`;
+ - gl_tex_sub_image2_d (target:UINTEGER_32, level:INTEGER, xoffset:INTEGER, yoffset:INTEGER, width:INTEGER, height:INTEGER, format:UINTEGER_32, type:UINTEGER_32, pixels:POINTER)
+ <- `glTexSubImage2D(@target, at level, at xoffset, at yoffset, at width, at height, at format, at type, at pixels)`;
+ - gl_translated (x:REAL_32, y:REAL_32, z:REAL_32) <- `glTranslated(@x, at y, at z)`;
+ - gl_translatef (x:REAL_32, y:REAL_32, z:REAL_32) <- `glTranslatef(@x, at y, at z)`;
+ - gl_vertex2d (x:REAL_32, y:REAL_32) <- `glVertex2d(@x, at y)`;
+ - gl_vertex2dv (v:POINTER) <- `glVertex2dv(@v)`;
+ - gl_vertex2f (x:REAL_32, y:REAL_32) <- `glVertex2f(@x, at y)`;
+ - gl_vertex2fv (v:POINTER) <- `glVertex2fv(@v)`;
+ - gl_vertex2i (x:INTEGER, y:INTEGER) <- `glVertex2i(@x, at y)`;
+ - gl_vertex2iv (v:POINTER) <- `glVertex2iv(@v)`;
+ - gl_vertex2s (x:INTEGER_16, y:INTEGER_16) <- `glVertex2s(@x, at y)`;
+ - gl_vertex2sv (v:POINTER) <- `glVertex2sv(@v)`;
+ - gl_vertex3d (x:REAL_32, y:REAL_32, z:REAL_32) <- `glVertex3d(@x, at y, at z)`;
+ - gl_vertex3dv (v:POINTER) <- `glVertex3dv(@v)`;
+ - gl_vertex3f (x:REAL_32, y:REAL_32, z:REAL_32) <- `glVertex3f(@x, at y, at z)`;
+ - gl_vertex3fv (v:POINTER) <- `glVertex3fv(@v)`;
+ - gl_vertex3i (x:INTEGER, y:INTEGER, z:INTEGER) <- `glVertex3i(@x, at y, at z)`;
+ - gl_vertex3iv (v:POINTER) <- `glVertex3iv(@v)`;
+ - gl_vertex3s (x:INTEGER_16, y:INTEGER_16, z:INTEGER_16) <- `glVertex3s(@x, at y, at z)`;
+ - gl_vertex3sv (v:POINTER) <- `glVertex3sv(@v)`;
+ - gl_vertex4d (x:REAL_32, y:REAL_32, z:REAL_32, w:REAL_32) <- `glVertex4d(@x, at y, at z, at w)`;
+ - gl_vertex4dv (v:POINTER) <- `glVertex4dv(@v)`;
+ - gl_vertex4f (x:REAL_32, y:REAL_32, z:REAL_32, w:REAL_32) <- `glVertex4f(@x, at y, at z, at w)`;
+ - gl_vertex4fv (v:POINTER) <- `glVertex4fv(@v)`;
+ - gl_vertex4i (x:INTEGER, y:INTEGER, z:INTEGER, w:INTEGER) <- `glVertex4i(@x, at y, at z, at w)`;
+ - gl_vertex4iv (v:POINTER) <- `glVertex4iv(@v)`;
+ - gl_vertex4s (x:INTEGER_16, y:INTEGER_16, z:INTEGER_16, w:INTEGER_16) <- `glVertex4s(@x, at y, at z, at w)`;
+ - gl_vertex4sv (v:POINTER) <- `glVertex4sv(@v)`;
+ - gl_vertex_pointer (size:INTEGER, type:UINTEGER_32, stride:INTEGER, pointer:POINTER) <- `glVertexPointer(@size, at type, at stride, at pointer)`;
+ - gl_viewport (x:INTEGER, y:INTEGER, width:INTEGER, height:INTEGER) <- `glViewport(@x, at y, at width, at height)`;
diff --git a/opengl/gl_abstract_texture.li b/opengl/gl_abstract_texture.li
new file mode 100644
index 0000000..daf8e0a
--- /dev/null
+++ b/opengl/gl_abstract_texture.li
@@ -0,0 +1,282 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := GL_ABSTRACT_TEXTURE;
+
+ - comment := "OpenGL rendered image";
+
+ - external := `unsigned int texture_id;`;
+
+Section Inherit
+
+ - parent_texture:Expanded TEXTURE;
+
+Section Public
+
+ - decal:INTEGER <- `GL_DECAL`:INTEGER;
+ - replace:INTEGER <- `GL_REPLACE`:INTEGER;
+ - modulate:INTEGER <- `GL_MODULATE`:INTEGER;
+ - blend:INTEGER <- `GL_BLEND`:INTEGER;
+
+ - clamp:INTEGER <- `GL_CLAMP`:INTEGER;
+ - repeat:INTEGER <- `GL_REPEAT`:INTEGER;
+
+ - clamp_to_edge:INTEGER <- `0x812F`:INTEGER; //GL_CLAMP_TO_EDGE`:INTEGER;
+ //-> not supported on every cards & GL implementations !!
+
+
+ + id:UINTEGER_32; // OpenGL id
+
+ - make image:IMAGE <-
+ (
+ + type,env_mode,mode:INTEGER;
+ + data:POINTER;
+
+ set_image image;
+
+ (channels = 4).if {
+ type := `GL_RGBA`:INTEGER;
+ }.elseif {channels = 3} then {
+ type := `GL_RGB`:INTEGER;
+ }.elseif {channels = 1} then {
+ type := `GL_LUMINANCE`:INTEGER;
+ };
+
+ mode := target;
+ data := image_data.to_external;
+
+ // create OpenGL texture
+ `glGenTextures(1, &texture_id)`;
+ id := `texture_id`:INTEGER;
+
+ // set pixel aligment
+ `glPixelStorei (GL_UNPACK_ALIGNMENT, 1)`;
+
+ // select new texture
+ `glBindTexture(@mode, texture_id)`;
+
+ //--- OpenGL texture parameters
+ filter
+ .when filter_mipmap then {
+
+ `glTexParameteri(@mode,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST)`;
+ `glTexParameteri(@mode,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR)`;
+ raw_create_mipmap (channels,width,height,type) data data;
+
+ }.when filter_linear then {
+ `glTexParameteri(@mode,GL_TEXTURE_MIN_FILTER,GL_LINEAR)`;
+ `glTexParameteri(@mode,GL_TEXTURE_MAG_FILTER,GL_LINEAR)`;
+
+ raw_create (channels,width,height,type) data data;
+
+ }.when filter_nearest then {
+ `glTexParameteri(@mode,GL_TEXTURE_MIN_FILTER,GL_NEAREST)`;
+ `glTexParameteri(@mode,GL_TEXTURE_MAG_FILTER,GL_NEAREST)`;
+
+ raw_create (channels,width,height,type) data data;
+ };
+ //---
+
+ // set texture function
+ env_mode := drawing_mode;
+ `glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, @env_mode)`;
+
+ // wrapping function (clamp or repeat)
+ env_mode := wrapping_mode;
+ `glTexParameteri(@mode, GL_TEXTURE_WRAP_S, @env_mode)`;
+ `glTexParameteri(@mode, GL_TEXTURE_WRAP_T, @env_mode)`;
+ );
+
+ - make_from_data pixels:FAST_ARRAY[UINTEGER_8] size (w,h:INTEGER) type t:INTEGER <-
+ (
+ + image:IMAGE;
+
+ image := IMAGE.create_empty "" size (w,h) type t allocate FALSE;
+ image.set_data pixels;
+
+ make image;
+ );
+
+ - make_from_framebuffer (x,y,w,h:INTEGER) type t:INTEGER <-
+ (
+ + env_mode,mode:INTEGER;
+ + image:IMAGE;
+
+ image := IMAGE.create_empty "" size (w,h) type t allocate FALSE;
+ set_image image;
+
+ mode := target;
+
+
+ // create OpenGL texture
+ `glGenTextures(1, &texture_id)`;
+ id := `texture_id`:INTEGER;
+
+ // set pixel aligment
+ `glPixelStorei (GL_UNPACK_ALIGNMENT, 1)`;
+
+ // select new texture
+ `glBindTexture(@mode, texture_id)`;
+
+ //--- OpenGL texture parameters
+ filter
+ .when filter_mipmap then {
+ `glTexParameteri(@mode,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST)`;
+ `glTexParameteri(@mode,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR)`;
+ }.when filter_linear then {
+ `glTexParameteri(@mode,GL_TEXTURE_MIN_FILTER,GL_LINEAR)`;
+ `glTexParameteri(@mode,GL_TEXTURE_MAG_FILTER,GL_LINEAR)`;
+ }.when filter_nearest then {
+ `glTexParameteri(@mode,GL_TEXTURE_MIN_FILTER,GL_NEAREST)`;
+ `glTexParameteri(@mode,GL_TEXTURE_MAG_FILTER,GL_NEAREST)`;
+ };
+ raw_copy (x,y,w,h) type t;
+ //---
+
+ // set texture function
+ env_mode := drawing_mode;
+ `glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, @env_mode)`;
+
+ // wrapping function (clamp or repeat)
+ env_mode := wrapping_mode;
+ `glTexParameteri(@mode, GL_TEXTURE_WRAP_S, @env_mode)`;
+ `glTexParameteri(@mode, GL_TEXTURE_WRAP_T, @env_mode)`;
+ );
+
+ - make_empty (w,h:INTEGER) type t:INTEGER <-
+ // slow...
+ (
+ + mode,type:INTEGER;
+ + image:IMAGE;
+ + p:POINTER;
+
+ image := IMAGE.create_empty "" size (w,h) type t allocate TRUE;
+ set_image image;
+
+ mode := target;
+
+ (channels = 4).if {
+ type := `GL_RGBA`:INTEGER;
+ }.elseif {channels = 3} then {
+ type := `GL_RGB`:INTEGER;
+ }.elseif {channels = 1} then {
+ type := `GL_LUMINANCE`:INTEGER;
+ };
+
+ // create OpenGL texture
+ `glGenTextures(1, &texture_id)`;
+ id := `texture_id`:INTEGER;
+
+ // set pixel aligment
+ `glPixelStorei (GL_UNPACK_ALIGNMENT, 1)`;
+
+ // select new texture
+ `glBindTexture(@mode, texture_id)`;
+
+ //--- OpenGL texture parameters
+ filter
+ .when filter_mipmap then {
+ `glTexParameteri(@mode,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST)`;
+ `glTexParameteri(@mode,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR)`;
+ }.when filter_linear then {
+ `glTexParameteri(@mode,GL_TEXTURE_MIN_FILTER,GL_LINEAR)`;
+ `glTexParameteri(@mode,GL_TEXTURE_MAG_FILTER,GL_LINEAR)`;
+ }.when filter_nearest then {
+ `glTexParameteri(@mode,GL_TEXTURE_MIN_FILTER,GL_NEAREST)`;
+ `glTexParameteri(@mode,GL_TEXTURE_MAG_FILTER,GL_NEAREST)`;
+ };
+ p := image_data.to_external;
+ `glTexImage2D(GL_TEXTURE_2D, 0, @t, @w, @h, 0, @type, GL_UNSIGNED_BYTE, @p)`;
+ //---
+ );
+
+
+ - draw (x,y:INTEGER) <- deferred;
+ - draw_strech (x,y,w,h:INTEGER) <- deferred;
+
+
+ - push_attrib <-
+ (
+ `glPushAttrib(GL_TEXTURE_BIT)`;
+ );
+
+ - pop_attrib <-
+ (
+ `glPopAttrib()`;
+ );
+
+ - enable <-
+ (
+ parent_state.enable;
+ enable_unit 0;
+ );
+
+ - disable <-
+ (
+ parent_state.disable;
+ disable_unit 0;
+ );
+
+ - enable_unit n:INTEGER <-
+ ( + mode:INTEGER;
+ (OPENGL.arb_multitexture != NULL).if {
+ OPENGL.arb_multitexture.active_texture n;
+ };
+ mode := target;
+ `glEnable (@mode)`;
+ );
+
+ - disable_unit n:INTEGER <-
+ ( + mode:INTEGER;
+
+ (OPENGL.arb_multitexture != NULL).if {
+ OPENGL.arb_multitexture.active_texture n;
+ };
+ mode := target;
+ `glDisable (@mode)`;
+ );
+
+ - bind <-
+ (
+ bind_unit 0;
+ );
+
+ - bind_unit n:INTEGER <-
+ (
+ + id_tex,mode:INTEGER;
+
+ enable_unit n;
+
+ id_tex := id;
+ mode := target;
+ `glBindTexture(@mode, @id_tex)`;
+ );
+
+Section GL_ABSTRACT_TEXTURE
+
+ - target:INTEGER <- deferred;
+
+ - raw_create (ch,w,h,type:INTEGER) data p:POINTER <- deferred;
+ - raw_create_mipmap (ch,w,h,type:INTEGER) data p:POINTER <- deferred;
+
+ - raw_copy (x,y,w,h:INTEGER) type t:INTEGER <- deferred;
\ No newline at end of file
diff --git a/opengl/gl_accum_buffer.li b/opengl/gl_accum_buffer.li
new file mode 100644
index 0000000..b1f78e7
--- /dev/null
+++ b/opengl/gl_accum_buffer.li
@@ -0,0 +1,50 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := GL_ACCUM_BUFFER;
+
+ - comment := "OpenGL Accumulation Buffer";
+
+Section Inherit
+
+ - parent_accum_buffer:ACCUM_BUFFER := ACCUM_BUFFER;
+
+Section Public
+
+ // accumulation functions
+ - accum:INTEGER <- `GL_ACCUM`:INTEGER;
+ - load:INTEGER <- `GL_LOAD`:INTEGER;
+ - return:INTEGER <- `GL_RETURN`:INTEGER;
+ - add:INTEGER <- `GL_ADD`:INTEGER;
+ - mult:INTEGER <- `GL_MULT`:INTEGER;
+
+
+ - clear <-
+ (
+ `glClear(GL_ACCUM_BUFFER_BIT)`;
+ );
+
+ - set_function f:INTEGER value val:REAL_32 <-
+ (
+ `glAccum(@f, @val)`;
+ );
\ No newline at end of file
diff --git a/opengl/gl_alpha_test.li b/opengl/gl_alpha_test.li
new file mode 100644
index 0000000..3e9e595
--- /dev/null
+++ b/opengl/gl_alpha_test.li
@@ -0,0 +1,70 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := GL_ALPHA_TEST;
+
+ - comment := "Alpha Testing (only in RGBA mode)";
+
+Section Inherit
+
+ - parent_alpha_test:ALPHA_TEST := ALPHA_TEST;
+
+Section Public
+
+ // pixel test functions
+ - always:INTEGER <- `GL_ALWAYS`:INTEGER;
+ - never:INTEGER <- `GL_NEVER`:INTEGER;
+ - less:INTEGER <- `GL_LESS`:INTEGER;
+ - lequal:INTEGER <- `GL_LEQUAL`:INTEGER;
+ - equal:INTEGER <- `GL_EQUAL`:INTEGER;
+ - gequal:INTEGER <- `GL_GEQUAL`:INTEGER;
+ - greater:INTEGER <- `GL_GREATER`:INTEGER;
+ - notequal:INTEGER <- `GL_NOTEQUAL`:INTEGER;
+
+
+ - enable <-
+ (
+ parent_state.enable;
+ `glEnable(GL_ALPHA_TEST)`;
+ );
+
+ - disable <-
+ (
+ parent_state.disable;
+ `glDisable(GL_ALPHA_TEST)`;
+ );
+
+ - push_attrib <-
+ (
+ `glPushAttrib(GL_ENABLE_BIT)`;
+ );
+
+ - pop_attrib <-
+ (
+ `glPopAttrib()`;
+ );
+
+ - apply f:INTEGER with val:REAL_32 <-
+ (
+ `glAlphaFunc(@f, @val)`;
+ );
\ No newline at end of file
diff --git a/opengl/gl_blending.li b/opengl/gl_blending.li
new file mode 100644
index 0000000..2da5002
--- /dev/null
+++ b/opengl/gl_blending.li
@@ -0,0 +1,77 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := GL_BLENDING;
+
+ - comment := "Opengl Blending Mode";
+
+Section Inherit
+
+ - parent_blending:BLENDING := BLENDING;
+
+Section Public
+
+ // factors values
+ - zero:INTEGER <- `GL_ZERO`:INTEGER;
+ - one:INTEGER <- `GL_ONE`:INTEGER;
+ - dst_color:INTEGER <- `GL_DST_COLOR`:INTEGER;
+ - one_minus_dst_color:INTEGER <- `GL_ONE_MINUS_DST_COLOR`:INTEGER;
+ - src_color:INTEGER <- `GL_SRC_COLOR`:INTEGER;
+ - one_minus_src_color:INTEGER <- `GL_ONE_MINUS_SRC_COLOR`:INTEGER;
+ - src_alpha:INTEGER <- `GL_SRC_ALPHA`:INTEGER;
+ - one_minus_src_alpha:INTEGER <- `GL_ONE_MINUS_SRC_ALPHA`:INTEGER;
+ - dst_alpha:INTEGER <- `GL_DST_ALPHA`:INTEGER;
+ - one_minus_dst_alpha:INTEGER <- `GL_ONE_MINUS_DST_ALPHA`:INTEGER;
+ - src_alpha_saturate:INTEGER <- `GL_SRC_ALPHA_SATURATE`:INTEGER;
+
+ - enable <-
+ (
+ parent_state.enable;
+ `glEnable(GL_BLEND)`;
+ );
+
+ - disable <-
+ (
+ parent_state.disable;
+ `glDisable(GL_BLEND)`;
+ );
+
+ - push_attrib <-
+ (
+ `glPushAttrib(GL_ENABLE_BIT)`;
+ );
+
+ - pop_attrib <-
+ (
+ `glPopAttrib()`;
+ );
+
+ - apply (src_factor,dst_factor:INTEGER) <-
+ (
+ `glBlendFunc(@src_factor, @dst_factor)`;
+ );
+
+ - set_alpha_value alpha:REAL_32 <-
+ (
+ `glColor4f(1.0f, 1.0f, 1.0f, @alpha)`;
+ );
\ No newline at end of file
diff --git a/opengl/gl_color_buffer.li b/opengl/gl_color_buffer.li
new file mode 100644
index 0000000..910e657
--- /dev/null
+++ b/opengl/gl_color_buffer.li
@@ -0,0 +1,140 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := GL_COLOR_BUFFER;
+
+ - comment := "OpenGL pixel color buffer";
+
+Section Inherit
+
+ - parent_color_buffer:COLOR_BUFFER := COLOR_BUFFER;
+
+Section Public
+
+ - rgb:INTEGER <- `GL_RGB`:INTEGER;
+ - rgba:INTEGER <- `GL_RGBA`:INTEGER;
+ - red:INTEGER <- `GL_RED`:INTEGER;
+ - green:INTEGER <- `GL_GREEN`:INTEGER;
+ - blue:INTEGER <- `GL_BLUE`:INTEGER;
+ - alpha:INTEGER <- `GL_ALPHA`:INTEGER;
+ - luminance:INTEGER <- `GL_LUMINANCE`:INTEGER; // grey (single component)
+ - luminance_alpha:INTEGER <- `GL_LUMINANCE_ALPHA`:INTEGER; // grey+alpha
+ - stencil_index:INTEGER <- `GL_STENCIL_INDEX`:INTEGER;
+ - depth_component:INTEGER <- `GL_DEPTH_COMPONENT`:INTEGER;
+
+
+ - clear <-
+ (
+ `glClear(GL_COLOR_BUFFER_BIT)`;
+ );
+
+ - set_clear_value (r,g,b,a:REAL_32) <-
+ (
+ `glClearColor(@r, @g, @b, @a)`;
+ );
+
+ - set_color c:COLOR <-
+ (
+ + r,g,b:REAL_32;
+
+ r := c.r;
+ g := c.g;
+ b := c.b;
+ `glColor3f(@r, @g, @b)`;
+ );
+
+ - set_color3f (r,g,b:REAL_32) <-
+ (
+ `glColor3f(@r, @g, @b)`;
+ );
+
+ - set_color4f (r,g,b,a:REAL_32) <-
+ (
+ `glColor4f(@r, @g, @b, @a)`;
+ );
+
+ - set_mask (r,g,b,a:BOOLEAN) <-
+ (
+ `glColorMask(@r, @g, @b, @a)`;
+ );
+
+ - enable <-
+ (
+ `glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE)`;
+ );
+
+ - disable <-
+ (
+ `glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE)`;
+ );
+
+ - read (x,y:INTEGER) size (w,h:INTEGER) type t:INTEGER in buf:FAST_ARRAY[UINTEGER_8] <-
+ ( + p:POINTER;
+
+ p := buf.to_external;
+ `glReadPixels(@x, at y, at w, at h, at t,GL_UNSIGNED_BYTE, at p)`;
+ );
+
+ // aliases
+ - read_rgb (x,y:INTEGER) size (w,h:INTEGER) in buf:FAST_ARRAY[UINTEGER_8] <-
+ (
+ read (x,y) size (w,h) type rgb in buf;
+ );
+
+ - read_rgba (x,y:INTEGER) size (w,h:INTEGER) in buf:FAST_ARRAY[UINTEGER_8] <-
+ (
+ read (x,y) size (w,h) type rgba in buf;
+ );
+
+ - draw_pixels pixels:FAST_ARRAY[UINTEGER_8] size (w,h:INTEGER) type t:INTEGER <-
+ ( + p:POINTER;
+
+ p := pixels.to_external;
+ `glDrawPixels(@w, at h,GL_UNSIGNED_BYTE, at t, at p)`;
+ );
+
+ - draw_rgb_pixels pixels:FAST_ARRAY[UINTEGER_8] size (w,h:INTEGER) <-
+ (
+ draw_pixels pixels size (w,h) type rgb;
+ );
+
+ - draw_rgba_pixels pixels:FAST_ARRAY[UINTEGER_8] size (w,h:INTEGER) <-
+ (
+ draw_pixels pixels size (w,h) type rgba;
+ );
+
+ - copy (x,y:INTEGER) size (w,h:INTEGER) type t:INTEGER <-
+ (
+ `glCopyPixels(@x, at y, at w, at h, at t)`;
+ );
+
+ - copy_rgb (x,y:INTEGER) size (w,h:INTEGER) <-
+ (
+ copy (x,y) size (w,h) type rgb;
+ );
+
+ - copy_rgba (x,y:INTEGER) size (w,h:INTEGER) <-
+ (
+ copy (x,y) size (w,h) type rgba;
+ );
+
\ No newline at end of file
diff --git a/opengl/gl_culling.li b/opengl/gl_culling.li
new file mode 100644
index 0000000..186090b
--- /dev/null
+++ b/opengl/gl_culling.li
@@ -0,0 +1,73 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := GL_CULLING;
+
+ - comment := "OpenGL Culling Mode";
+
+Section Inherit
+
+ - parent_culling:CULLING := CULLING;
+
+Section Public
+
+ // culling modes
+ - front:INTEGER <- `GL_FRONT`:INTEGER;
+ - back:INTEGER <- `GL_BACK`:INTEGER;
+ - clockwise:INTEGER <- `GL_CW`:INTEGER;
+ - counter_clockwise:INTEGER <- `GL_CCW`:INTEGER;
+
+
+ - apply mode:INTEGER <-
+ (
+ `glCullFace(@mode)`;
+ );
+
+ - set_orientation o:INTEGER <-
+ (
+ `glFrontFace(@o)`;
+ );
+
+ - enable <-
+ (
+ parent_state.enable;
+ `glEnable(GL_CULL_FACE)`;
+ );
+
+ - disable <-
+ (
+ parent_state.disable;
+ `glDisable(GL_CULL_FACE)`;
+ );
+
+ - push_attrib <-
+ (
+ `glPushAttrib(GL_ENABLE_BIT)`;
+ );
+
+ - pop_attrib <-
+ (
+ `glPopAttrib()`;
+ );
+
+
diff --git a/opengl/gl_depth_buffer.li b/opengl/gl_depth_buffer.li
new file mode 100644
index 0000000..d7329a3
--- /dev/null
+++ b/opengl/gl_depth_buffer.li
@@ -0,0 +1,89 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := GL_DEPTH_BUFFER;
+
+ - comment := "Opengl Depth Buffer";
+
+Section Inherit
+
+ - parent_buffer:DEPTH_BUFFER := DEPTH_BUFFER;
+
+Section Public
+
+ // pixel test functions
+ - always:INTEGER <- `GL_ALWAYS`:INTEGER;
+ - never:INTEGER <- `GL_NEVER`:INTEGER;
+ - less:INTEGER <- `GL_LESS`:INTEGER;
+ - lequal:INTEGER <- `GL_LEQUAL`:INTEGER;
+ - equal:INTEGER <- `GL_EQUAL`:INTEGER;
+ - gequal:INTEGER <- `GL_GEQUAL`:INTEGER;
+ - greater:INTEGER <- `GL_GREATER`:INTEGER;
+ - notequal:INTEGER <- `GL_NOTEQUAL`:INTEGER;
+
+ - enable <-
+ (
+ parent_state.enable;
+ `glEnable (GL_DEPTH_TEST)`;
+ );
+
+ - disable <-
+ (
+ parent_state.disable;
+ `glDisable (GL_DEPTH_TEST)`;
+ );
+
+ - push_attrib <-
+ (
+ `glPushAttrib(GL_ENABLE_BIT)`;
+ );
+
+ - pop_attrib <-
+ (
+ `glPopAttrib()`;
+ );
+
+ - set_clear_value val:REAL_32 <-
+ (
+ `glClearDepth(@val)`;
+ );
+
+ - clear <-
+ (
+ `glClear(GL_DEPTH_BUFFER_BIT)`;
+ );
+
+ - set_function f:INTEGER <-
+ (
+ `glDepthFunc(@f)`;
+ );
+
+ - lock <-
+ (
+ `glDepthMask(GL_TRUE)`;
+ );
+
+ - unlock <-
+ (
+ `glDepthMask(GL_FALSE)`;
+ );
\ No newline at end of file
diff --git a/opengl/gl_display_list.li b/opengl/gl_display_list.li
new file mode 100644
index 0000000..694024e
--- /dev/null
+++ b/opengl/gl_display_list.li
@@ -0,0 +1,71 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := GL_DISPLAY_LIST;
+
+ - author := "OpenGL display list";
+
+Section Inherit
+
+ - parent_display_list:DISPLAY_LIST := DISPLAY_LIST;
+
+Section Public
+
+ + id_list:INTEGER;// OpenGL id to call display list
+
+ - create body:BLOCK :SELF <-
+ (
+ + result:SELF;
+ result := SELF.clone;
+ result.make body;
+ result
+ );
+
+ - make body:BLOCK <-
+ (
+ + id:INTEGER;
+
+ id := id_list := `glGenLists(1)`:INTEGER;
+
+ `glNewList(@id, GL_COMPILE)`;
+
+ body.value;
+
+ `glEndList()`;
+ );
+
+ - call <-
+ (
+ + id:INTEGER;
+
+ id := id_list;
+ `glCallList(@id)`;
+ );
+
+ - destroy <-
+ (
+ + id:INTEGER;
+
+ id := id_list;
+ `glDeleteLists(@id, 1)`;
+ );
diff --git a/opengl/gl_error.li b/opengl/gl_error.li
new file mode 100644
index 0000000..b5d1e68
--- /dev/null
+++ b/opengl/gl_error.li
@@ -0,0 +1,67 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := GL_ERROR;
+
+ - comment := "OpenGL error";
+
+Section Inherit
+
+ - parent_error:ERROR := ERROR;
+
+Section Public
+
+ //
+ // Error codes
+ //
+
+ - no_error:INTEGER <- `GL_NO_ERROR`:INTEGER;
+ - invalid_enum:INTEGER <- `GL_INVALID_ENUM`:INTEGER;
+ - invalid_value:INTEGER <- `GL_INVALID_VALUE`:INTEGER;
+ - invalid_operation:INTEGER <- `GL_INVALID_OPERATION`:INTEGER;
+ - stack_overflow:INTEGER <- `GL_STACK_OVERFLOW`:INTEGER;
+ - stack_underflow:INTEGER <- `GL_STACK_UNDERFLOW`:INTEGER;
+ - out_of_memory:INTEGER <- `GL_OUT_OF_MEMORY`:INTEGER;
+
+
+ - get:INTEGER <-
+ // return current error state variable
+ (
+ last_error := `glGetError()`:INTEGER;
+ last_error
+ );
+
+
+ - get buffer:STRING from code:INTEGER <-
+ // return details of error
+ ( + str:NATIVE_ARRAY[CHARACTER];
+ + i:INTEGER;
+
+ str := `gluErrorString(@code)`:NATIVE_ARRAY[CHARACTER];
+ {str.item i != '\0'}.while_do {
+ // copy names of supported extensions
+
+ buffer.add_last (str.item i);
+ i := i+1;
+ };
+ );
\ No newline at end of file
diff --git a/opengl/gl_evaluator1d.li b/opengl/gl_evaluator1d.li
new file mode 100644
index 0000000..145dd05
--- /dev/null
+++ b/opengl/gl_evaluator1d.li
@@ -0,0 +1,95 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := GL_EVALUATOR1D;
+
+ - comment := "Maps a curve line";
+
+Section Inherit
+
+ + parent_evaluator1d:Expanded EVALUATOR1D;
+
+Section Public
+
+ // types of the control points
+ - vertex3:INTEGER <- `GL_MAP1_VERTEX_3`:INTEGER;
+ - vertex4:INTEGER <- `GL_MAP1_VERTEX_4`:INTEGER;
+ - index:INTEGER <- `GL_MAP1_INDEX`:INTEGER;
+ - normal:INTEGER <- `GL_MAP1_NORMAL`:INTEGER;
+ - color4:INTEGER <- `GL_MAP1_COLOR_4`:INTEGER;
+ - texture_coord1:INTEGER <- `GL_MAP1_TEXTURE_COORD_1`:INTEGER;
+ - texture_coord2:INTEGER <- `GL_MAP1_TEXTURE_COORD_2`:INTEGER;
+ - texture_coord3:INTEGER <- `GL_MAP1_TEXTURE_COORD_3`:INTEGER;
+ - texture_coord4:INTEGER <- `GL_MAP1_TEXTURE_COORD_4`:INTEGER;
+
+ // mesh drawing modes
+ - line:INTEGER <- `GL_LINE`:INTEGER;
+ - point:INTEGER <- `GL_POINT`:INTEGER;
+
+
+ - enable <-
+ (
+ + mode:INTEGER;
+
+ mode := type;
+ parent_state.enable;
+ `glEnable(@mode)`;
+ );
+
+ - disable <-
+ (
+ + mode:INTEGER;
+
+ mode := type;
+ parent_state.disable;
+ `glDisable(@mode)`;
+ );
+
+ - map (n_points,point_size:INTEGER) range (t1,t2:REAL_32) <-
+ (
+ + mode:INTEGER;
+ + p:POINTER;
+
+ mode := type;
+ p := control_points.to_external;
+ `glMap1f(@mode, @t1, @t2, @point_size, @n_points, @p)`;
+ );
+
+ // generate a point for the parametric value 'val'
+ - evaluate val:REAL_32 <-
+ (
+ `glEvalCoord1f(@val)`;
+ );
+
+ // auto generate n points evenly spaced between (t1,t2)
+ - generate_grid nb_points:INTEGER between (t1,t2:REAL_32) <-
+ (
+ `glMapGrid1f(@nb_points, @t1, @t2)`;
+ );
+
+ // Warning: mode is defined in the vertex buffer prototype
+ - evaluate_mesh mode:INTEGER from start:INTEGER to end:INTEGER <-
+ (
+ `glEvalMesh1(@mode, @start, @end)`;
+ );
+
\ No newline at end of file
diff --git a/opengl/gl_evaluator2d.li b/opengl/gl_evaluator2d.li
new file mode 100644
index 0000000..c6ca5fd
--- /dev/null
+++ b/opengl/gl_evaluator2d.li
@@ -0,0 +1,91 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := GL_EVALUATOR2D;
+
+ - comment := "Maps a spline surface";
+
+Section Inherit
+
+ + parent_evaluator2d:Expanded EVALUATOR2D;
+
+Section Public
+
+ // types of the control points
+ - vertex3:INTEGER <- `GL_MAP2_VERTEX_3`:INTEGER;
+ - vertex4:INTEGER <- `GL_MAP2_VERTEX_4`:INTEGER;
+ - index:INTEGER <- `GL_MAP2_INDEX`:INTEGER;
+ - normal:INTEGER <- `GL_MAP2_NORMAL`:INTEGER;
+ - color4:INTEGER <- `GL_MAP2_COLOR_4`:INTEGER;
+ - texture_coord1:INTEGER <- `GL_MAP2_TEXTURE_COORD_1`:INTEGER;
+ - texture_coord2:INTEGER <- `GL_MAP2_TEXTURE_COORD_2`:INTEGER;
+ - texture_coord3:INTEGER <- `GL_MAP2_TEXTURE_COORD_3`:INTEGER;
+ - texture_coord4:INTEGER <- `GL_MAP2_TEXTURE_COORD_4`:INTEGER;
+
+ // mesh drawing modes
+ - line:INTEGER <- `GL_LINE`:INTEGER;
+ - point:INTEGER <- `GL_POINT`:INTEGER;
+ - fill:INTEGER <- `GL_FILL`:INTEGER;
+
+ - enable <-
+ (
+ + mode:INTEGER;
+
+ mode := type;
+ parent_state.enable;
+ `glEnable(@mode)`;
+ );
+
+ - disable <-
+ (
+ + mode:INTEGER;
+
+ mode := type;
+ parent_state.disable;
+ `glDisable(@mode)`;
+ );
+
+ - map (u_order,u_size:INTEGER) and (v_order,v_size:INTEGER) range (u1,v1:REAL_32) to (u2,v2:REAL_32) <-
+ (
+ + mode:INTEGER;
+ + p:POINTER;
+
+ mode := type;
+ p := control_points.to_external;
+ `glMap2f(@mode, at u1, at u2, at u_size, at u_order, at v1, at v2, at v_size, at v_order, at p)`;
+ );
+
+ - evaluate (x,y:REAL_32) <-
+ (
+ `glEvalCoord2f(@x, at y)`;
+ );
+
+ - generate_grid (w,h:INTEGER) between (u1,u2:REAL_32) and (v1,v2:REAL_32)<-
+ (
+ `glMapGrid2f(@w, at u1, at u2, at h, at v1, at v2)`;
+ );
+
+ - evaluate_mesh mode:INTEGER from (start1,start2:INTEGER) to (end1,end2:INTEGER) <-
+ (
+ `glEvalMesh2(@mode, @start1, @end1, @start2, @end2)`;
+ );
\ No newline at end of file
diff --git a/opengl/gl_extension.li b/opengl/gl_extension.li
new file mode 100644
index 0000000..04922c3
--- /dev/null
+++ b/opengl/gl_extension.li
@@ -0,0 +1,72 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := GL_EXTENSION;
+
+ - comment := "OpenGL ARB extensions manager";
+
+Section Inherit
+
+ - parent_object:OBJECT := OBJECT;
+
+Section Public
+
+ - extension_names:STRING;
+
+ - name:STRING_CONSTANT <- STRING_CONSTANT;
+
+
+ - create :SELF <-
+ // dont clone prototype
+ ( + result:SELF;
+ (SELF.is_supported).if {
+ result := SELF;
+ result.make;
+ };
+ result
+ );
+
+ - make <- deferred;
+
+ - is_supported:BOOLEAN <-
+ (
+ + extensions:NATIVE_ARRAY[CHARACTER];
+ + i:INTEGER;
+ + result:BOOLEAN;
+
+ (extension_names = NULL).if {
+ extensions := `glGetString(GL_EXTENSIONS)`:NATIVE_ARRAY[CHARACTER];
+ extension_names := STRING.create 256;
+
+ {extensions.item i != '\0'}.while_do {
+ // copy names of supported extensions
+
+ extension_names.add_last (extensions.item i);
+ i := i+1;
+ };
+ };
+ (extension_names.has_substring name).if {
+ result := TRUE;
+ };
+ result
+ );
\ No newline at end of file
diff --git a/opengl/gl_fog.li b/opengl/gl_fog.li
new file mode 100644
index 0000000..3c2120e
--- /dev/null
+++ b/opengl/gl_fog.li
@@ -0,0 +1,84 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := GL_FOG;
+
+ - comment := "Opengl Fog";
+
+Section Inherit
+
+ + parent_fog:Expanded FOG;
+
+Section Public
+
+ - enable <-
+ (
+ parent_state.enable;
+ `glEnable(GL_FOG)`;
+ );
+
+ - disable <-
+ (
+ parent_state.disable;
+ `glDisable(GL_FOG)`;
+ );
+
+ - push_attrib <-
+ (
+ `glPushAttrib(GL_ENABLE_BIT)`;
+ );
+
+ - pop_attrib <-
+ (
+ `glPopAttrib()`;
+ );
+
+ - render <-
+ (
+ + m:INTEGER;
+ + p:POINTER;
+ + r:REAL_32;
+
+ (fogmode = filter_linear).if {
+ m := `GL_LINEAR`:INTEGER;
+ } else {
+ m := `GL_EXP2`:INTEGER; // GL_EXP for old pc
+ };
+ `glFogi(GL_FOG_MODE, @m)`;
+
+ p := color.getv.to_external;
+ `glFogfv(GL_FOG_COLOR, @p)`;
+
+ r := density;
+ `glFogf(GL_FOG_DENSITY, @r)`;
+
+ `glHint(GL_FOG_HINT, GL_DONT_CARE)`; // GL_DONT_CARE, GL_NICEST or GL_FASTEST
+ r := start;
+ `glFogf(GL_FOG_START, @r)`;
+
+ r := end;
+ `glFogf(GL_FOG_END, @r)`;
+ `glEnable(GL_FOG)`;
+ );
+
+
\ No newline at end of file
diff --git a/opengl/gl_font_abstract.li b/opengl/gl_font_abstract.li
new file mode 100644
index 0000000..a50681d
--- /dev/null
+++ b/opengl/gl_font_abstract.li
@@ -0,0 +1,122 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := GL_FONT_ABSTRACT;
+
+ - comment := "OpenGl rendered font";
+
+Section Inherit
+
+ + parent_font:Expanded FONT;
+
+Section Public
+
+ + base:UINTEGER_32; // GL base display list
+ + text_mode:GL_DISPLAY_LIST;
+
+ - unload <-
+ (
+ + b:UINTEGER_32;
+ + n:INTEGER;
+
+ b := base;
+ n := nb_chars;
+ `glDeleteLists(@b, @n)`;
+
+ text_mode.destroy;
+ );
+
+ - enable <-
+ (
+ + b:INTEGER;
+ + w,h:INTEGER;
+
+ (text_mode = NULL).if {
+ // not loaded
+
+ b := base;
+ w := OPENGL.viewport.width;
+ h := OPENGL.viewport.height;
+
+ text_mode := GL_DISPLAY_LIST.create {
+ `glListBase(@b-32)`;
+
+ `glPushAttrib(GL_ENABLE_BIT)`;// push states flags
+
+ //Set projection matrix
+ `glMatrixMode(GL_PROJECTION);
+ glPushMatrix();
+ glLoadIdentity();
+ gluOrtho2D(0.0f, @w, @h, 0.0f);`;
+
+ //Set modelview matrix
+ `glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ glLoadIdentity();`;
+
+ //Set states
+ `glDisable(GL_DEPTH_TEST)`;
+ `glDisable(GL_BLEND)`;
+ `glDisable(GL_TEXTURE_2D)`;
+ `glDisable (GL_CULL_FACE)`;
+ };
+ };
+ text_mode.call;
+ );
+
+ - disable <-
+ (
+ //restore matrices
+ `glMatrixMode(GL_PROJECTION);
+ glPopMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glPopMatrix();`;
+
+ //reset other states
+ `glListBase(0)`;
+ `glPopAttrib()`;
+ );
+
+ - print text:ABSTRACT_STRING at (x,y:INTEGER) <-
+ (
+ + b:UINTEGER_32;
+ + n:INTEGER;
+ + txt:NATIVE_ARRAY[CHARACTER];
+ + xx,yy:INTEGER;
+
+ txt := text.to_external;
+ n := text.count;
+ b := base;
+ xx := x + OPENGL.viewport.x0;
+ yy := y + OPENGL.viewport.y0;
+
+ //Print the text
+ `#ifndef GLBINDING__USE_GUI // FIXME: raster bug with gui
+ glListBase(@b - 32);
+
+ glRasterPos2i(@xx, @yy);
+ glCallLists(@n, GL_UNSIGNED_BYTE, @txt);
+ #endif
+ `;
+ );
+
\ No newline at end of file
diff --git a/opengl/gl_index_buffer.li b/opengl/gl_index_buffer.li
new file mode 100644
index 0000000..73fbe5e
--- /dev/null
+++ b/opengl/gl_index_buffer.li
@@ -0,0 +1,106 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := GL_INDEX_BUFFER;
+
+Section Inherit
+
+ - parent_index_buffer:INDEX_BUFFER := INDEX_BUFFER;
+
+Section Public
+
+ + index:FAST_ARRAY[UINTEGER_16];
+
+ + index_id:UINTEGER_32;
+
+
+ - make sz:INTEGER <-
+ (
+ index := FAST_ARRAY[UINTEGER_16].create_with_capacity sz;
+ );
+
+ - build <-
+ (
+ + p:POINTER;
+
+ (OPENGL.arb_vertex_buffer_object != NULL).if {
+ // create index array
+ (index.count > 0).if {
+ index_id := OPENGL.arb_vertex_buffer_object.genbuffer;
+ OPENGL.arb_vertex_buffer_object.bind_index index_id;
+
+ // load data into GPU cache
+ p := index.to_external;
+ OPENGL.arb_vertex_buffer_object.buffer_index_data p size (index.count*UINTEGER_16.object_size);
+ };
+ };
+ );
+
+ - bind <-
+ (
+ (index.count > 0).if {
+ (OPENGL.arb_vertex_buffer_object != NULL).if {
+ // use GPU index buffer
+ OPENGL.arb_vertex_buffer_object.bind_index index_id;
+ };
+ };
+ );
+
+ - draw mode:INTEGER size sz:INTEGER <-
+ (
+ + p:POINTER;
+
+ (OPENGL.arb_vertex_buffer_object != NULL).if {
+ `glDrawElements (@mode, @sz, GL_UNSIGNED_SHORT, 0)`;
+ } else {
+ p := index.to_external;
+ `glDrawElements (@mode, @sz, GL_UNSIGNED_SHORT, @p)`;
+ };
+ (OPENGL.arb_vertex_buffer_object != NULL).if {
+ OPENGL.arb_vertex_buffer_object.disable_index;
+ };
+ );
+
+ - begin_indices <-
+ (
+ );
+
+ - end <-
+ (
+ build;
+ );
+
+ - add_index i:UINTEGER_16 <-
+ (
+ index.add_last i;
+ );
+
+ - destroy <-
+ // bug!!!
+ (
+ (OPENGL.arb_vertex_buffer_object != NULL).if {
+ (index.count > 0).if {
+ OPENGL.arb_vertex_buffer_object.delete index_id;
+ };
+ };
+ );
\ No newline at end of file
diff --git a/opengl/gl_light.li b/opengl/gl_light.li
new file mode 100644
index 0000000..7b5b694
--- /dev/null
+++ b/opengl/gl_light.li
@@ -0,0 +1,131 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := GL_LIGHT;
+
+ - comment := "OpenGL Light";
+
+Section Inherit
+
+ + parent_light:Expanded LIGHT;
+
+Section Public
+
+ // OpenGl allow only 8 differents lights at a time
+ - nb_lights:INTEGER;
+
+ + id_light:INTEGER; // OpenGL id: LIGHT0 - LIGHT7
+
+ - make (a,d,s:COLOR, pos:VECTOR3[REAL_32]) <-
+ (
+ parent_light.make (a,d,s,pos);
+ (nb_lights < 8).if {
+
+ id_light := `GL_LIGHT0`:INTEGER + nb_lights;
+
+ nb_lights := nb_lights + 1;
+ } else {
+ GL_ERROR.print "too much lights";
+ };
+ );
+
+ - enable <-
+ (
+ + id:INTEGER;
+ + p:POINTER;
+ + vec:FAST_ARRAY[REAL_32];
+
+ parent_state.enable;
+ id := id_light;
+
+ modified.if {
+ p := ambient.getv.to_external;
+ `glLightfv(@id, GL_AMBIENT, @p)`;
+
+ p := diffuse.getv.to_external;
+ `glLightfv(@id, GL_DIFFUSE, @p)`;
+
+ p := specular.getv.to_external;
+ `glLightfv(@id, GL_SPECULAR, @p)`;
+
+ vec := position.getv;
+ is_directional.if {
+ vec.add_last 0.0;
+ p := vec.to_external;
+ `glLightfv(@id, GL_POSITION, @p)`;
+ } else {
+ vec.add_last 1.0;
+ p := vec.to_external;
+ `glLightfv(@id, GL_POSITION, @p)`;
+ };
+ modified := FALSE;
+ };
+ `glEnable(@id)`;
+ );
+
+ - disable <-
+ (
+ + id:INTEGER;
+
+ id := id_light;
+ `glDisable(@id)`;
+ );
+
+ - set_model_ambient col:RGBA <-
+ ( + p:POINTER;
+ p := col.getv.to_external;
+ `glLightModelfv(GL_LIGHT_MODEL_AMBIENT, @p)`;
+ );
+
+ - set_model_local_viewer b:BOOLEAN <-
+ (
+ `glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, @b)`;
+ );
+
+ - set_model_two_side b:BOOLEAN <-
+ (
+ `glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, @b)`;
+ );
+
+
+ - push_attrib <-
+ (
+ `glPushAttrib(GL_ENABLE_BIT)`;
+ );
+
+ - pop_attrib <-
+ (
+ `glPopAttrib()`;
+ );
+
+
+ - enable_default_light <-
+ (
+ `glEnable(GL_LIGHT0)`;
+ );
+
+ - disable_default_light <-
+ (
+ `glDisable(GL_LIGHT0)`;
+ );
+
\ No newline at end of file
diff --git a/opengl/gl_material.li b/opengl/gl_material.li
new file mode 100644
index 0000000..1ae1d32
--- /dev/null
+++ b/opengl/gl_material.li
@@ -0,0 +1,72 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := GL_MATERIAL;
+
+ - comment := "Material: lighting properties of an object";
+
+Section Inherit
+
+ + parent_material:Expanded MATERIAL;
+
+Section Public
+
+ - apply mode:INTEGER <-
+ (
+ + m:INTEGER;
+ + p:POINTER;
+ + val:REAL_32;
+
+ (mode = mode_front).if {
+ m := `GL_FRONT`:INTEGER;
+ }.elseif {mode = mode_back} then {
+ m := `GL_BACK`:INTEGER;
+ } else {
+ m := `GL_FRONT_AND_BACK`:INTEGER;
+ };
+
+ p := ambient.getv.to_external;
+ `glMaterialfv(@m, GL_AMBIENT, @p)`;
+
+ p := diffuse.getv.to_external;
+ `glMaterialfv(@m, GL_DIFFUSE, @p)`;
+
+ p := specular.getv.to_external;
+ `glMaterialfv(@m, GL_SPECULAR, @p)`;
+
+ val := shininess;
+ `glMaterialf(@m, GL_SHININESS, @val)`;
+
+ p := emission.getv.to_external;
+ `glMaterialfv(@m, GL_EMISSION, @p)`;
+ );
+
+ - enable_color <-
+ (
+ `glEnable(GL_COLOR_MATERIAL)`;
+ );
+
+ - disable_color <-
+ (
+ `glDisable(GL_COLOR_MATERIAL)`;
+ );
\ No newline at end of file
diff --git a/opengl/gl_name_stack.li b/opengl/gl_name_stack.li
new file mode 100644
index 0000000..472afca
--- /dev/null
+++ b/opengl/gl_name_stack.li
@@ -0,0 +1,52 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := GL_NAME_STACK;
+
+ - comment := "Used by pickable objects using Selection buffer";
+
+Section Inherit
+
+ - parent_name_stack:NAME_STACK := NAME_STACK;
+
+Section Public
+
+ - init <-
+ (
+ `glInitNames()`;
+ );
+
+ - load n:UINTEGER_32 <-
+ (
+ `glLoadName(@n)`;
+ );
+
+ - push n:UINTEGER_32 <-
+ (
+ `glPushName(@n)`;
+ );
+
+ - pop <-
+ (
+ `glPopName()`;
+ );
\ No newline at end of file
diff --git a/opengl/gl_plane.li b/opengl/gl_plane.li
new file mode 100644
index 0000000..92f6466
--- /dev/null
+++ b/opengl/gl_plane.li
@@ -0,0 +1,82 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := GL_PLANE;
+
+ - comment := "a*x+b*y+c*z+d >= 0 clipping plane";
+
+Section Inherit
+
+ + parent_plane:Expanded PLANE;
+
+Section Public
+
+ - nb_planes:INTEGER;
+
+ + id:INTEGER; // OpenGL plane id
+
+ - load_clipping_plane <-
+ // called while plane creation
+ (
+ // OpenGl allow only 6 clipping planes at a time.
+ (nb_planes >= 6).if {
+ GL_ERROR.print "too much clipping planes";
+ };
+ id := `GL_CLIP_PLANE0`:INTEGER + nb_planes;
+ nb_planes := nb_planes + 1;
+ );
+
+ - clip <-
+ (
+ + i:INTEGER;
+ + p:POINTER;
+
+ enable;
+
+ i := id;
+ `glEnable(@i)`;
+
+ p := getv.to_external;
+ `glClipPlane(@i, @p)`;
+ );
+
+ - push_attrib <-
+ (
+ `glPushAttrib(GL_ENABLE_BIT)`;
+ );
+
+ - pop_attrib <-
+ (
+ `glPopAttrib()`;
+ );
+
+ - unclip <-
+ (
+ + i:INTEGER;
+
+ disable;
+
+ i := id;
+ `glDisable(@i)`;
+ );
+
\ No newline at end of file
diff --git a/opengl/gl_quadrics.li b/opengl/gl_quadrics.li
new file mode 100644
index 0000000..ae2a02c
--- /dev/null
+++ b/opengl/gl_quadrics.li
@@ -0,0 +1,78 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := GL_QUADRICS;
+
+ - comment := "glu quadrics";
+
+ - external := `GLUquadric* quadric;`;
+
+Section Inherit
+
+ - parent_quadrics:QUADRICS := QUADRICS;
+
+Section Public
+
+ - fill_mode:INTEGER <- `GLU_FILL`:INTEGER;
+ - point_mode:INTEGER <- `GLU_POINT`:INTEGER;
+ - line_mode:INTEGER <- `GLU_LINE`:INTEGER;
+
+ - begin_quadric <-
+ (
+ `quadric = gluNewQuadric()`;
+ );
+
+ - end_quadric <-
+ (
+ `gluDeleteQuadric(quadric)`;
+ );
+
+ - enable_texture <-
+ (
+ `gluQuadricTexture(quadric,GL_TRUE)`;
+ );
+
+ - disable_texture <-
+ (
+ `gluQuadricTexture(quadric,GL_FALSE)`;
+ );
+
+ - set_style style:INTEGER <-
+ (
+ `gluQuadricDrawStyle(quadric, at style)`;
+ );
+
+ - draw_sphere (radius,slices,stacks:REAL_32) <-
+ (
+ `gluSphere(quadric, at radius, at slices, at stacks)`;
+ );
+
+ - draw_cylinder (base,top,height,slices,stacks:REAL_32) <-
+ (
+ `gluCylinder(quadric, at base, at top, at height, at slices, at stacks)`;
+ );
+
+ - draw_disk (inner,outer,slices,loops:REAL_32) <-
+ (
+ `gluDisk(quadric, at inner, at outer, at slices, at loops)`;
+ );
diff --git a/opengl/gl_scissor.li b/opengl/gl_scissor.li
new file mode 100644
index 0000000..a62b5eb
--- /dev/null
+++ b/opengl/gl_scissor.li
@@ -0,0 +1,68 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := GL_SCISSOR;
+
+ - comment := "Viewport clipping";
+
+Section Inherit
+
+ - parent_scissor:SCISSOR := SCISSOR;
+
+Section Public
+
+ - enable <-
+ (
+ parent_state.enable;
+ `glEnable(GL_SCISSOR_TEST)`;
+ );
+
+ - disable <-
+ (
+ parent_state.disable;
+ `glDisable(GL_SCISSOR_TEST)`;
+ );
+
+ - cut v:VIEWPORT <-
+ (
+ + x,y,w,h:UINTEGER_32;
+
+ x := v.x0;
+ y := v.y0;
+ w := v.width;
+ h := v.height;
+ `glScissor(@x, at y, at w, at h)`;
+ );
+
+ - cut4i (x,y,width,height:UINTEGER_32) <-
+ (
+ `glScissor(@x, at y, at width, at height)`;
+ );
+
+ - get_scissor_box viewport:VIEWPORT <- // ?????
+ (
+ + p:POINTER;
+
+ p := viewport.getv.to_external;
+ `glGetIntegerv(GL_SCISSOR_BOX, @p)`;
+ );
\ No newline at end of file
diff --git a/opengl/gl_shader.li b/opengl/gl_shader.li
new file mode 100644
index 0000000..13e5834
--- /dev/null
+++ b/opengl/gl_shader.li
@@ -0,0 +1,200 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := GL_SHADER;
+
+ - comment := "OpengGL GLSL Shader";
+
+Section Inherit
+
+ - parent_shader:SHADER := SHADER;
+
+Section Public
+
+ //
+ // OpengGL ID handlers
+ //
+ + vertex_shader_id:UINTEGER_32;
+ + fragment_shader_id:UINTEGER_32;
+ + program_id:UINTEGER_32;
+
+ + is_loaded:BOOLEAN;
+
+
+ - make (vertex_shader,fragment_shader:ABSTRACT_STRING) <-
+ (
+ + source:STRING;
+
+ // create shader program
+ program_id := OPENGL.arb_shader_object.create_program;
+
+ //
+ // vertex shader
+ //
+ source := get_source vertex_shader;
+ (source != NULL).if {
+
+ // create shader object
+ vertex_shader_id := OPENGL.arb_shader_object.create_vertex_shader;
+
+ // set source code
+ OPENGL.arb_shader_object.shader_source vertex_shader_id string source;
+
+ // compile shader
+ OPENGL.arb_shader_object.compile vertex_shader_id;
+
+ // attach shader to program
+ OPENGL.arb_shader_object.attach_object (program_id, vertex_shader_id);
+
+ is_loaded := TRUE;
+ };
+
+ //
+ // fragment shader
+ //
+ source := get_source fragment_shader;
+ (source != NULL).if {
+
+ // create shader object
+ fragment_shader_id := OPENGL.arb_shader_object.create_fragment_shader;
+
+ // set source code
+ OPENGL.arb_shader_object.shader_source fragment_shader_id string source;
+
+ // compile shader
+ OPENGL.arb_shader_object.compile fragment_shader_id;
+
+ // attach shader to program
+ OPENGL.arb_shader_object.attach_object (program_id, fragment_shader_id);
+
+ is_loaded := TRUE;
+ };
+
+ is_loaded.if {
+ // link program
+ OPENGL.arb_shader_object.link_program program_id;
+ };
+ );
+
+ - has_compiled:BOOLEAN <-
+ (
+ (OPENGL.arb_shader_object.get_infolog_status vertex_shader_id = 1) && {OPENGL.arb_shader_object.get_infolog_status fragment_shader_id = 1}
+ );
+
+ - get_infolog buffer:STRING <-
+ (
+ + sz:UINTEGER_32;
+ + tmp:FAST_ARRAY[CHARACTER];
+
+ sz := OPENGL.arb_shader_object.get_infolog_length vertex_shader_id;
+ tmp := FAST_ARRAY[CHARACTER].create sz;
+
+ OPENGL.arb_shader_object.get_infolog vertex_shader_id in tmp size sz;
+ tmp.lower.to (tmp.upper) do { i:INTEGER;
+ buffer.add_last (tmp.item i);
+ };
+
+ sz := OPENGL.arb_shader_object.get_infolog_length fragment_shader_id;
+ tmp := FAST_ARRAY[CHARACTER].create sz;
+
+ OPENGL.arb_shader_object.get_infolog fragment_shader_id in tmp size sz;
+ tmp.lower.to (tmp.upper) do { i:INTEGER;
+ buffer.add_last (tmp.item i);
+ };
+ );
+
+ - enable <-
+ (
+ is_loaded.if {
+ // use program
+ OPENGL.arb_shader_object.use_program program_id;
+ };
+ );
+
+ - disable <-
+ (
+ is_loaded.if {
+ OPENGL.arb_shader_object.use_program 0;
+ };
+ );
+
+ - get_uniform_location varname:ABSTRACT_STRING :INTEGER <-
+ (
+ OPENGL.arb_shader_object.get_uniform_location (program_id, varname)
+ );
+
+ - set_uniform1f loc:INTEGER to val:REAL_32 <-
+ (
+ OPENGL.arb_shader_object.uniform1f (loc, val);
+ );
+
+ - set_uniform2f loc:INTEGER to (v0,v1:REAL_32) <-
+ (
+ OPENGL.arb_shader_object.uniform2f (loc, v0,v1);
+ );
+
+ - set_uniform3f loc:INTEGER to (v0,v1,v2:REAL_32) <-
+ (
+ OPENGL.arb_shader_object.uniform3f (loc, v0,v1,v2);
+ );
+
+ - set_uniform4f loc:INTEGER to (v0,v1,v2,v3:REAL_32) <-
+ (
+ OPENGL.arb_shader_object.uniform4f (loc, v0,v1,v2,v3);
+ );
+
+ - bind_sampler tex:TEXTURE unit u:INTEGER location loc:INTEGER <-
+ (
+ tex.bind_unit u;
+ set_uniform1f loc to u;
+ );
+
+ - delete <-
+ (
+ OPENGL.arb_shader_object.delete_object vertex_shader_id;
+ OPENGL.arb_shader_object.delete_object fragment_shader_id;
+ OPENGL.arb_shader_object.delete_object program_id;
+ );
+
+Section Private
+
+ - get_source filename:ABSTRACT_STRING :STRING <-
+ (
+ + file:POINTER;
+ + source:STRING;
+ + sz:INTEGER;
+
+ (filename != NULL).if {
+ // read shader source code
+ file := FS_MIN.open_read filename;
+ (file != NULL).if {
+ sz := FS_MIN.file_size file;
+ source := STRING.create (sz+1);
+
+ FS_MIN.read file in source size sz;
+ FS_MIN.close file;
+ };
+ };
+ source
+ );
+
\ No newline at end of file
diff --git a/opengl/gl_stencil_buffer.li b/opengl/gl_stencil_buffer.li
new file mode 100644
index 0000000..e7a245f
--- /dev/null
+++ b/opengl/gl_stencil_buffer.li
@@ -0,0 +1,102 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := GL_STENCIL_BUFFER;
+
+ - comment := "Opengl Stencil Buffer";
+
+Section Inherit
+
+ - parent_buffer:STENCIL_BUFFER := STENCIL_BUFFER;
+
+Section Public
+
+ // pixel test functions
+ - always:INTEGER <- `GL_ALWAYS`:INTEGER;
+ - never:INTEGER <- `GL_NEVER`:INTEGER;
+ - less:INTEGER <- `GL_LESS`:INTEGER;
+ - lequal:INTEGER <- `GL_LEQUAL`:INTEGER;
+ - equal:INTEGER <- `GL_EQUAL`:INTEGER;
+ - gequal:INTEGER <- `GL_GEQUAL`:INTEGER;
+ - greater:INTEGER <- `GL_GREATER`:INTEGER;
+ - notequal:INTEGER <- `GL_NOTEQUAL`:INTEGER;
+
+ // stencil operations
+ - keep:INTEGER <- `GL_KEEP`:INTEGER;
+ - replace:INTEGER <- `GL_REPLACE`:INTEGER;
+ - incr:INTEGER <- `GL_INCR`:INTEGER;
+ - decr:INTEGER <- `GL_DECR`:INTEGER;
+ - invert:INTEGER <- `GL_INVERT`:INTEGER;
+
+
+ - enable <-
+ (
+ parent_state.enable;
+ `glEnable (GL_STENCIL_TEST)`;
+ );
+
+ - disable <-
+ (
+ parent_state.disable;
+ `glDisable (GL_STENCIL_TEST)`;
+ );
+
+ - push_attrib <-
+ (
+ `glPushAttrib(GL_ENABLE_BIT)`;
+ );
+
+ - pop_attrib <-
+ (
+ `glPopAttrib()`;
+ );
+
+ - set_clear_value val:REAL_32 <-
+ (
+ `glClearStencil(@val)`;
+ );
+
+ - clear <-
+ (
+ `glClear(GL_STENCIL_BUFFER_BIT)`;
+ );
+
+ - set_function f:INTEGER value val:INTEGER_32 mask m:UINTEGER_32 <-
+ (
+ `glStencilFunc(@f, @val, @m)`;
+ );
+
+ - when_pass op1:INTEGER when_fail op2:INTEGER when_zfail op3:INTEGER <-
+ (
+ `glStencilOp(@op2, @op3, @op1)`;
+ );
+
+ - lock <-
+ // stencil buffer is read-only
+ (
+ `glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP)`;
+ );
+
+ - unlock <-
+ (
+ );
\ No newline at end of file
diff --git a/opengl/gl_texture1d.li b/opengl/gl_texture1d.li
new file mode 100644
index 0000000..044cbce
--- /dev/null
+++ b/opengl/gl_texture1d.li
@@ -0,0 +1,117 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := GL_TEXTURE1D;
+
+ - comment := "OpenGL 1D texture";
+
+Section Inherit
+
+ + parent_abstract_texture:Expanded GL_ABSTRACT_TEXTURE;
+
+Section Public
+
+ - draw (x,y:INTEGER) <- // fixme
+ (
+ + w,h:INTEGER;
+
+ w := width;
+ h := height;
+
+ bind;
+
+ `glBegin (GL_QUADS);
+ glTexCoord2f (0, 0);
+ glVertex2f (@x, @y);
+ glTexCoord2f (1, 0);
+ glVertex2f (@x + @w, @y);
+ glTexCoord2f (1, 1);
+ glVertex2f (@x + @w, @y + @h);
+ glTexCoord2f (0, 1);
+ glVertex2f (@x, @y + @h);
+ glEnd ();
+ `;
+ );
+
+ - draw_strech (x,y,w,h:INTEGER) <- // fixme
+ (
+ bind;
+
+ `glBegin (GL_QUADS);
+ glTexCoord2f (0, 0);
+ glVertex2f (@x, @y);
+ glTexCoord2f (1, 0);
+ glVertex2f (@x + @w, @y);
+ glTexCoord2f (1, 1);
+ glVertex2f (@x + @w, @y + @h);
+ glTexCoord2f (0, 1);
+ glVertex2f (@x, @y + @h);
+ glEnd ();
+ `;
+ );
+
+ - replace_region (x,y,w,h:INTEGER) with_data (pixels:FAST_ARRAY[UINTEGER_8],type:INTEGER) <-
+ // y & height are always 1
+ ( + p:POINTER;
+
+ p := pixels.to_external;
+ `glTexSubImage1D(GL_TEXTURE_1D, 0, @x, @w, @type, GL_UNSIGNED_BYTE, @p)`;
+ );
+
+ - replace_region (x,y,w,h:INTEGER) with image:IMAGE <-
+ (
+ + p:POINTER;
+ + type:INTEGER;
+
+ type := image.channels;
+ p := image.get_pixels.to_external;
+ `glTexSubImage1D(GL_TEXTURE_1D, 0, @x, @w, @type, GL_UNSIGNED_BYTE, @p)`;
+ );
+
+ - replace_region (x,y,w,h:INTEGER) with_framebuffer_at (x0,y0:INTEGER) <-
+ // w and y = 1
+ (
+ `glCopyTexSubImage1D(GL_TEXTURE_1D, 0, @x, @x0, at y0, @w)`;
+ );
+
+Section GL_ABSTRACT_TEXTURE
+
+ - target:INTEGER <- `GL_TEXTURE_1D`:INTEGER;
+
+ - raw_create (ch,w,h,type:INTEGER) data p:POINTER <-
+ (
+ `glTexImage1D(GL_TEXTURE_1D, 0, @ch, @w, 0, @type, GL_UNSIGNED_BYTE, @p)`;
+ );
+
+ - raw_create_mipmap (ch,w,h,type:INTEGER) data p:POINTER <-
+ (
+ `gluBuild1DMipmaps(GL_TEXTURE_1D, @ch, @w, @type, GL_UNSIGNED_BYTE, @p)`;
+ );
+
+ - raw_copy (x,y,w,h:INTEGER) type t:INTEGER <-
+ (
+ `glCopyTexImage1D(GL_TEXTURE_1D, 0, @t, @x, @y, @w, @h, 0)`;
+ );
+
+
+
\ No newline at end of file
diff --git a/opengl/gl_texture2d.li b/opengl/gl_texture2d.li
new file mode 100644
index 0000000..2d99b8d
--- /dev/null
+++ b/opengl/gl_texture2d.li
@@ -0,0 +1,116 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := GL_TEXTURE2D;
+
+ - comment := "OpenGL 2D texture";
+
+Section Inherit
+
+ + parent_abstract_texture:Expanded GL_ABSTRACT_TEXTURE;
+
+Section Public
+
+ - draw (x,y:INTEGER) <-
+ (
+ + w,h:INTEGER;
+
+ w := width;
+ h := height;
+
+ bind;
+
+ `glBegin (GL_QUADS);
+ glTexCoord2f (0, 0);
+ glVertex2f (@x, @y);
+ glTexCoord2f (1, 0);
+ glVertex2f (@x + @w, @y);
+ glTexCoord2f (1, 1);
+ glVertex2f (@x + @w, @y + @h);
+ glTexCoord2f (0, 1);
+ glVertex2f (@x, @y + @h);
+ glEnd ();
+ `;
+ );
+
+ - draw_strech (x,y,w,h:INTEGER) <-
+ (
+ bind;
+
+ `glBegin (GL_QUADS);
+ glTexCoord2f (0, 0);
+ glVertex2f (@x, @y);
+ glTexCoord2f (1, 0);
+ glVertex2f (@x + @w, @y);
+ glTexCoord2f (1, 1);
+ glVertex2f (@x + @w, @y + @h);
+ glTexCoord2f (0, 1);
+ glVertex2f (@x, @y + @h);
+ glEnd ();
+ `;
+ );
+
+ - replace_region (x,y,w,h:INTEGER) with_data (pixels:FAST_ARRAY[UINTEGER_8],type:INTEGER) <-
+ ( + p:POINTER;
+
+ p := pixels.to_external;
+ `glTexSubImage2D(GL_TEXTURE_2D, 0, @x, @y, @w, @h, @type, GL_UNSIGNED_BYTE, @p)`;
+ );
+
+ - replace_region (x,y,w,h:INTEGER) with image:IMAGE <-
+ (
+ + p:POINTER;
+ + type:INTEGER;
+
+ type := image.channels;
+ p := image.get_pixels.to_external;
+ `glTexSubImage2D(GL_TEXTURE_2D, 0, @x, @y, @w, @h, @type, GL_UNSIGNED_BYTE, @p)`;
+ );
+
+ - replace_region (x,y,w,h:INTEGER) with_framebuffer_at (x0,y0:INTEGER) <-
+ ( + t:INTEGER;
+
+ t := channels;
+ `glCopyTexSubImage2D(GL_TEXTURE_2D, 0, @x, at y, @x0, at y0, @w, at h)`;
+ // `glCopyTexImage2D(GL_TEXTURE_2D, 0, @t, @x, @y, @w, @h, 0)`;
+ );
+
+Section GL_ABSTRACT_TEXTURE
+
+ - target:INTEGER <- `GL_TEXTURE_2D`:INTEGER;
+
+ - raw_create (ch,w,h,type:INTEGER) data p:POINTER <-
+ (
+ `glTexImage2D(GL_TEXTURE_2D, 0, @ch, @w, @h, 0, @type, GL_UNSIGNED_BYTE, @p)`;
+ );
+
+ - raw_create_mipmap (ch,w,h,type:INTEGER) data p:POINTER <-
+ (
+ `gluBuild2DMipmaps(GL_TEXTURE_2D, @ch, @w, @h, @type, GL_UNSIGNED_BYTE, @p)`;
+ );
+
+ - raw_copy (x,y,w,h:INTEGER) type t:INTEGER <-
+ (
+ `glCopyTexImage2D(GL_TEXTURE_2D, 0, @t, @x, @y, @w, @h, 0)`;
+ );
+
\ No newline at end of file
diff --git a/opengl/gl_transform.li b/opengl/gl_transform.li
new file mode 100644
index 0000000..3850605
--- /dev/null
+++ b/opengl/gl_transform.li
@@ -0,0 +1,215 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := GL_TRANSFORM;
+
+ - comment := "3 types of transformation: modelview, projection, viewport";
+
+Section Inherit
+
+ - parent_transform:TRANSFORM := TRANSFORM;
+
+Section Public
+
+ - load_identity <-
+ // clear transformation
+ (
+ `glLoadIdentity()`;
+ );
+
+ - push_matrix <-
+ (
+ `glPushMatrix()`;
+ );
+
+ - pop_matrix <-
+ (
+ `glPopMatrix()`;
+ );
+
+ - load_matrix m:MATRIX4[REAL_32] <-
+ ( + p:POINTER;
+
+ p := m.to_external;
+ `glLoadMatrixf(@p)`;
+ );
+
+ - mult_matrix_by m:MATRIX4[REAL_32] <-
+ ( + p:POINTER;
+
+ p := m.to_external;
+ `glMultMatrixf(@p)`;
+ );
+
+ //
+ // Viewing & Modeling transformations
+ //
+
+ - set_modelview_mode <-
+ (
+ `glMatrixMode(GL_MODELVIEW)`;
+ );
+
+ - translatef (x,y,z:REAL_32) <-
+ (
+ `glTranslatef (@x, at y, at z)`;
+ );
+
+ - rotatef (val,x,y,z:REAL_32) <-
+ (
+ `glRotatef (@val, at x, at y, at z)`;
+ );
+
+ - scalef (x,y,z:REAL_32) <-
+ (
+ `glScalef (@x, at y, at z)`;
+ );
+
+ - get_modelview matrix:MATRIX4[REAL_32] <-
+ ( + p:POINTER;
+
+ p := matrix.to_external;
+ `glGetFloatv(GL_MODELVIEW_MATRIX, @p)`;
+ );
+
+ //
+ // Projection transformations
+ //
+
+ - set_projection_mode <-
+ (
+ `glMatrixMode(GL_PROJECTION)`;
+ );
+
+ - get_projection matrix:MATRIX4[REAL_32] <-
+ ( + p:POINTER;
+
+ p := matrix.to_external;
+ `glGetFloatv(GL_PROJECTION_MATRIX, @p)`;
+ );
+
+ - perspective (fovy,aspect,near,far:REAL_32) <-
+ (
+ `gluPerspective(@fovy, @aspect, @near, @far)`;
+ );
+
+ - frustum (left,right,bottom,top,near,far:REAL_32) <-
+ (
+ `glFrustum(@left, at right, at bottom, at top, at near, at far)`;
+ );
+
+ - orthographic (left,right,bottom,top,near,far:REAL_32) <-
+ (
+ `glOrtho(@left, at right, at bottom, at top, at near, at far)`;
+ );
+
+ - orthographic2d (left,right,bottom,top:REAL_32) <-
+ (
+ `gluOrtho2D(@left, at right, at bottom, at top)`;
+ );
+
+ - pickmatrix (x,y,w,h:UINTEGER_32) in v:VIEWPORT <-
+ (
+ + p:POINTER;
+
+ p := v.getv.to_external;
+ `gluPickMatrix(@x, @y, @w, @h, @p)`;
+ );
+
+ //
+ // Viewport transformations
+ //
+
+ - set_viewport v:VIEWPORT <-
+ (
+ + x,y,w,h:UINTEGER_32;
+
+ x := v.x0;
+ y := v.y0;
+ w := v.width;
+ h := v.height;
+ `glViewport(@x, at y, at w, at h)`;
+ );
+
+ - set_viewport4i (x,y,width,height:UINTEGER_32) <-
+ (
+ `glViewport(@x, at y, at width, at height)`;
+ );
+
+ - get_viewport viewport:VIEWPORT <- // ?????
+ (
+ + p:POINTER;
+
+ p := viewport.getv.to_external;
+ `glGetIntegerv(GL_VIEWPORT, @p)`;
+ );
+
+ //
+ // Tranformation utility
+ //
+
+ - begin_ortho (w,h:INTEGER) <-
+ (
+ // define viewport
+ set_viewport4i (0, 0, w, h);
+
+ // modify projection
+ set_projection_mode;
+
+ // save old projection
+ push_matrix;
+
+ // clear our ortho projection
+ load_identity;
+
+ // set viewing volume
+ orthographic (0, w, h, 0, -99999, 99999);
+
+ // restore modelview mode
+ set_modelview_mode;
+
+ // clear tranformations
+ load_identity;
+
+ // disable states not suited for ortho mode
+ `glDisable (GL_DEPTH_TEST); // fixme
+ glDisable (GL_CULL_FACE);
+ glDisable (GL_BLEND);
+ glEnable (GL_ALPHA_TEST);
+ glColor4f (1,1,1,1);`
+ );
+
+ - end_ortho <-
+ (
+ // modify projection
+ set_projection_mode;
+
+ // restore the previous matrix
+ pop_matrix;
+
+ // go back to normal mode
+ set_modelview_mode;
+ );
+
+
+
\ No newline at end of file
diff --git a/opengl/gl_vertex_array.li b/opengl/gl_vertex_array.li
new file mode 100644
index 0000000..b97c9c5
--- /dev/null
+++ b/opengl/gl_vertex_array.li
@@ -0,0 +1,409 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := GL_VERTEX_ARRAY;
+
+Section Inherit
+
+ - parent_vertex_buffer:VERTEX_BUFFER := VERTEX_BUFFER;
+
+Section Public
+
+ + vertex:FAST_ARRAY[REAL_32];
+ + texels:FAST_ARRAY[REAL_32];
+ + normals:FAST_ARRAY[REAL_32];
+ + colors:FAST_ARRAY[REAL_32];
+
+ + vertex_id:UINTEGER_32;
+ + texels_id:UINTEGER_32;
+ + normals_id:UINTEGER_32;
+ + colors_id:UINTEGER_32;
+
+ + drawing_mode:INTEGER;
+
+ + capacity:INTEGER;
+
+
+ - make sz:INTEGER <-
+ (
+ vertex := FAST_ARRAY[REAL_32].create_with_capacity sz;
+ texels := FAST_ARRAY[REAL_32].create_with_capacity sz;
+ normals := FAST_ARRAY[REAL_32].create_with_capacity sz;
+ colors := FAST_ARRAY[REAL_32].create_with_capacity sz;
+
+ capacity := sz;
+ );
+
+ - points:INTEGER <- `GL_POINTS`:INTEGER;
+ - lines:INTEGER <- `GL_LINES`:INTEGER;
+ - polygon:INTEGER <- `GL_POLYGON`:INTEGER;
+ - triangles:INTEGER <- `GL_TRIANGLES`:INTEGER;
+ - quads:INTEGER <- `GL_QUADS`:INTEGER;
+ - line_strip:INTEGER <- `GL_LINE_STRIP`:INTEGER;
+ - line_loop:INTEGER <- `GL_LINE_LOOP`:INTEGER;
+ - triangle_strip:INTEGER <- `GL_TRIANGLE_STRIP`:INTEGER;
+ - triangle_fan:INTEGER <- `GL_TRIANGLE_FAN`:INTEGER;
+ - quad_strip:INTEGER <- `GL_QUAD_STRIP`:INTEGER;
+
+
+ - build <-
+ (
+ + p:POINTER;
+
+ (OPENGL.arb_vertex_buffer_object != NULL).if {
+ // create vertex array
+ (vertex.count > 0).if {
+ vertex_id := OPENGL.arb_vertex_buffer_object.genbuffer;
+ OPENGL.arb_vertex_buffer_object.bind vertex_id;
+
+ // load data into GPU cache
+ p := vertex.to_external;
+ OPENGL.arb_vertex_buffer_object.buffer_data p size (3*vertex.count*REAL_32.object_size);
+ };
+ (texels.count > 0).if {
+ texels_id := OPENGL.arb_vertex_buffer_object.genbuffer;
+ OPENGL.arb_vertex_buffer_object.bind texels_id;
+
+ // load data into GPU cache
+ p := texels.to_external;
+ OPENGL.arb_vertex_buffer_object.buffer_data p size (2*texels.count*REAL_32.object_size);
+ };
+ (colors.count > 0).if {
+ colors_id := OPENGL.arb_vertex_buffer_object.genbuffer;
+ OPENGL.arb_vertex_buffer_object.bind colors_id;
+
+ // load data into GPU cache
+ p := colors.to_external;
+ OPENGL.arb_vertex_buffer_object.buffer_data p size (3*colors.count*REAL_32.object_size);
+ };
+ (normals.count > 0).if {
+ normals_id := OPENGL.arb_vertex_buffer_object.genbuffer;
+ OPENGL.arb_vertex_buffer_object.bind normals_id;
+
+ // load data into GPU cache
+ p := normals.to_external;
+ OPENGL.arb_vertex_buffer_object.buffer_data p size (3*normals.count*REAL_32.object_size);
+ };
+ };
+ );
+
+ - disable <-
+ (
+ // disable pointers
+ (vertex.count > 0).if {
+ `glDisableClientState (GL_VERTEX_ARRAY)`;
+ };
+ (texels.count > 0).if {
+ `glDisableClientState (GL_TEXTURE_COORD_ARRAY)`;
+ };
+ (colors.count > 0).if {
+ `glDisableClientState (GL_COLOR_ARRAY)`;
+ };
+ (normals.count > 0).if {
+ `glDisableClientState (GL_NORMAL_ARRAY)`;
+ };
+ );
+
+ - draw <-
+ (
+ + sz,mode:INTEGER;
+
+ // render all at once
+ sz := capacity;
+ mode := drawing_mode;
+ `glDrawArrays (@mode, 0, @sz)`;
+
+ disable;
+ );
+
+ - draw_using index_array:INDEX_BUFFER <-
+ (
+ index_array.bind;
+ index_array.draw drawing_mode size capacity;
+ disable;
+ );
+
+ - bind <-
+ (
+ + p:POINTER;
+
+ (vertex.count > 0).if {
+ `glEnableClientState(GL_VERTEX_ARRAY)`;
+ (OPENGL.arb_vertex_buffer_object != NULL).if {
+ // use GPU vertex buffer
+ OPENGL.arb_vertex_buffer_object.bind vertex_id;
+ `glVertexPointer(3, GL_FLOAT, 0, (char*)NULL)`;
+ } else {
+ p := vertex.to_external;
+ `glVertexPointer(3, GL_FLOAT, 0, @p)`;
+ };
+ };
+
+ (texels.count > 0).if {
+ `glEnableClientState(GL_TEXTURE_COORD_ARRAY)`;
+ (OPENGL.arb_vertex_buffer_object != NULL).if {
+ OPENGL.arb_vertex_buffer_object.bind texels_id;
+ `glTexCoordPointer(2, GL_FLOAT, 0, (char*)NULL)`;
+ } else {
+ p := texels.to_external;
+ `glTexCoordPointer(2, GL_FLOAT, 0, @p)`;
+ };
+ };
+
+ (colors.count > 0).if {
+ `glEnableClientState(GL_COLOR_ARRAY)`;
+ (OPENGL.arb_vertex_buffer_object != NULL).if {
+ OPENGL.arb_vertex_buffer_object.bind colors_id;
+ `glColorPointer(3, GL_FLOAT, 0, (char*)NULL)`;
+ } else {
+ p := colors.to_external;
+ `glColorPointer(3, GL_FLOAT, 0, @p)`;
+ };
+ };
+
+ (normals.count > 0).if {
+ `glEnableClientState(GL_NORMAL_ARRAY)`;
+ (OPENGL.arb_vertex_buffer_object != NULL).if {
+ OPENGL.arb_vertex_buffer_object.bind normals_id;
+ `glNormalPointer(GL_FLOAT, 0, (char*)NULL)`;
+ } else {
+ p := normals.to_external;
+ `glNormalPointer(GL_FLOAT, 0, @p)`;
+ };
+ };
+ );
+
+ - bind_unit n:INTEGER <-
+ (
+ + p:POINTER;
+
+ (vertex.count > 0).if {
+ `glEnableClientState(GL_VERTEX_ARRAY)`;
+ (OPENGL.arb_vertex_buffer_object != NULL).if {
+ // use GPU vertex buffer
+ OPENGL.arb_vertex_buffer_object.bind vertex_id;
+ `glVertexPointer(3, GL_FLOAT, 0, (char*)NULL)`;
+ } else {
+ p := vertex.to_external;
+ `glVertexPointer(3, GL_FLOAT, 0, @p)`;
+ };
+ };
+
+ (texels.count > 0).if {
+ `glEnableClientState(GL_TEXTURE_COORD_ARRAY)`;
+
+ (OPENGL.arb_multitexture != NULL).if {
+ OPENGL.arb_multitexture.client_active_texture n;
+ };
+ (OPENGL.arb_vertex_buffer_object != NULL).if {
+ OPENGL.arb_vertex_buffer_object.bind texels_id;
+ `glTexCoordPointer(2, GL_FLOAT, 0, (char*)NULL)`;
+ } else {
+ p := texels.to_external;
+ `glTexCoordPointer(2, GL_FLOAT, 0, @p)`;
+ };
+ };
+
+ (colors.count > 0).if {
+ `glEnableClientState(GL_COLOR_ARRAY)`;
+ (OPENGL.arb_vertex_buffer_object != NULL).if {
+ OPENGL.arb_vertex_buffer_object.bind colors_id;
+ `glColorPointer(3, GL_FLOAT, 0, (char*)NULL)`;
+ } else {
+ p := colors.to_external;
+ `glColorPointer(3, GL_FLOAT, 0, @p)`;
+ };
+ };
+
+ (normals.count > 0).if {
+ `glEnableClientState(GL_NORMAL_ARRAY)`;
+ (OPENGL.arb_vertex_buffer_object != NULL).if {
+ OPENGL.arb_vertex_buffer_object.bind normals_id;
+ `glNormalPointer(GL_FLOAT, 0, (char*)NULL)`;
+ } else {
+ p := normals.to_external;
+ `glNormalPointer(GL_FLOAT, 0, @p)`;
+ };
+ };
+ );
+
+
+ - begin_triangles <-
+ (
+ drawing_mode := triangles;
+ );
+
+ - begin_lines <-
+ (
+ drawing_mode := lines;
+ );
+
+ - begin_points <-
+ (
+ drawing_mode := points;
+ );
+
+ - begin_quads <-
+ (
+ drawing_mode := quads;
+ );
+
+ - begin_polygon <-
+ (
+ drawing_mode := polygon;
+ );
+
+ - begin_line_strip <-
+ (
+ drawing_mode := line_strip;
+ );
+
+ - begin_line_loop <-
+ (
+ drawing_mode := line_loop;
+ );
+
+ - begin_triangle_strip <-
+ (
+ drawing_mode := triangle_strip;
+ );
+
+ - begin_triangle_fan <-
+ (
+ drawing_mode := triangle_fan;
+ );
+
+ - begin_quads_strip <-
+ (
+ drawing_mode := quad_strip;
+ );
+
+ - end <-
+ (
+ build;
+ );
+
+ - add_vertex2f (x,y:REAL_32) <-
+ (
+ vertex.add_last x;
+ vertex.add_last y;
+ vertex.add_last 0;
+ );
+
+ - add_vertex3f (x,y,z:REAL_32) <-
+ (
+ vertex.add_last x;
+ vertex.add_last y;
+ vertex.add_last z;
+ );
+
+ - add_vertex3f (x,y,z:REAL_32) color col:COLOR <-
+ (
+ add_vertex3f (x,y,z);
+ add_color col;
+ );
+
+ - add_vertex v:VERTEX <-
+ (
+ vertex.add_last (v.x);
+ vertex.add_last (v.y);
+ vertex.add_last (v.z);
+ );
+
+ - add_vertex v:VERTEX color col:COLOR <-
+ (
+ add_vertex v;
+ add_color col;
+ );
+
+ - add_texel2f (s,t:REAL_32) <-
+ (
+ texels.add_last s;
+ texels.add_last t;
+ );
+
+ - add_normal3f (x,y,z:REAL_32) <-
+ (
+ normals.add_last x;
+ normals.add_last y;
+ normals.add_last z;
+ );
+
+ - add_normal v:VECTOR3[REAL_32] <-
+ (
+ add_normal3f (v.x, v.y, v.z);
+ );
+
+ - add_color (c:COLOR) <-
+ (
+ colors.add_last (c.r);
+ colors.add_last (c.g);
+ colors.add_last (c.b);
+ );
+
+ - add_color3f (r,g,b:REAL_32) <-
+ (
+ colors.add_last r;
+ colors.add_last g;
+ colors.add_last b;
+ );
+
+ - get_vertex_data:FAST_ARRAY[REAL_32] <-
+ (
+ vertex
+ );
+
+ - get_texels_data:FAST_ARRAY[REAL_32] <-
+ (
+ texels
+ );
+
+ - get_normals_data:FAST_ARRAY[REAL_32] <-
+ (
+ normals
+ );
+
+ - get_colors_data:FAST_ARRAY[REAL_32] <-
+ (
+ colors
+ );
+
+
+ - destroy <-
+ // bug!!!
+ (
+ (OPENGL.arb_vertex_buffer_object != NULL).if {
+ (vertex.count > 0).if {
+ OPENGL.arb_vertex_buffer_object.delete vertex_id;
+ };
+ (texels.count > 0).if {
+ OPENGL.arb_vertex_buffer_object.delete texels_id;
+ };
+ (colors.count > 0).if {
+ OPENGL.arb_vertex_buffer_object.delete colors_id;
+ };
+ (normals.count > 0).if {
+ OPENGL.arb_vertex_buffer_object.delete normals_id;
+ };
+ };
+ );
\ No newline at end of file
diff --git a/opengl/gl_vertex_buffer.li b/opengl/gl_vertex_buffer.li
new file mode 100644
index 0000000..e325ecb
--- /dev/null
+++ b/opengl/gl_vertex_buffer.li
@@ -0,0 +1,221 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := GL_VERTEX_BUFFER;
+
+Section Inherit
+
+ - parent_vertex_buffer:VERTEX_BUFFER := VERTEX_BUFFER;
+
+Section Public
+
+ - make sz:INTEGER <-
+ (
+ // rien
+ );
+
+ - destroy <-
+ (
+ // rien
+ );
+
+ - build <-
+ (
+ // rien
+ );
+
+ - points:INTEGER <- `GL_POINTS`:INTEGER;
+ - lines:INTEGER <- `GL_LINES`:INTEGER;
+ - polygon:INTEGER <- `GL_POLYGON`:INTEGER;
+ - triangles:INTEGER <- `GL_TRIANGLES`:INTEGER;
+ - quads:INTEGER <- `GL_QUADS`:INTEGER;
+ - line_strip:INTEGER <- `GL_LINE_STRIP`:INTEGER;
+ - line_loop:INTEGER <- `GL_LINE_LOOP`:INTEGER;
+ - triangle_strip:INTEGER <- `GL_TRIANGLE_STRIP`:INTEGER;
+ - triangle_fan:INTEGER <- `GL_TRIANGLE_FAN`:INTEGER;
+ - quad_strip:INTEGER <- `GL_QUAD_STRIP`:INTEGER;
+
+
+ - begin_triangles <-
+ (
+ drawing_mode := triangles;
+ `glBegin (GL_TRIANGLES)`;
+ );
+
+ - begin_lines <-
+ (
+ drawing_mode := lines;
+ `glBegin (GL_LINES)`;
+ );
+
+ - begin_points <-
+ (
+ drawing_mode := points;
+ `glBegin (GL_POINTS)`;
+ );
+
+ - begin_quads <-
+ (
+ drawing_mode := quads;
+ `glBegin (GL_QUADS)`;
+ );
+
+ - begin_polygon <-
+ (
+ drawing_mode := polygon;
+ `glBegin (GL_POLYGON)`;
+ );
+
+ - begin_line_strip <-
+ (
+ drawing_mode := line_strip;
+ `glBegin (GL_LINE_STRIP)`;
+ );
+
+ - begin_line_loop <-
+ (
+ drawing_mode := line_loop;
+ `glBegin (GL_LINE_LOOP)`;
+ );
+
+ - begin_triangle_strip <-
+ (
+ drawing_mode := triangle_strip;
+ `glBegin (GL_TRIANGLE_STRIP)`;
+ );
+
+ - begin_triangle_fan <-
+ (
+ drawing_mode := triangle_fan;
+ `glBegin (GL_TRIANGLE_FAN)`;
+ );
+
+ - begin_quads_strip <-
+ (
+ drawing_mode := quad_strip;
+ `glBegin (GL_QUAD_STRIP)`;
+ );
+
+ - end <-
+ (
+ `glEnd()`;
+ );
+
+ - draw <-
+ (
+ `glFlush()`;
+ );
+
+ - add_vertex2f (x,y:REAL_32) <-
+ (
+ `glVertex2f (@x, @y)`;
+ );
+ - add_vertex3f (x,y,z:REAL_32) <-
+ (
+ `glVertex3f (@x, @y, @z)`;
+ );
+
+ - add_vertex3f (x,y,z:REAL_32) color col:COLOR <-
+ (
+ + r,g,b:REAL_32;
+
+ r := col.r;
+ g := col.g;
+ b := col.b;
+
+ `glColor3f (@r, @g, @b)`;
+ `glVertex3f (@x, @y, @z)`;
+ );
+
+ - add_vertex v:VERTEX <-
+ (
+ + x,y,z:REAL_32;
+
+ x := v.x;
+ y := v.y;
+ z := v.z;
+ `glVertex3f (@x, @y, @z)`;
+ );
+
+ - add_vertex v:VERTEX color col:COLOR <-
+ (
+ + r,g,b:REAL_32;
+
+ r := col.r;
+ g := col.g;
+ b := col.b;
+ `glColor3f (@r, @g, @b)`;
+
+ add_vertex v;
+ );
+
+ - add_texel2f (s,t:REAL_32) <-
+ (
+ `glTexCoord2f(@s, @t)`;
+ );
+
+ - add_normal3f (x,y,z:REAL_32) <-
+ (
+ `glNormal3f(@x, @y, @z)`;
+ );
+
+ - add_normal v:VECTOR3[REAL_32] <-
+ (
+ add_normal3f (v.x, v.y, v.z);
+ );
+
+ - add_color c:COLOR <-
+ (
+ + r,g,b:REAL_32;
+
+ r := c.r;
+ g := c.g;
+ b := c.b;
+ `glColor3f(@r, @g, @b)`;
+ );
+
+ - add_color3f (r,g,b:REAL_32) <-
+ (
+ `glColor3f(@r, @g, @b)`;
+ );
+
+ - get_vertex_data:FAST_ARRAY[REAL_32] <-
+ (
+ not_yet_implemented; NULL
+ );
+
+ - get_texels_data:FAST_ARRAY[REAL_32] <-
+ (
+ not_yet_implemented; NULL
+ );
+
+ - get_normals_data:FAST_ARRAY[REAL_32] <-
+ (
+ not_yet_implemented; NULL
+ );
+
+ - get_colors_data:FAST_ARRAY[REAL_32] <-
+ (
+ not_yet_implemented; NULL
+ );
+
\ No newline at end of file
diff --git a/opengl/opengl_abstract.li b/opengl/opengl_abstract.li
new file mode 100644
index 0000000..2f5c3da
--- /dev/null
+++ b/opengl/opengl_abstract.li
@@ -0,0 +1,252 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := OPENGL_ABSTRACT;
+
+Section Inherit
+
+ + parent_renderer:Expanded RENDERER;
+
+ - parent_opengl_specific:OPENGL_SPECIFIC := OPENGL_SPECIFIC;
+
+Section Public
+
+ //
+ // Renderer Modules
+ //
+
+ - transform:TRANSFORM <- GL_TRANSFORM;
+ - texture1d:TEXTURE <- GL_TEXTURE1D;
+ - texture2d:TEXTURE <- GL_TEXTURE2D;
+ - font:FONT <- GL_FONT;
+ - light:LIGHT <- GL_LIGHT;
+ - material:MATERIAL <- GL_MATERIAL;
+ - plane:PLANE <- GL_PLANE;
+ - quadrics:QUADRICS <- GL_QUADRICS;
+ - blending:BLENDING <- GL_BLENDING;
+ - culling:CULLING <- GL_CULLING;
+ - fog:FOG := GL_FOG;
+
+ //
+ // Renderer features
+ //
+
+ - vb:VERTEX_BUFFER := GL_VERTEX_BUFFER; // renderer current Vertex Buffer
+ - vertex_array:VERTEX_BUFFER <- GL_VERTEX_ARRAY;
+ - vertex_buffer:VERTEX_BUFFER <- GL_VERTEX_BUFFER;
+ - index_buffer:INDEX_BUFFER <- GL_INDEX_BUFFER;
+ - display_list:DISPLAY_LIST <- GL_DISPLAY_LIST;
+
+ - color_buffer:COLOR_BUFFER <- GL_COLOR_BUFFER;
+ - depth_buffer:DEPTH_BUFFER <- GL_DEPTH_BUFFER;
+ - stencil_buffer:STENCIL_BUFFER <- GL_STENCIL_BUFFER;
+ - accum_buffer:ACCUM_BUFFER <- GL_ACCUM_BUFFER;
+ - alpha_test:ALPHA_TEST <- GL_ALPHA_TEST;
+ - scissor:SCISSOR <- GL_SCISSOR;
+
+ - evaluator1d:EVALUATOR1D <- GL_EVALUATOR1D;
+ - evaluator2d:EVALUATOR2D <- GL_EVALUATOR2D;
+
+ - shader:SHADER <- GL_SHADER;
+
+ - name_stack:NAME_STACK <- GL_NAME_STACK;
+
+ - error:ERROR <- GL_ERROR;
+
+
+ - initialize <-
+ (
+ reshape.set_render_system Self;
+
+ `glClearColor(0, 0, 0, 1)`;
+ );
+
+ - begin_frame <-
+ // pre rendering
+ (
+ clear_screen;
+
+ // reset world matrix
+ `glLoadIdentity()`;
+ //transform.load_identity;
+ );
+
+ - end_frame <-
+ // post rendering
+ (
+ swap_buffers;
+ );
+
+ - new_frame body:BLOCK <-
+ (
+ begin_frame;
+ body.value;
+ end_frame;
+ );
+
+ - clear_screen <-
+ (
+ `glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);`;
+ );
+
+ - active_vertex_array sizemax:INTEGER <-
+ (
+ vb := GL_VERTEX_ARRAY.create sizemax;
+ );
+
+ - enable_shading <-
+ (
+ `glShadeModel (GL_SMOOTH)`;
+ );
+
+ - disable_shading <-
+ (
+ `glShadeModel (GL_FLAT)`;
+ );
+
+ - enable_lighting <-
+ (
+ `glEnable(GL_LIGHTING)`;
+ );
+
+ - disable_lighting <-
+ (
+ `glDisable(GL_LIGHTING)`;
+ );
+
+
+ - wireframe_mode on:BOOLEAN <-
+ (
+ on.if {
+ `glPolygonMode(GL_FRONT, GL_LINE)`;
+ `glPolygonMode(GL_BACK, GL_LINE)`;
+ } else {
+ `glPolygonMode(GL_FRONT, GL_FILL)`;
+ `glPolygonMode(GL_BACK, GL_FILL)`;
+ };
+ );
+
+ - enable_auto_normal <-
+ (
+ `glEnable(GL_AUTO_NORMAL)`;
+ );
+
+ - disable_auto_normal <-
+ (
+ `glDisable(GL_AUTO_NORMAL)`;
+ );
+
+
+ - set_point_size sz:REAL_32 <-
+ (
+ `glPointSize(@sz)`;
+ );
+
+ - set_line_width w:REAL_32 <-
+ (
+ `glLineWidth(@w)`;
+ );
+
+ - set_fog f:FOG <-
+ (
+ fog := f;
+ );
+
+ - set_quality q:INTEGER <-
+ (
+ + mode:INTEGER;
+
+ q
+ .when nicest_quality then {
+ mode := `GL_NICEST`:INTEGER;
+ }
+ .when fastest_quality then {
+ mode := `GL_FASTEST`:INTEGER;
+ }
+ .when default_quality then {
+ mode := `GL_DONT_CARE`:INTEGER;
+ };
+ `glHint(GL_PERSPECTIVE_CORRECTION_HINT, @mode)`;
+ );
+
+ //
+ // Render modes (GL_RENDER (default), GL_SELECT, GL_FEEDBACK)
+ //
+
+ - begin_selection_in buffer:FAST_ARRAY[UINTEGER_32] size sz:INTEGER <-
+ (
+ + p:POINTER;
+
+ p := buffer.to_external;
+ `glSelectBuffer (@sz, @p);`;
+
+ `(void) glRenderMode (GL_SELECT)`;
+ );
+
+ - end_selection:INTEGER <-
+ (
+ `glRenderMode (GL_RENDER)`:INTEGER
+ );
+
+
+ - set_fullscreen <-
+ (
+ is_fullscreeen := TRUE;
+ );
+
+ //
+ // Renderer informations
+ //
+
+ - video_card_name buf:STRING <-
+ (
+ get_value (`GL_RENDERER`:INTEGER) on buf;
+ );
+ - video_card_vendor buf:STRING <-
+ (
+ get_value (`GL_VENDOR`:INTEGER) on buf;
+ );
+ - video_card_version buf:STRING <-
+ (
+ get_value (`GL_VERSION`:INTEGER) on buf;
+ );
+
+
+
+
+
+Section Private
+
+ - get_value val:INTEGER on str:STRING <-
+ (
+ + tmp:NATIVE_ARRAY[CHARACTER];
+ + i:INTEGER;
+
+ tmp := `glGetString(@val)`:NATIVE_ARRAY[CHARACTER];
+ {tmp.item i != '\0'}.while_do {
+ // string copy
+ str.add_last (tmp.item i);
+ i := i+1;
+ };
+ );
+
diff --git a/opengl/opengl_specific.li b/opengl/opengl_specific.li
new file mode 100644
index 0000000..9c96c0e
--- /dev/null
+++ b/opengl/opengl_specific.li
@@ -0,0 +1,94 @@
+///////////////////////////////////////////////////////////////////////////////
+// Lisaac-OpenGL Library //
+// //
+// LSIIT - ULP - CNRS - INRIA - FRANCE //
+// //
+// This program is free software: you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation, either version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see <http://www.gnu.org/licenses/>. //
+// //
+// http://isaacproject.u-strasbg.fr/ //
+///////////////////////////////////////////////////////////////////////////////
+
+Section Header
+
+ + name := OPENGL_SPECIFIC;
+
+Section Inherit
+
+ - parent_object:OBJECT := OBJECT;
+
+Section Public
+
+ //
+ // OpenGL Extensions
+ //
+
+ - arb_multitexture:ARB_MULTITEXTURE;
+ - arb_vertex_buffer_object:ARB_VERTEX_BUFFER_OBJECT;
+
+ - arb_shader_object:ARB_SHADER_OBJECT;
+ - arb_vertex_shader:ARB_VERTEX_SHADER;
+ - arb_fragment_shader:ARB_FRAGMENT_SHADER;
+ - arb_shading_language_100:ARB_SHADING_LANGUAGE_100;
+
+
+ - use_arb_multitexture:BOOLEAN <-
+ (
+ arb_multitexture := ARB_MULTITEXTURE.create;
+ arb_multitexture != NULL
+ );
+
+ - use_arb_vertex_buffer_object:BOOLEAN <-
+ (
+ arb_vertex_buffer_object := ARB_VERTEX_BUFFER_OBJECT.create;
+ arb_vertex_buffer_object != NULL
+ );
+
+ - use_arb_shader_object:BOOLEAN <-
+ (
+ arb_shader_object := ARB_SHADER_OBJECT.create;
+ arb_shader_object != NULL
+ );
+
+ - use_arb_vertex_shader:BOOLEAN <-
+ (
+ arb_vertex_shader := ARB_VERTEX_SHADER.create;
+ arb_vertex_shader != NULL
+ );
+
+ - use_arb_fragment_shader:BOOLEAN <-
+ (
+ arb_fragment_shader := ARB_FRAGMENT_SHADER.create;
+ arb_fragment_shader != NULL
+ );
+
+ - use_arb_shading_language_100:BOOLEAN <-
+ (
+ arb_shading_language_100 := ARB_SHADING_LANGUAGE_100.create;
+ arb_shading_language_100 != NULL
+ );
+
+ - use_shaders:BOOLEAN <-
+ (
+ use_arb_shader_object && {use_arb_vertex_shader} && {use_arb_fragment_shader} && {use_arb_shading_language_100}
+ );
+
+ - use_extensions <-
+ // load everything
+ (
+ use_arb_vertex_buffer_object;
+ use_arb_multitexture;
+
+ use_shaders;
+ //...
+ );
\ No newline at end of file
--
Lisaac library opengl-binding
More information about the Lisaac-commits
mailing list