From 4dc0103df35c557d1df60b0279ece087ae7b7da0 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Sat, 2 Feb 2013 21:35:14 -0500 Subject: [PATCH] use and initialize DerelictGL{,U} --- Makefile | 2 +- sdl_opengl_bare.d | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5147691..0831a3b 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ TARGET := sdl_opengl_bare DFLAGS := -I/usr/local/include/d -g -LDFLAGS := -lDerelictSDL -lDerelictUtil -ldl +LDFLAGS := -lDerelictSDL -lDerelictGL -lDerelictGLU -lDerelictUtil -ldl -lGL -lGLU all: $(TARGET) diff --git a/sdl_opengl_bare.d b/sdl_opengl_bare.d index 1c0fbe6..ef81176 100644 --- a/sdl_opengl_bare.d +++ b/sdl_opengl_bare.d @@ -1,12 +1,29 @@ import std.stdio; import derelict.sdl.sdl; +import derelict.opengl.gl; +import derelict.opengl.glu; enum int WIDTH = 800; enum int HEIGHT = 600; +void init() +{ + glClearColor (0.0, 0.0, 0.0, 0.0); + glShadeModel(GL_SMOOTH); + glViewport(0, 0, WIDTH, HEIGHT); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(60.0, cast(GLfloat)WIDTH/cast(GLfloat)WIDTH, 1.0, 30.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0.0, 0.0, -10.0); +} + int main(char[][] args) { DerelictSDL.load(); + DerelictGL.load(); + DerelictGLU.load(); if (SDL_Init(SDL_INIT_EVERYTHING)) { @@ -24,6 +41,7 @@ int main(char[][] args) return 2; } + init(); SDL_Event event; while (SDL_WaitEvent(&event)) {