Click here to Skip to main content
13,625,600 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
With data below,I would like to draw 3D shape using openTK within C# winform.

- theta(x) : 0 (degree) ~ 180 (degree) (1 degree per step)
- phi(y) : 0 (degree) ~ 359 (degree) (1 degree per step)
- value(z) : any values (per theta/phi), values of total : 181 x 360 = 65160

Please let me know example or how to draw 3D sphere using openTK?

What I have tried:

I have tried to draw 2D as below
private void button1_Click(object sender, EventArgs e)
{
GL.ClearColor(Color.LightGray);

int w = glControl1.Width;
int h = glControl1.Height;

GL.MatrixMode(MatrixMode.Projection);
GL.LoadIdentity();
GL.Ortho(0, w, 0, h, -1, 1); (0, 0)
GL.Viewport(0, 0, w, h);

GL.Clear(ClearBufferMask.ColorBufferBit
| ClearBufferMask.DepthBufferBit);

GL.MatrixMode(MatrixMode.Modelview);
GL.LoadIdentity();
GL.Color4(0, 0, 0, 50);

GL.Begin(BeginMode.Triangles);

GL.Vertex2(0, 0);
GL.Vertex2(50, 0);
GL.Vertex2(50, 100);
GL.End();
glControl1.SwapBuffers();
}
Posted 2-Jan-18 18:48pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web01 | 2.8.180712.1 | Last Updated 3 Jan 2018
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100