Simple renderer in .net with SharpGL (openGL)

Re: Simple renderer in .net with SharpGL (openGL)
Yes, that is what I also thinking about. But there needs to be another thinking error. I have to check with a lot of coffee this morning Smile

Here is my current code (I see - nothing), that I now explain:
loadidentity - set the current matrix (Projection) to start modus
viewport - is the 2d window that should be used (left bottom corner at 0,0 and upper right corner from control width and height)
perspective (field of view in radian, ratio, znear, zfar) - for zfar I use two times the radius of the bounding box.
frustum (left, right, bottom, top, znear, zfar) - for left, right, bottom, top I use the radius of the bounding box, zfar like above.
Then I switch to the modelview and start with a fresh matrix.
The only transformation now is with the lookat matrix
lookat (eyex,eyey,eyez,centerx,centery,centerz,upx,upy,upz)
        gl.Viewport(0, 0, OpenGLControl2.Width, OpenGLControl2.Height)
        gl.Perspective(CDbl(fov), CDbl(OpenGLControl2.Width / OpenGLControl2.Height), CDbl(0.1), CDbl(2 * gradiusOfBoundingbox))
        gl.Frustum(CDbl(gradiusOfBoundingbox + 100), CDbl((gradiusOfBoundingbox + 100) * -1), CDbl((gradiusOfBoundingbox + 100) * -1), CDbl(gradiusOfBoundingbox + 100), CDbl(0.1), CDbl(2 * gradiusOfBoundingbox))


        gl.LookAt(CDbl(0), CDbl(0), CDbl(0), CDbl(0), CDbl(0), CDbl((gradiusOfBoundingbox / Math.Sin(fov / 2)) * 2), CDbl(0), CDbl(-1), CDbl(0))



Where is my error??
« Next Oldest | Next Newest »

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

Forum Jump:

Users browsing this thread: 1 Guest(s)