eriveraa's picture

Questions about the OpenTk library instead of Tao Framework

Hi community, i am new to this forum but i have searched a lot of things in this forum and i have some questions where i would like some guidance.

First of all, i have developed an utility for civil engineers called: Secciones (http://secciones.wordpress.com/2008/07/28/que-es-secciones/) that allows to calculate cross-section properties like Area, Inertia Moments, etc. That program was developed with VS2005 using Winforms and the external Library ZedGraph for the visualization of graphics in 2D.

ZedGraph is nice, it has some built-in functionality like panning, zoom with the mouse, but now i would like to see my cross-section in 3D (by extruding the 2d cross-section) with some perspective and the ability to have panning, zooming, rotating. So, i have these questions:

  • At beginning i choose Tao Framework, but doing some research i have found OpenTK that looks interesting and provides some high functionality i would use. My question is: How is OpenTk related with Tao Framework? what is the relation among them?. Does OpenTk depends on it?
  • My application need to show graphics inside the form (not the whole form area). I mean showing graphics in a graphic control that is inside my form. Is that possible? (please see the attached image of my program)
  • I need to allow the user to interact with the graphics for panning, zooming, rotating and select objects like points or lines. Is that possible?, are there any examples?
  • Is there a way to capture the graphic and put it in a report (using the printpreview control)?
  • I have found an interesting library called ILNumerics.Net, what is the relation with OpenTk?. Should i use it instead of OpenTk for my purposes? (some clarification will help me a lot!!)

I am really interested on using OpenTk but i need some answers and guidance.
Thanks.

AttachmentSize
Secciones.gif74.12 KB

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
objarni's picture

To show 2d/3d graphics in a Windows.Form using OpenTK, read this tutorial:

http://www.opentk.com/doc/chapter/2/glcontrol

Panning/zooming is also possible -- all ordinary mouse events are available for the GLControl.

the Fiddler's picture
  • At beginning i choose Tao Framework, but doing some research i have found OpenTK that looks interesting and provides some high functionality i would use. My question is: How is OpenTk related with Tao Framework? what is the relation among them?. Does OpenTk depends on it?
    They share the same "generator" code, but apart from this they are independent (but compatible) codebases.
  • My application need to show graphics inside the form (not the whole form area). I mean showing graphics in a graphic control that is inside my form. Is that possible? (please see the attached image of my program)
    Yes, using the GLControl. This works like a regular Windows.Forms.Control, meaning you can drag & drop it through the designer.
  • I need to allow the user to interact with the graphics for panning, zooming, rotating and select objects like points or lines. Is that possible?, are there any examples?
    Yes, this is possible. The GLControl generates regular input events (MouseDown, MouseClick, KeyDown, etc), which you can respond to.
  • Is there a way to capture the graphic and put it in a report (using the printpreview control)?
    Yes, the you can grab the contents of the GLControl to a bitmap for saving/printing.
  • I have found an interesting library called ILNumerics.Net, what is the relation with OpenTk?. Should i use it instead of OpenTk for my purposes? (some clarification will help me a lot!!)
    They are orthogonal, i.e. you can use ILNumerics.Net with OpenTK. The first provides numeric functions (integrals, matrices etc), while the latter (mainly) provides an interface to OpenGL. OpenTK.Math is smaller than ILNumerics.Net - just choose the one that covers the functionality you need.

Do note that you'll need to learn some basic OpenGL to use OpenTK, e.g. how to set up the projection matrix, draw lines, translate and rotate shapes. It is pretty simple once you get the hang of it - you might wish to check the Windows.Forms examples bundled with OpenTK for some sample code.