use and initialize DerelictGL{,U}

This commit is contained in:
Josh Holtrop 2013-02-02 21:35:14 -05:00
parent 491d6778ad
commit 4dc0103df3
2 changed files with 19 additions and 1 deletions

View File

@ -1,7 +1,7 @@
TARGET := sdl_opengl_bare TARGET := sdl_opengl_bare
DFLAGS := -I/usr/local/include/d -g DFLAGS := -I/usr/local/include/d -g
LDFLAGS := -lDerelictSDL -lDerelictUtil -ldl LDFLAGS := -lDerelictSDL -lDerelictGL -lDerelictGLU -lDerelictUtil -ldl -lGL -lGLU
all: $(TARGET) all: $(TARGET)

View File

@ -1,12 +1,29 @@
import std.stdio; import std.stdio;
import derelict.sdl.sdl; import derelict.sdl.sdl;
import derelict.opengl.gl;
import derelict.opengl.glu;
enum int WIDTH = 800; enum int WIDTH = 800;
enum int HEIGHT = 600; 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) int main(char[][] args)
{ {
DerelictSDL.load(); DerelictSDL.load();
DerelictGL.load();
DerelictGLU.load();
if (SDL_Init(SDL_INIT_EVERYTHING)) if (SDL_Init(SDL_INIT_EVERYTHING))
{ {
@ -24,6 +41,7 @@ int main(char[][] args)
return 2; return 2;
} }
init();
SDL_Event event; SDL_Event event;
while (SDL_WaitEvent(&event)) while (SDL_WaitEvent(&event))
{ {