473,804 Members | 3,021 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,C olinFahey'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 3067
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(S YSTEMTIME* SystemTime);
Unlike value types, classes always have at least one level of indirection.

[C#]
[StructLayout(La youtKind.Sequen tial)]
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("Kern el32.dll")]
public static extern void GetSystemTime(M ySystemTime 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,C olinFahey'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
3197
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 programs. To do this I need to draw pictures of the molecules, typically using OpenGL, and do some basic control, using some widget set. The code currently uses GTK, and runs on Macintosh OS X under Fink, and Linux. I would like to support the...
15
4548
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
1861
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. Regards Michael
3
2510
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
5227
by: Bad_Kid | last post by:
which is better for what?
0
3647
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 for VC++ application project // generated using an Application Wizard. #include "stdafx.h" #include <stdlib.h>
4
4130
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 engine. Now I'm looking to build a GUI in python with the rendering engine as an integrated window. I will most likely use wxPython for the GUI and I know it has support for adding an OpenGL canvas. After looking around in these groups and others it...
3
9997
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 OpenGL.GLUT import *
9
7509
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 some time now. I need a OpenGL context without restrictions and some settings dialogs. Is wx + PyOpenGL the way to go? Or could somebody recommend a better set of tools/libs?
3
3144
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 repaint 30 times every second (the usual framerate). Now i programmed a timer, which was able to wait for 30/1000 seconds. That happens in another thread, and after the delay (nanosleep, from the time.h header), it calls the paint() function. And...
0
9584
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10337
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10323
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10082
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9160
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6854
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4301
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3822
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2995
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.