openGL in c# - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

openGL in c#

Hello,

I have some experience in openGL. I plan to deploy in C#. But is there any way to use it in C#? Specifically I want to have a nopenGL view control on my C# form without loosing the features of C# form. I found CsGL.BaseCode but it says I should have CsGL.BaseCode.dll. But I do not have it. I have CsGL bins CsGL.dll and CsGL.native.dll but not that. Is any one can send me an example related to my problem?

I will be so glad to hear for your feedbacks.

Comments

  • VanilleBertVanilleBert Posts: 29Member
    : Hello,
    :
    : I have some experience in openGL. I plan to deploy in C#. But is there any way to use it in C#? Specifically I want to have a nopenGL view control on my C# form without loosing the features of C# form. I found CsGL.BaseCode but it says I should have CsGL.BaseCode.dll. But I do not have it. I have CsGL bins CsGL.dll and CsGL.native.dll but not that. Is any one can send me an example related to my problem?
    :
    : I will be so glad to hear for your feedbacks.
    :

    You don't have to use CsGL.BaseCode. To create an OpenGL control, which can be placed into a form use the code below. OpenGLControl is the CsGL base class for a control providing an OpenGL viewport.

    [code]

    namespace OpenGL0
    {
    class OpenGLView : OpenGLControl
    {
    public OpenGLView()
    : base()
    {
    }

    public override void glDraw()
    {
    }

    protected override void InitGLContext()
    {
    }

    protected override void OnSizeChanged(EventArgs e)
    {
    base.OnSizeChanged(e);
    Size s = Size;

    GL.glMatrixMode(GL.GL_PROJECTION);
    GL.glLoadIdentity();
    GL.gluPerspective(45.0f, (double)s.Width / (double)s.Height, 0.1f, 100.0f);
    GL.glMatrixMode(GL.GL_MODELVIEW);
    GL.glLoadIdentity();
    }
    }

    public partial class MainForm : Form
    {
    OpenGLView MainView;

    public MainForm()
    {
    InitializeComponent();

    MainView = new OpenGLView();
    MainView.Parent = this;
    MainView.Dock = DockStyle.Fill;
    }
    }
    }
    [/code]
Sign In or Register to comment.