Hello, I hope some one can help me.
I'm using VB and I have this code in different functions but essentially is all the code:
Private Sub SetupViewport() Dim w As Integer = GlControl1.Width 'Getting width and height to configure the view port and ortho Dim h As Integer = GlControl1.Height GL.MatrixMode(MatrixMode.Projection) 'All the transformations will be applied to the projection GL.Ortho(0, 0, w, h, 1, -1) 'Configuring the ortho and view port GL.Viewport(0, 0, w - 10, h - 10) GL.MatrixMode(MatrixMode.Modelview) 'All transformation will be applied to the model GL.LoadIdentity() End Sub '---------------------------------------- Private Sub GlControl1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles GlControl1.Paint If Not clsBol_load Then Return End If GL.Clear(ClearBufferMask.ColorBufferBit Or ClearBufferMask.DepthBufferBit) 'Clearing the visual control SetupViewport() ' Initialize the ortho and view port GL.Begin(BeginMode.Lines) 'Staring to make the models using Lines to draw lines GL.Color3(Color.Yellow) 'The line will be painted in yellow 'The line will go from 0,0,0 to 2,2,2. Because BeginMode is lines, each two Vertex OpenTK will paint GL.Vertex3(0.0F, 0.0F, 0.0F) 'Using Vertex3 to put coordenades in 3 dimentions GL.Vertex3(2.0F, 2.0F, 2.0F) GL.Color3(Color.Blue) 'Changing the nex line to blue GL.Vertex3(1.0F, 1.0F, 1.0F) 'The line 2 will start from 1,1,1 and end in 2, 2, 2 GL.Vertex3(2.0F, 2.0F, 2.0F) GL.End() 'Finishing drawing for the control GlControl1.SwapBuffers() 'After calling swapBuffers the control will paint the lines End Sub
This code only displays part of the yellow line (the part from 0 to 1) :(
Even when I change all the parameters of the ortho or viewport I can't make OpenTK displays the 2nd line (the blue one) that's outside the 1X1X1 cube displayed in this code.
Can anyone please help me to know why I cant see other blue line?
Thanks so much for your help!