473,395 Members | 1,584 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

OpenGL in VB .NET

Hello,

I wonder if there's a way to use OpenGL directly from VB .NET, without any
C++ code, or CsGL library. I've tried to convert NeHe's first tutorial
(http://nehe.gamedev.net/data/lessons....asp?lesson=01) to VB .NET, but
it seems to behave improperly somewhere in this fragment:
~
PixelFormat = ChoosePixelFormat(hDC, pfd)

If PixelFormat = 0 Then

MessageBox(0, "Can't find a suitable PixelFormat.", "Error", MB_OK Or
MB_ICONERROR)

PostQuitMessage(0)

Exit Select

End If

If SetPixelFormat(hDC, PixelFormat, pfd) = 0 Then

MessageBox(0, "Can't set PixelFormat", "Error", MB_OK Or MB_ICONERROR)

PostQuitMessage(0)

Exit Select

End If

hRC = wglCreateContext(hDC)

~

In WinME, ChoosePixelFormat returns 0.

In WinXP, ChoosePixelFormat returns 5; but the trouble is with
SetPixelFormat: it returns 1, but actually it does nothing, because
wglCreateContext returns 0 with error code 2000 (invalid pixel format).

Any suggestions? Maybe there is another OpenGL example in VB .NET only?

Thanks in advance.
Nov 21 '05 #1
4 10043
You really should use DirectX. It takes full advantage of the GPU, and
in will work a lot better.

Nov 21 '05 #2
I'd use the Tao Framework. It really is the best wrapper for OpenGL.

But if for whatever reason you don't want that, then see also Colin
Fahey's wrapper:
http://www.colinfahey.com/opengl/csharp.htm
which just consists of 6 C# files that you include with your sources.
You'd have to translate his source files into VB.NET. Maybe you can
use one of those online C# to VB translators to help make that easier.

And like the other person said, there is always Managed DirectX, too.

Nov 21 '05 #3
<do****@gmail.com> schrieb:
I'd use the Tao Framework. It really is the best wrapper for OpenGL.

But if for whatever reason you don't want that, then see also Colin
Fahey's wrapper:
http://www.colinfahey.com/opengl/csharp.htm
which just consists of 6 C# files that you include with your sources.
You'd have to translate his source files into VB.NET. Maybe you can
use one of those online C# to VB translators to help make that easier.


Some more wrappers:

Using OpenGL in .NET applications
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=opengl&lang=en>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 21 '05 #4
Ahh, thanks you all.

It seems that I finally made my code work. However, I got a very weird
error. At the beginning, it asks about running in fullscreen mode. If you
say "no" it spits an error message. On WinXP, it says "Can't Create A GL
Rendering Context.", and error code is 2000. But on 98 and ME systems, error
is "Can't Find A Suitable PixelFormat." (error code 126)! But... if you
choose yes, it sets up fullscreen mode and runs fine, and then if you press
F1 to change mode, it switches back to window and keeps running without any
problems!

I attached my code. If someone pointed me at my mistake, I would be very
grateful.

Thanks
Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Rick Muller | last post by:
I have a problem that I would like to get some advice on from other Pythonistas. I currently manage a (soon to be) open source project for displaying molecular graphics for a variety of different...
15
by: oracle411 | last post by:
Hi I'm new to OpenGL, but have an OpenGL application written in CPP that I would like to display on a web browser. Was wondering how this could be done? Thank you very much
2
by: Michael Sgier | last post by:
Hi OpenGL in VC7. I get errors with the default include gl file. Which and where to get working OpenGL files? I also get errors with glfunctions in Kdevelop. Any help here? Thanks indeed....
3
by: john townsley | last post by:
Hi I want to do some OpenGl stuff with c++ on a winXP (home) machine. I have Borland c++ 5, MVS c++ 5 What C++ do you recommend (any others?)and where do you get the OpenGL stuff. thanks
10
by: Bad_Kid | last post by:
which is better for what?
0
by: Scott Chang | last post by:
Hi all, I tried to use Managed C++ coding of VC++.NET (2002)and OpenGL version 1.2 to draw a hexagon shape of benzene. My OpenGLdrawBenzene.cpp is the following: // This is the main project file...
4
by: tobfon | last post by:
I'm creating a scientific visualization application with rather high demands on performance. I've created a nice rendering engine for it in C++/OpenGL and a python interface to the rendering...
3
by: jg.campbell.ng | last post by:
I'm beginning learning Python and OpenGL in Python. Python fine. But difficulties with OpenGL; presumably with the installation of OpenGL. OS = Linux FC5. Python program gl_test.py: from...
9
by: Achim Domma | last post by:
Hi, I'm developing a GUI app in Python/C++ to visualize numerical results. Currently I'm using Python 2.4 with wx and PyOpenGLContext, but there are no windows binaries for Python 2.5 for quite...
3
by: Leon | last post by:
Hey, i am trying to develop a game, and I am using OpenGL and pthread. (on Ubuntu, so i also use the X library.) Now i have a problem. I have initialized OpenGL in the main thread, and i want to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.