Existing OpenGL program
Alright, I'm a serious nuub, so please tolerate a few stupid questions.
I have a program that currently uses OpenGL. I can get every other part of the program to run in mono, until I try an d enable the part that uses OpenGL and I crash to command line with the "Unhandled Exception: System.EntryPointNotFoundException: GetDC" error.
My question is:
Is there anyway to get my program to use these (OpenTK) binaries to utilize the existing OpenGL code? I'm running Ubuntu 8.04 with mono 1.2.6 (from repos).
The program I use, I compile in windows and then transport the entire directory structure to linux and run the main execute in mono. I can see all the existing OpenGL dlls and I just need to know if I have to rewrite the code to point to the new dlls or if I can 'insert' the OpenTK dlls somehow into the mono libraries. *shrug* I'm too much of a newbie to even know if this is a stupid question so let me know please :-)
A. Black




Comments
Jun 25
21:45:16Re: Existing OpenGL program
posted by the FiddlerUnhandled Exception: System.EntryPointNotFoundException: GetDCOuch, this means platform detection in OpenTK is messed up pretty badly - it is trying to use Windows-specific (GetDC) code on Linux. Can you please check the what
OpenTK.Configuration.RunningOnWindowsandRunningOnLinuxreturn on each platform?You're probably not doing anything wrong (OpenTK supports using Windows binaries on Linux or vice versa - in fact I do this quite often when developing).
Jun 25
22:39:02Re: Existing OpenGL program
posted by arawnblackWell first off let me make sure I'm clear. The example.exe works just fine.
I will post those two requests of yours after I get back into the office.
I got the OpenTK source to compile on ubuntu, and deposited those dlls and config files into the program directory I copied from windows. That is what returns the GetDC error, which is the same error I get if I just use mono without OpenTK.
I really suspect that it failed to compile on my system correctly, or I'm not utilizing the dlls that are produced from the compile correctly, though as I said the example.exe works just fine. The program I am using was coded in with OpenGL alone; I've searched through the forums and documentation and I believe all I need to do is drop the binaries in the execution directory and run mono. Do I need to add them to my mono libraries somewhere or is it as you say and its about platform detection?
I understand that GetDC error is a winapi thing and thus means its trying to execute (Device Call?) which is not supported in linux, I guess I just want to know first if I installed the thing correctly :-)
As I said I will check OpenTK.Configuration.RunningOnWindows and RunningOnLinux return either later tonight or first thing tomorrow.
Feel free to post specific questions, and don't assume I know what I'm talking about heh, Thanks for your time and attention btw
A. Black
Jun 26
05:45:47Re: Existing OpenGL program
posted by objarniThe program I am using was coded in with OpenGL alone;
What exactly do you mean by this..? What is "OpenGL alone" in C#/mono? As far as I know, neither mono nor .NET includes the OpenGL API..
Jun 26
14:46:20Re: Existing OpenGL program
posted by arawnblackThe program was written in windows using OpenGL in C#, all of its calls currently point towards the Tao.OpenGL.dll and Tao.Platform.Windows.dll.
Jun 26
17:51:00Re: Existing OpenGL program
posted by the FiddlerAhem, Tao != OpenTK :)
This aside, it looks like you are trying to use Tao.Platform.Windows on Linux - and this just won't work (that's why the GetDC call fails).
You are using Windows.Forms, right? In that case, you can swap Tao.Platform.Windows.SimpleOpenGlControl (which is Windows-only) with OpenTK.GLControl (which is cross-platform). You'll need to make some minor alterations in your code (remove simpleOpenGlControl1.InitializeContexts() and search & replace all SimpleOpenGlControl references with GLControl), but most of the code will remain intact (i.e. you can keep using Tao.OpenGl).
Do backup just in case, though!
For the record, OpenTK is something like Tao.OpenGl, Tao.OpenAl, Tao.Platform.Windows and Tao.Platform.X11 combined, with some extra functionality (fonts, input and general utility functions). This is a simplification of course, as OpenTK bindings are closer to C# than Tao bindings, but both projects share code - which is why you can mix OpenTK.GLControl with Tao.OpenGl, for example.
Jun 26
18:08:37Re: Existing OpenGL program
posted by arawnblackAh that makes perfect sense, so if I swap out the code the program will still run natively in windows? I just have to download and reference the OpenTK dll in the code and it will compile correctly? (in theory anyway, I understand we are pre-version 1.0)
Excellent, I'll get working on that immediatly. Thank you for your help I will post results when I get that done.
Jun 26
19:40:32Re: Existing OpenGL program
posted by arawnblackIs 'OpenGLWinFormsControl:Control ' supported under OpenTK?
Jun 26
19:47:03Re: Existing OpenGL program
posted by arawnblackand (don't worry this is an open source program)
how should I deal with this one: Does OpenGLWinFormsControl work? or should that be replaced as you said to with the simple version?
public partial class GraphicalToothChartControl:CodeBase.OpenGLWinFormsControl{//.SimpleOpenGlControl
Jun 26
20:09:32Re: Existing OpenGL program
posted by the FiddlerOpenGLWinFormsControl: sorry, but this is the first time I've heard of this!
What OpenTK.GLControl does, is allow you to create an OpenGL "window" inside a WinForms application. This is what SimpleOpenGLControl does and this is probably what OpenGLWinFormsControl does, too. In other words, OpenTK.GLControl *should* be able to replace that. Worth a try, anyway.