Opengl And Visual Basic .Net

Started by
1 comment, last by V-man 13 years, 3 months ago
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.
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
Advertisement
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

"What? It disintegrated. By definition, it cannot be fixed." - Gru - Dispicable me

"Dude, the world is only limited by your imagination" - Me

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.


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
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

This topic is closed to new replies.

Advertisement