Simple renderer in .net with SharpGL (openGL)


Re: Simple renderer in .net with SharpGL (openGL)
#43
I have now the colors ready, but I am in trouble with the global behaviour of the openGL understanding.
As far as I have understand the whole thing, I have three different matrices:
Projection
Modelview
Textures (not yet used)

At first I set the projection matrix to the values I need.
At second step I set the modelview matrix.
Now I put the model into the modelview.

The following code currently gives blank window:
Code:
gl = Me.OpenGLControl2.OpenGL

        gl.Clear(GL_COLOR_BUFFER_BIT Or GL_DEPTH_BUFFER_BIT)
        gl.Viewport(0, 0, OpenGLControl2.Width, OpenGLControl2.Height)

        gl.MatrixMode(SharpGL.Enumerations.MatrixMode.Projection)
        gl.LoadIdentity()
        gl.LookAt(CDbl(gradiusOfBoundingbox / Math.Sin(fov / 2)), CDbl(gradiusOfBoundingbox / Math.Sin(5 / 2)), CDbl(gradiusOfBoundingbox / Math.Sin(5 / 2)), CDbl(0), CDbl(0), CDbl(0), CDbl(0), CDbl(-1), CDbl(0))
        gl.Perspective(CDbl(fov), CDbl(OpenGLControl2.Width / OpenGLControl2.Height), CDbl(2), CDbl(2 * gradiusOfBoundingbox + 2))

        gl.MatrixMode(SharpGL.Enumerations.MatrixMode.Modelview)
        gl.LoadIdentity()
        gl.Rotate(45.0F, 0.0F, 1.0F, 0.0F) 'Rotation for LDView like viewing angle
        gl.Rotate(22.5, 1, 0, 1)                'Rotation for LDView like viewing angle
        gl.Translate(gradiusOfBoundingbox, 0, gradiusOfBoundingbox)
        DrawLines(gl)
      
        gl.Flush()

I am right with my thoughts how this should work and I have only a stupid thinking error, or is the behaviour different than I wrote above??

Any help is very welcome.
Reply
« Next Oldest | Next Newest »



Messages In This Thread
Re: Simple renderer in .net with SharpGL (openGL) - by Michael Heidemann - 2013-12-06, 17:30

Forum Jump:


Users browsing this thread: 2 Guest(s)