FUNCTION Init (Width%, Height%, Title$, Detail%)
Screen1% = GDK_GL_SCREEN(Width%, Height%, Title$, 0) '// Create a screen
IF Screen1% THEN
GDK_GL_SCREEN_SET_FPS 15, 0 ' // Set maximium frames per second
glClearColor 0.0, 0.0, 0.0, 1.0 '// Set background (clear) color to black
glClearDepth 1 ' // Set clear depth value to farthest
glEnable GL_DEPTH_TEST ' // Enables depth buffer for hidden surface removal
glEnable GL_TEXTURE_2D ' // Enable texturing
glEnable GL_CULL_FACE
glFrontFace GL_CW
SELECT CASE Detail%
CASE 1, 2
glHint GL_LINE_SMOOTH_HINT, GL_FASTEST
glHint GL_TEXTURE_COMPRESSION_HINT, GL_FASTEST
glHint GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST
CASE 3
glHint GL_LINE_SMOOTH_HINT, GL_NICEST
glHint GL_TEXTURE_COMPRESSION_HINT, GL_NICEST
glHint GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST
END SELECT
glShadeModel GL_FLAT
glMatrixMode GL_PROJECTION
AspectRatio! = GDK_GL_SCREEN_WIDTH(0) / GDK_GL_SCREEN_HEIGHT(0)
gluPerspective 45, AspectRatio!, 1, 3600
glMatrixMode GL_MODELVIEW
glLoadIdentity
SCREEN _NEWIMAGE(400, 768, 32)
Init = -1
ELSE
Init = 0
END IF