Simple renderer in .net with SharpGL (openGL)

Re: Simple renderer in .net with SharpGL (openGL)
Thanks to all that gave input in this case Smile
Finally I got it to work (mostly wrong thinking in 3D was the error).

The last code is now:

Dim gl As New SharpGL.OpenGL
        gl = Me.OpenGLControl2.OpenGL



        gl.Viewport(0, 0, OpenGLControl2.Width, OpenGLControl2.Height)

        [s]gl.Perspective(CDbl(dblFOVgrad), CDbl(OpenGLControl2.Width / OpenGLControl2.Height), CDbl(0.1), CDbl(gradiusOfBoundingbox * 5))[/s]
        gl.Perspective(CDbl(dblFOVgrad), CDbl(OpenGLControl2.Width / OpenGLControl2.Height), CDbl(0.1), CDbl(gradiusOfBoundingbox + (gradiusOfBoundingbox / Math.Sin(dblFOVradian / 2))))

        'to see direct to the bounding box middle and push it back
        [s]gl.Translate(CSng(gmiddleofBoundingbox.X), CSng(gmiddleofBoundingbox.Y), CSng(-2 * gradiusOfBoundingbox))[/s]
        gl.Translate(CSng(gmiddleofBoundingbox.X), CSng(gmiddleofBoundingbox.Y), CSng(-1 * (gradiusOfBoundingbox / Math.Sin(dblFOVradian / 2))))

        gl.Rotate(180.0F, 0.0F, 0.0F)                     'correct -y
        gl.Rotate(45.0F, 0.0F, 1.0F, 0.0F)               'turn to see half of side
        gl.Rotate(22.5, 1, 0, 1)                              'turn to see a little bit from top


This code should work on all parts, as the dimensions of the parts are used for the values. I still need to test this, but I do not expect strange results.

After that I need to enhence the quality of the shown picture. I'll shurely come back with some questions. Smile

With the new lines each fov value between 1 and 90 will not destroy the view.
« Next Oldest | Next Newest »

Messages In This Thread
Re: Simple renderer in .net with SharpGL (openGL) - by Michael Heidemann - 2013-12-08, 10:46

Forum Jump:

Users browsing this thread: 2 Guest(s)