
Visual Basic .NET
Posted Friday, 7 January, 2011 - 04:45 by vmelkon inI downloaded and checked the instructions, I looked into the documentation and did a few web searches. I'm still not clear on what I'm suppose to do.
I'm using what MS called the Development Environment 2003.
So where do I put the files so that it will recognize code like OpenGL.GL.glEnable(GL_xxxxxx).
Also, I'm getting the impression that OpenTK is for C# only.
Do I have to use Tao. Isn't Tao old?


Comments
Re: Visual Basic .NET
SwapBuffers is a member function of GLControl, i.e.
GLControl1.SwapBuffers().Re: Visual Basic .NET
Thanks
Re: Visual Basic .NET
Hi, it seems that Mike O is right.
If I try to setup the GL states in the initialization function, it crashes.
This is not good. In the C++ Win32 world, we had a WM_CREATE message which we could handle.
In VB.NET, is the only way to wait for resize to be called?
Private Sub GlControl1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles GlControl1.Resize
Re: Visual Basic .NET
Hook the 'Load' event of the *GLControl* and place your initialization logic there.
Alternatively, you could force the GLControl to be constructed, like this:
Which feels a little hacky.
Re: Visual Basic .NET
This one didn't work but I left it there anyway
glControl1.CreateControl()
Hooking into the control's Load worked. I'll keep this solution.
A thing I noticed is that one of my functions says the GL version is 2.1.
This is weird since the same code in C++ and also in VB6 says GL 3.3.
Is OpenTK returning a fake value?
I am not creating a context with that modern wglCreateContextARB in my C++ and VB6.
Re: Visual Basic .NET
Sorry, no idea.
OpenTK uses wglCreateContextAttribsARB if available and falls back to wglCreateContext if not. Maybe that's the source of the difference . You can see the code in Source/OpenTK/Platform/Windows/WinGLContext.cs.
Re: Visual Basic .NET
one of my functions says the GL version is 2.1.
Which function is that? In the code you posted anything below 3.0 is correct since you're requesting a non-3.x+ context.
Re: Visual Basic .NET
I guess something special is happening.
Re: Visual Basic .NET
Ok, so i came up with problems when i started to implementing the GlControl in a User Control.
Finally i got it work and i am posting the code.
Notes:
1. For some reason it seems better to inherit the glcontrol to a class and create in there your extra stuff
2. It seems also that the designer doesnt like a lot the new control soemtimes so i ended up adding the control programmatically. To have an idea of where it will be positioned, i use a panel to host it. So in my interface i see the panel in place of the new glcontrol
3. I am not a proffesional programmer and i luck a lot of knowledge. I hope i dotn have a lot of extra stuff and ugly stuff in my code.
4. You need:
1. A new class (aoGLControl.vb) that will inherit the glcotnrol
2. A form (Form1.vb) that will contain the new user control
3. A panel (Panel_aoGLControl_host) that will host the control
The code for the form is:
The code for the new class (aoGLControl.vb)
Sorry for the unnecessary comments.
It Works like a charm for the moment.
Best Regards