Click here to Skip to main content
15,893,564 members
Articles / Multimedia / OpenGL

3D Solar System with OpenGL and C#

Rate me:
Please Sign up or sign in to vote.
4.91/5 (55 votes)
17 Apr 2013CPOL6 min read 199.9K   22K   64  
A demo of a solar system programmed in OpenGL and C#
In this article, you will see a simple 3D solar system implementation with OpenGL and C#. In the demo, you will learn how OpenGL rotation works and how to rotate a mesh around an arbitrary axis. You will also make use of the main OpenGL primitives: Point, Line and Triangles.
/* 
 *This code is property of Vasily Tserekh
 *if you like it you can visit my personal dev blog
 *http://vasilydev.blogspot.com
*/

using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

namespace SistemaSolar
{
    public struct Pointer
    {
        public int x;
        public int y;
    }

    public static class Winapi
    {
        [DllImport("GDI32.dll")]
        public static extern void SwapBuffers(uint hdc);
        [DllImport("user32.dll")]
        public static extern void SetCursorPos(int x, int y);
        [DllImport("user32.dll")]
        public static extern void GetCursorPos(ref Pointer point);
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

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


Written By
Software Developer
United States United States
Born on 86, had my first computer at the age of 8, wrote my first code at the age of 15(pascal), began to study software engineering at 2005 and graduated in 2010. I have a dev blog www.vasilydev.blogspot.com. My real passion is 3D game programming and playing guitar. I've programmed stuff in C#, python, Delphi, PHP, C++, JS, QT and others...

Comments and Discussions