Hi, I'm new with VB. NET but I have been using GL and C++ for 10 years.
I installed OpenTK. The thing is that VB .NET can't compile my code because it says it can't recognize SwapBuffers.
Can some tell me what I need to #include?
Or perhaps a sample project, an example, anything at all.
Thanks in advanced.
PS : I'm using Visual Studio 2010 Express.
Opengl And Visual Basic .Net
1. Have you added OpenTK as a reference?
2. You say it doesn't recognize 'SwapBuffers', of what class?
3. You did add a statement like 'Imports OpenTK' ?
3. Could you show us the code? this might help us.
assainator
2. You say it doesn't recognize 'SwapBuffers', of what class?
3. You did add a statement like 'Imports OpenTK' ?
3. Could you show us the code? this might help us.
assainator
The code is short since I just started.
"2. You say it doesn't recognize 'SwapBuffers', of what class?"
I come from a C++, VB6, Win32 API, MFC, OpenGL. SwapBuffers is a windows API function. It is in gdi32.dll
I don't know how things are done in VB.NET, that's why I ask.
"2. You say it doesn't recognize 'SwapBuffers', of what class?"
I come from a C++, VB6, Win32 API, MFC, OpenGL. SwapBuffers is a windows API function. It is in gdi32.dll
I don't know how things are done in VB.NET, that's why I ask.
Imports OpenTK
Imports OpenTK.GLControl
Imports OpenTK.Platform
Imports OpenTK.Graphics.OpenGL
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub GlControl1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles GlControl1.Paint
GL.Clear(ClearBufferMask.ColorBufferBit Or ClearBufferMask.DepthBufferBit)
GL.Begin(BeginMode.Quads)
GL.Vertex3(-1.0F, -1.0F, 1.0F)
GL.Vertex3(1.0F, -1.0F, 1.0F)
GL.Vertex3(1.0F, 1.0F, 1.0F)
GL.Vertex3(-1.0F, 1.0F, 1.0F)
GL.End()
SwapBuffers()
End Sub
Private Sub GlControl1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles GlControl1.Resize
'Dim glrc As HGLRC
'glrc = wglGetCurrentContext()
ResizeGL()
End Sub
Private Sub ResizeGL()
GL.Viewport(0, 0, GlControl1.Width, GlControl1.Height)
GL.MatrixMode(MatrixMode.Projection) ' Select The Projection Matrix
GL.MatrixMode(MatrixMode.Modelview) ' Select The Modelview Matrix
GL.LoadIdentity() ' Reset The Modelview Matrix
End Sub
End Class
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement