
Up to date example on how to draw a line in a GameWindow?
Posted Monday, 8 October, 2012 - 07:06 by Xenland inI have been looking around the net for a working example of something simple I can play with, Drawing circles, triangle, lines, etc but I can't seem to find anything simple that works, I've tried some VB.NET examples and attempted to convert the code into C# with MonoDevelop, I tried a few other OpenTK examples I found from the tutorials area and only the rotating box one worked, Except that one was dealing with 3d and animation elements, and that’s a little ahead of my game to fooling around with that to make any progress with OpenTK. A thousand thank yous!
Also I have 0.1 Bitcoins for a tip-- if you are willing to accept Bitcoins.


Comments
Re: Up to date example on how to draw a line in a ...
Oh yeah so far My code is this with a GameWindow
Re: Up to date example on how to draw a line in a ...
Here's a simple one.
The real deal if you want to draw circle then you have to do it hardcore but if you're interested then I can write the drawing method.
Re: Up to date example on how to draw a line in a ...
This code worked great!
I see on my screen there are two lines going in an X pattern (I hope thats what was intended) I learned alot about programming I didn't know just from your simple example, For instance I noticed that you called the GameWindow into a Program() from inside of the Main() What is the terminology of this practice called so I can do more research on its' useage.
Also if you could be so kind to write a drawing Circle example?
All my knowledge is going towards my "Tutorials for Beginners By a Beginner" You see I am very knowledgeable with PHP, Actionscript 3 and Java but C# seems to be slightly different and I noticed there isn't any clear tutorials for C# users on Ubuntu Linux so I am writing up tutorials from Console printing, Networking, and Drawing.
I appreciate every bit of help thanks :) and I would love to link back to the original source of the information I got if that is an issue.
My tutorials will always be free and opensource: http://pipboy3000.com/list_tutorials.php?category=2
Re: Up to date example on how to draw a line in a ...
Hello, good idea to create tutorials so even more people could find OpenTK useful and learn it.
Here is an updated version
Note: By the moment I write this I think that the box drawing method could use a line loop instead to get better results, but see for yourself if you can actually modify it.
By instantiating a variable inside using, you can get more precise on how you want garbage collector to behave. You might not use it (it will work also without it), but it's a common practice in OpenTK (also you might see it file handling, or other data manipulation practices).
http://msdn.microsoft.com/en-us/library/yh598w02(v=vs.80).aspx
Another thing you might wonder why I instantiate the variable Program p, this is because Main() is static, static methods (every static method) can't communicate with the class they belong, they only communicate with other static members (properties/methods) as long as they are accessible.
Re: Up to date example on how to draw a line in a ...
That last code worked great as well too! Thanks, I can not wait till I get to the drawing parts of my tutorials section, this stuff is fun!