Last active
August 29, 2015 13:57
-
-
Save taesiri/9564366 to your computer and use it in GitHub Desktop.
OpenGL with D - Mac Os X
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
Installing dub using brew | |
$ brew install dub | |
Create project using dub | |
$ dub init hello_opengl | |
After compiling glfw, put a local copy of libglfw.dylib (glfw/build/src/libglfw.dylib) in hello_opengl directory |
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
import std.stdio; | |
import derelict.opengl3.gl3; | |
import derelict.glfw3.glfw3; | |
void main(string[] args) | |
{ | |
DerelictGL3.load(); | |
DerelictGLFW3.load(); | |
if (!glfwInit()) throw new Exception("Failed to initialize GLFW"); | |
GLFWwindow* window = glfwCreateWindow(800, 600, "Hello DerelictGLFW3", null, null); | |
if (!window) throw new Exception("Window failed to create"); | |
while (!glfwWindowShouldClose(window)) | |
{ | |
glfwPollEvents(); | |
} | |
glfwTerminate(); | |
} |
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
git clone https://github.com/glfw/glfw | |
cd glfw | |
mkdir build | |
cd build | |
export MACOSX_DEPLOYMENT_TARGET=10.9 | |
cmake -D GLFW_NATIVE_API=1 -D CMAKE_OSX_ARCHITECTURES="i386;x86_64" -D BUILD_SHARED_LIBS=ON -D CMAKE_C_COMPILER=clang ../ | |
make |
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
dub.json | |
{ | |
"name": "hello_opengl", | |
"description": "A minimal D application.", | |
"copyright": "Copyright © 2014, taesiri", | |
"authors": ["taesiri"], | |
"dependencies": { | |
"derelict-gl3" : "~master", | |
"derelict-glfw3" : "~master" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment