tokano's picture

How to draw a 3D cube in openTK

Hello guys!

My head is burning because i cant figure out how to create a simple 3d CUBE inside the glcontrol...

My code is:

          GL.Color3(Color.White);
            GL.Vertex3(100, 100, -100);
            GL.Vertex3(-100, 100, -100);
            GL.Vertex3(-100, 100, 100);
            GL.Vertex3(100, 100, 100);
 
            GL.Color3(Color.White);
            GL.Vertex3(100, -100, 100);
            GL.Vertex3(-100, -100, 100);
            GL.Vertex3(-100, -100, -100);
            GL.Vertex3(100, -100, -100);
 
            GL.Color3(Color.White);
            GL.Vertex3(100, 100, 100);
            GL.Vertex3(-100, 100, 100);
            GL.Vertex3(-100, -100, 100);
            GL.Vertex3(100, -100, 100);
 
            GL.Color3(Color.White);
            GL.Vertex3(100, -100, -100);
            GL.Vertex3(-100, -100, -100);
            GL.Vertex3(-100, 100, -100);
            GL.Vertex3(100, 100, -100);
 
            GL.Color3(Color.White);
            GL.Vertex3(-100, 100, 100);
            GL.Vertex3(-100, 100, -100);
            GL.Vertex3(-100, -100, -100);
            GL.Vertex3(-100, -100, 100);
 
            GL.Color3(Color.White);
            GL.Vertex3(100, 100, -100);
            GL.Vertex3(100, 100, 100);
            GL.Vertex3(100, -100, 100);
            GL.Vertex3(100, -100, -100);

And the result is this picture:

http://postimage.org/image/7e7jxr7k7/

What i'm looking for is like here: http://www.youtube.com/watch?v=BXxylZMuqnU

Can anyone help me? I've got a few templates from TaoFrameowkr library, but they are just not the same.


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
devintelo's picture

Did you use GL.Begin(Beginmode.quads) and GL.End() ? Also , put your whole renering sub because this won't help anybody ...
And I think a distance of 100 might be big ...