Page 1 of 1

3D Graphics with OpenTK

PostPosted: Wed Oct 13, 2010 10:42 pm
by Charles
I have added a How To for OpenTK. It's in the workspace under the HowTo directory.

It gives you the basic compiler options, namespace references and minimal code to get going. The rest of the info for building something more substantial would be at http://opentk.com/.

Re: 3D Graphics with OpenTK

PostPosted: Mon Oct 18, 2010 11:25 am
by Charles
Now posted to the web site at:

http://cobra-language.com/how-to/OpenTK/

Re: 3D Graphics with OpenTK

PostPosted: Tue Mar 06, 2012 10:31 pm
by BrendanSimon
Any screen shots to show what some Cobra apps look like ?? I'm particularly interested in OS X, but also Linux and Windows too :)
Are you going to tell me that it will look like any other Tk app ??

Re: 3D Graphics with OpenTK

PostPosted: Tue Mar 06, 2012 11:34 pm
by Charles
Hmm, I don't have time right now. I'm moving this month and there's a DLL library bug that dwilliamii reported. I would encourage others in the Cobra community to run with the 3D and produce screenshots. :)

Re: 3D Graphics with OpenTK

PostPosted: Wed Mar 07, 2012 4:53 am
by BrendanSimon
No probs. Moving is a big pain !!

I downloaded OpenTK releases and ran xbuild. Also downloaed OpenTK trunk and r2780 and built. I can get the samples to run with "mono Examples.exe" but nothing gets drawn :( I'm on OS X 10.7.

When I tried wx.NET a while back, I found that an app bundle had to be created to get any of the GUI events to work (button clicks, etc). Did you do something similar with your test build on OS X 10.6 ??

I tried running the opentk.cobra program and got the following error:
$ cobra -lib:opentk-2010-10-06/Binaries/OpenTK/Release -ref:opentk-2010-10-06/Binaries/OpenTK/Release/OpenTK.dll opentk.cobra
The entry point method could not be loaded

I'm not a .net/.mono guy so I've probably missed some basic steps.

Thanks,
Brendan.

Re: 3D Graphics with OpenTK

PostPosted: Wed Mar 07, 2012 11:26 pm
by Charles
Regarding the lack of display for OpenTK, that sounds like an issue you'll have to take back to them. Maybe they don't support 10.7 yet?

I found the files where I was testing OpenTK with Cobra and Mac and Mono. They still run. I have packed them up:
http://cobra-language.com/downloads/cobra-opentk-2780.tgz

Unpack and cd into the directory and enter ./run and if everything is working, you should see a rotating, multi-colored triangle pop-up in a window.

My version info: Mac 10.6.8, Mono 2.10.6, Cobra svn:2628, OpenTK svn:2780

Re: wx, user "hopscc" did some work there including this wiki page here:
http://cobra-language.com/trac/cobra/wiki/WxWidgetsPort

Maybe he can chime in. I've been doing GUI work in GTK# because it's cross platform and seemed to have the most momentum/interest behind it among the various cross platform choices. I understand if you like native widgets though. :-)

HTH.

Re: 3D Graphics with OpenTK

PostPosted: Thu Mar 08, 2012 4:14 am
by hopscc
Ita a while since I did that fiddling with wx.Net ( on Windows- didnt do anything on OSX or Linux) but
Dont recall that there was anything needed additional to the build different from using any other .Net library
once cobras issues with recognising/using/working around the lowercase namespace name was corrected
( these showed up as cobra compilation errors wrt missing/unfound symbols - i.e an executable wasnt constructed at all)

Unfortunately I've not ever done anything with OpenTk on any platform so cant really help you there.

Generally though I've found that if cobra gets past compiling/building and the libraries are found at runtime the apps run correctly - If not its usually an issue with the libraries/linkage which also shows up in a simple representative C# program..

I'd try making a simple C# test app ( demo/example sample) and see if that (C# then cobra ) compiles and runs - if so port/convert it to Cobra language see if that also works.. If not try and work out whats different in build between the two (:-)
- see if higher levels of verbosity when compiling give any indication of a smoking gun.

( cobra -kif will build and emit the C# source for cobra source - you could examine that wrt a working C# sourcefile and compile that manually ( C# compiler) against the OpenTk library).

Re: 3D Graphics with OpenTK

PostPosted: Thu Mar 08, 2012 12:36 pm
by Charles
Also, when I use "cobra -kif" I often use "cobra -kif -turbo" because -turbo turns off contracts, assertions and null checks, resulting in simpler C# code for me to examine. Presuming of course that they are not the source of the issue, which they are usually not.

The wx naming issue was fixed a long time ago so need to worry about that.

Also, the OpenTK sample I provided does in fact include both the C# and Cobra versions of the program.