Last active
December 15, 2015 23:19
-
-
Save hashmal/5339640 to your computer and use it in GitHub Desktop.
What OpenGL in Shirka could look like...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- assuming the following operations are defined: | |
-- | |
-- with -- require a module | |
-- case -- branching operation | |
-- ABORT -- terminate program | |
-- the `while' operation is normally already defined. The following | |
-- definition is here to show how adding new constructs to Shirka is done. | |
(=> while) | |
[ => condition | |
=> op | |
[ condition (case) [ true [ op tail ] false [] ] ] => tail | |
tail ] | |
------------------------------------------------------------------------------ | |
-- assuming "glfw" is the name of a module providing bindings to GLFW and | |
-- OpenGL: | |
(with) "glfw" | |
(=> abort-if) | |
[ -> msg | |
(case) [ true [] false [ <- msg puts ABORT ] ] ] | |
(=> main) | |
[ glfwInit | |
(abort-if) "Failed to initialise GLFW." | |
-- Forcing OpenGL to version 3.2 | |
3 :GLFW_OPENGL_VERSION_MAJOR glfwOpenWindowHint | |
2 :GLFW_OPENGL_VERSION_MINOR glfwOpenWindowHint | |
-- Forcing OpenGL to Core Profile | |
true :GLFW_OPENGL_FORWARD_COMPAT glfwOpenWindowHint | |
:GLFW_OPENGL_CORE_PROFILE :GLFW_OPENGL_PROFILE glfwOpenWindowHint | |
800 500 -- Window size | |
8 8 8 0 24 0 -- Fucking long list of parameters for buffers and shit | |
:GLFW_WINDOW -- Window mode | |
glfwOpenWindow | |
(abort-if) "Failed to open GLFW window." | |
:GL_DEPTH_TEST glEnable | |
0.133 -- R | |
0.133 -- G | |
0.133 -- B | |
1.0 -- A | |
glClearColor | |
([:GLFW_OPENED glfwGetWindowParam] while) | |
[ [:GL_COLOR_BUFFER_BIT :GL_DEPTH_BUFFER_BIT] glClear | |
glfwSwapBuffers ] | |
glfwTerminate ] | |
-- I'm still unsure about how/if I should do namespaces for modules. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment