Jump to content
  • Advertisement
Sign in to follow this  
V-man

Opengl And Visual Basic .Net

This topic is 2814 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!