I have created a project in Gambas with components : gb.opengl, and gb.opengl.glu.
FOllowing the NeHe tutorials, I have the following code : (glArea1 is the form component for opegl applications.)
Public Sub GLArea1_Open()
gl.ClearDepth(100.0)
Gl.ClearColor(20, 40, 20, 0.70)
Gl.DepthFunc(Gl.LESS) ' The type of depth test to do
Gl.Enable(Gl.DEPTH_TEST) ' Enables depth testing
End
Public Sub GLArea1_Draw()
gl.Clear(gl.COLOR_BUFFER_BIT Or gl.DEPTH_BUFFER_BIT)
' Clear The Screen And The Depth Buffer
gl.Viewport(0, 0, GLArea1.Width, GLArea1.Height)
gl.MatrixMode(Gl.PROJECTION)
gl.LoadIdentity() 'Reset The Projection Matrix
gL.Translatef(0, GLArea1.Width / 2, 0)
gl.LineWidth(1.0)
gl.begin(gl.LINES)
gl.Color3f(1.0, 1.0, 0.2)
gl.Vertex3f(0, GLArea1.Height / 2, 0)
gl.Vertex3f(GLArea1.Width / 2, GLArea1.Height / 2, 0)
gl.End()
End
I would expect this code to draw a line, but the screen remains blank. A source archive is attached : http://www.filedropper.com/glline-001tar
How do I drAw lines in an openGl area in gambas 3? More specifically i want to start by drawing the Axes in the viewport. Please help.