diff --git a/ffi/gles3-export.c b/ffi/gles3-export.c index 2e32429..79e7a11 100644 --- a/ffi/gles3-export.c +++ b/ffi/gles3-export.c @@ -7,7 +7,6 @@ unsigned int VERTEX_SHADER = GL_VERTEX_SHADER; unsigned int FRAGMENT_SHADER = GL_FRAGMENT_SHADER; unsigned int TRIANGLES = GL_TRIANGLES; -unsigned int TRIANGLE_FAN = GL_TRIANGLE_FAN; unsigned int STATIC_DRAW = GL_STATIC_DRAW; unsigned int DYNAMIC_DRAW = GL_DYNAMIC_DRAW; diff --git a/ffi/gles3-import.sml b/ffi/gles3-import.sml index d876cea..1afc329 100644 --- a/ffi/gles3-import.sml +++ b/ffi/gles3-import.sml @@ -10,16 +10,23 @@ struct (* OpenGL constants used. *) val (VERTEX_SHADER, _) = _symbol "VERTEX_SHADER" public : ( unit -> shader_type ) * ( shader_type -> unit ); + val VERTEX_SHADER = VERTEX_SHADER () + val (FRAGMENT_SHADER, _) = _symbol "FRAGMENT_SHADER" public : ( unit -> shader_type ) * ( shader_type -> unit ); + val FRAGMENT_SHADER = FRAGMENT_SHADER () + val (TRIANGLES, _) = _symbol "TRIANGLES" public : ( unit -> draw_mode ) * ( draw_mode -> unit ); - val (TRIANGLE_FAN, _) = - _symbol "TRIANGLE_FAN" public : ( unit -> draw_mode ) * ( draw_mode -> unit ); + val TRIANGLES = TRIANGLES () + val (STATIC_DRAW, _) = _symbol "STATIC_DRAW" public : ( unit -> update_mode ) * ( update_mode -> unit ); + val STATIC_DRAW = STATIC_DRAW () + val (DYNAMIC_DRAW, _) = _symbol "DYNAMIC_DRAW" public : ( unit -> update_mode ) * ( update_mode -> unit ); + val DYNAMIC_DRAW = DYNAMIC_DRAW () (* OpenGL functions used. *) val loadGlad = _import "loadGlad" public : unit -> unit; @@ -44,15 +51,13 @@ struct val attachShader = _import "attachShader" public : program * shader -> unit; val linkProgram = _import "linkProgram" public : program -> unit; val useProgram = _import "useProgram" public : program -> unit; + + val deleteShader = _import "deleteShader" public : program -> unit; val deleteProgram = _import "deleteProgram" public : program -> unit; val clearColor = _import "clearColor" public : Real32.real * Real32.real * Real32.real * Real32.real -> unit; val clear = _import "clear" public : unit -> unit; - val drawArrays = _import "drawArrays" public : draw_mode * int * int -> unit; - val getUniformLocation = - _import "getUniformLocation" public : program * string -> int; - val uniform4f = - _import "uniform4f" public : int * Real32.real * Real32.real * Real32.real * Real32.real -> unit; + val drawArrays = _import "drawArrays" public : draw_mode * int * int -> unit; end diff --git a/ffi/glfw-input.sml b/ffi/glfw-input.sml index f83307d..1759120 100644 --- a/ffi/glfw-input.sml +++ b/ffi/glfw-input.sml @@ -5,8 +5,13 @@ struct (* Constants. *) val (PRESS, _) = _symbol "PRESS" public : ( unit -> int ) * ( int -> unit ); + val PRESS = PRESS () + val (REPEAT, _) = _symbol "REPEAT" public : ( unit -> int ) * ( int -> unit ); + val REPEAT = REPEAT () + val (RELEASE, _) = _symbol "RELEASE" public : ( unit -> int ) * ( int -> unit ); + val RELEASE = RELEASE () end diff --git a/shell/gl-shaders.sml b/shell/gl-shaders.sml new file mode 100644 index 0000000..f426c2e --- /dev/null +++ b/shell/gl-shaders.sml @@ -0,0 +1,23 @@ +structure GlShaders = +struct + val xyrgbVertexShaderString = + "#version 300 es\n\ + \layout (location = 0) in vec2 apos;\n\ + \layout (location = 1) in vec3 col;\n\ + \out vec3 frag_col;\n\ + \void main()\n\ + \{\n\ + \ frag_col = col;\n\ + \ gl_Position = vec4(apos.x, apos.y, 0.0f, 1.0f);\n\ + \}" + + val rgbFragmentShaderString = + "#version 300 es\n\ + \precision mediump float;\n\ + \in vec3 frag_col;\n\ + \out vec4 FragColor;\n\ + \void main()\n\ + \{\n\ + \ FragColor = vec4(frag_col.x, frag_col.y, frag_col.z, 1.0f);\n\ + \}" +end diff --git a/shf b/shf index 821dd0f..baa6fde 100755 Binary files a/shf and b/shf differ diff --git a/shf.mlb b/shf.mlb index 3f543b1..8f0d450 100644 --- a/shf.mlb +++ b/shf.mlb @@ -14,4 +14,5 @@ in ffi/glfw-input.sml end +shell/gl-shaders.sml shell/shell.sml