Pages

Monday, September 26, 2011

Small engine for opengl developers with c# sources

hello Ive been developing a small engine to work with opengl, its has only the basics functions such as opengl initialization, object and texture loading, a small aproach to collisions,a small sets of windows controls. It depends on tao framework an GLUT. I uploaded the entire VS2008 project hoping that anyone could use it an expand it.Also if you don't want to use it there is a lot of source code that yo can use. Almost every project of this blog use it. If you take a look at the code you will see that is very easy and understandable, for example take a lool at this initialization code


 mainForm = this;
           
            InitializeComponent();
            //id of the place I am going to draw
            hdc = (uint)this.Handle;
            //take an error if happens
            string error = "";
            //graphic window command initialization
            OpenGLControl.OpenGLInit(ref hdc, this.Width, this.Height, ref error);*

            if (error != "")
            {
                MessageBox.Show("There was an error initializing  OpenGl");
            }

            Lighting.SetupLighting(); 
            ContentManager.SetTextureList("texturas\\"); //specify location of textures (jpg, bmp, tga)
            ContentManager.LoadTextures(); //load it
           ContentManager.SetModelList("modelo\\"); // specify location of objects(3ds format)
            ContentManager.LoadModels(); //load it      


with this small code you initialize a graphic device context, load textures(png, bmp and jpg) and load all 3ds files that yo can call later on the application.

This is only an example of what you can do with this engine, I recommend it for anyone who really want to know what is underneath a lot of engines people use; and that serve of a starting point to those who want to make their own.  It is not complete but at least have the basics to get you ready. I encourage you to tell me your opinion in order to have feedback from you, anonymous commenting is enabled.


I tell again the download link only contains the engine (or graphic platform) the examples are the other entries of this blog
here is the download link, enjoy it
http://filebeam.com/cf2a471b9247a3cdfacda171986927a3

1 comment:

  1. Ok, men you will eventually have to make your own gui system, and that is sort of difficult. But the biggest challenge is to create a flexible architechture, try to make everything modular and to cut down dependencies between modules. If not you will have to find yourself rewriting at lot of code anytime you write a new functionallity. Spend some time reading about this. Also, when you create your own GUI you will have to adapt it to handle multiple resolutions.
    I can say also that skinned animation is kind of the holy grial of 3d programming, Also terrain following, scripting, the succesfully deploy of your apps will be hard to acomplish
    Thats all I can say for Now if you want to know more ask it here

    ReplyDelete