Sorry, I almost forgot about this! I've been playing LL to much. :oops:
All I did was stick GLFW back in there and show how you could zoom in using the mousewheel. Hope it helps.
Code:
#include "gl/gl.bi"
#include "GL/glu.bi"
#include "GL/glfw.bi"
randomize timer
dim shared grid_size as single
dim shared modx,mody,zoom,m1,m2,m3,m4 as integer
Dim As Integer MouseX, MouseY, MouseWheel
Declare sub drawmap ()
If glfwInit() Then
'success!!!
Else
Print "Failed to initialize GLFW!!!"
Sleep 1000
End
End If
If glfwOpenWindow( 640, 480 , 5, 6, 5, 0, 0, 0, GLFW_WINDOW ) Then
'success
Else
glfwTerminate()
Print "Failed to create OpenGL context!!!"
Sleep 1000
End
End If
glClearColor( .0, .0, .0, .0 )
glfwEnable GLFW_MOUSE_CURSOR
glViewport 300, 100, 500, 500
glMatrixMode GL_PROJECTION
glLoadIdentity
'glOrtho -10,10,-10,10,-50,50
'glFrustum -10,10,-10,10,-50,50
gluPerspective 54,1 , 0, 100
glMatrixMode GL_MODELVIEW
glLoadIdentity
glEnable GL_TEXTURE_2D
glShadeModel GL_smooth
glClearColor 0.0, 0.0, 0, .50
glClearDepth 1.0
glEnable GL_DEPTH_TEST
glDepthFunc GL_LEQUAL
glHint GL_LINE_SMOOTH_HINT, GL_NICEST
GL_LINE_SMOOTH_HINT
glHint GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST
glEnable GL_CULL_FACE
glFrontFace(GL_cw)
glCullFace(GL_front)
glpointsize 3
modx=0:mody=0:zoom=-15
drawmap
do
glfwGetMousePos(@MouseX, @MouseY)
MouseWheel = glfwGetMouseWheel()
zoom = mousewheel
'glutMouseFunc
'GETMOUSE m1, m2,m3, buts
'WINDOWTITLE str(buts)
'if buttons=3 then'and
'if m3=+1 then
' zoom-=1
' if zoom<-100 then zoom=-100
' m3=0
drawmap
'end if
Print MouseWheel
glfwSwapbuffers()
loop while glfwGetKey(GLFW_KEY_ESC) = GLFW_RELEASE
glfwTerminate()
sub drawmap ()
glClear GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT
glLoadIdentity
'modx=0:mody=0:zoom=-15
grid_size=.1
glTranslatef modx,mody,zoom
glRotatef 180,1.0, .0, .0
glBegin GL_lines
glColor3f .1,.1,.1
for i!=-50 to 50 step grid_size
glVertex2f i!,-50
glVertex2f i!,50
glVertex2f -50,i!
glVertex2f 50,i!
next i
glend
glBegin GL_points
glColor3f 0,0,.5
glVertex2f 0,0
glVertex2f 1,0
glVertex2f 1,1
glVertex2f 0,1
glEnd
end sub