473,499 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

OpenGL in VS with C#

I've be struggling for a few days to make Opengl work in VS using C#.

However, all wrappers I've stambled on(CsGL,
CsGL.Basecode,ColinFahey's wgl etc)
do not provide sufficient info on how to do it.They only give their
own classes and "high level" methods and for someone nwe to C# is
impossible to figure out how they do it.

Has anyone used OpenGL with C#?

What I want is to deploy a rendering context on any component I
like(even buttons, but a panel whould be sufficiet).
I can take the handle from the panel, but I dont understand how to
give this handle to the opengl , start the mainloop and play.
Any suggestions whould be highly appreciated.
Thanks in advance :)

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
Nov 16 '05 #1
2 3049
Hi,

you have to write a wrapper for all the OpenGL funcs.
I did it in C++.NET, because this is easier for me... This is actually
the world I grew up in.

This looks like this (excerpt from MSDN):

You can pass members of a class to an unmanaged DLL function, as long as
the class has a fixed member layout. The following example demonstrates
how to pass members of the MySystemTime class, which are defined in
sequential order, to the GetSystemTime in the User32.dll file.
GetSystemTime has the following unmanaged signature:
void GetSystemTime(SYSTEMTIME* SystemTime);
Unlike value types, classes always have at least one level of indirection.

[C#]
[StructLayout(LayoutKind.Sequential)]
public class MySystemTime {
public ushort wYear;
public ushort wMonth;
public ushort wDayOfWeek;
public ushort wDay;
public ushort wHour;
public ushort wMinute;
public ushort wSecond;
public ushort wMilliseconds;
}
class Win32API {
[DllImport("Kernel32.dll")]
public static extern void GetSystemTime(MySystemTime st);
}
Try wrapping some simple funcs and then go for Google and the MSDN
search for PInvoke. In the beginning this is hard to understand, but
after you have wrapped a couple simple API-Funcs this gets very clear. I
will post a fully functional Wrapper along with the source code and
dokumentation on my WebSite in a couple of weeks. At the moment I'm
stuck in two projects I have to finish by the end of next week.

Hope this provided some usefull information to you,
Regards,

Martin
pontifikas wrote:
I've be struggling for a few days to make Opengl work in VS using C#.

However, all wrappers I've stambled on(CsGL,
CsGL.Basecode,ColinFahey's wgl etc)
do not provide sufficient info on how to do it.They only give their
own classes and "high level" methods and for someone nwe to C# is
impossible to figure out how they do it.

Has anyone used OpenGL with C#?

What I want is to deploy a rendering context on any component I
like(even buttons, but a panel whould be sufficiet).
I can take the handle from the panel, but I dont understand how to
give this handle to the opengl , start the mainloop and play.
Any suggestions whould be highly appreciated.
Thanks in advance :)

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*

Nov 16 '05 #2
Well...thanks mate but this makes it more complicated.
I dont have good knowledge of C# and .Net, and the worse is that I
dont have time to aquire it :? :( .

I suppose I have to return to my existing QT implementation in
Linux(which is not bad but for some reasons I wanted to transfer it
to VS and C#) :?

Nevertheless , CsGL appears to be quite a potent wrapper, but it lacks
examples to show you the elementary,i.e Initialize->Begin
Loop->Draw.

In the only example I found(called BaseCode) the creator has
implemented his own classes based on CsGL and makes it even more
obscure.

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
Nov 16 '05 #3

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

Similar topics

9
3176
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
4508
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
1844
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
2496
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
5188
by: Bad_Kid | last post by:
which is better for what?
0
3629
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
4101
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
9969
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
7490
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
3128
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
7131
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7007
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
7174
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,...
1
6894
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...
0
7388
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4919
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4600
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3091
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
297
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.