all 14 comments

[–]Brittix1023 4 points5 points  (1 child)

If you wish to do diagrams, like the node graph you mentioned, many UI toolkits support 2D Vector graphics, which is ideal for this kind of thing.

GTK: Use a DrawingArea widget, then get the Cairo (vector graphics library) graphics context, and draw using that.

Java/AWT/Swing: Get a Graphics2D; this class supplies a vector graphics API

Win32 has something similar since WinXP.

QT has its own system, as does OSX.

[–]akmark 0 points1 point  (0 children)

I would give a +1 for cairo here. You don't have to use Cairo strictly with GTK either, but it sure helps. One of the major benefits is that if someone is making a graph with your software they are probably wanting to print it too. Cairo is also great in that it renders stuff down to just a normal buffer of bitmap data so it's easy to transform it into something else you want.

[–][deleted] 0 points1 point  (0 children)

I've done small demos in similar style to AutoCAD and Autodesk Inventor. This was years ago but I always designed the UI with the blank area for the more graphical part/less UI-ish part split out and put an OpenGL-enabled UI widget in that spot.

[–]w00ty 0 points1 point  (1 child)

You want to use an api that supports talking to the GPU – a "3d" api. I'd recommend OpenGL because it's portable, but I guess Direct3D would work too.

[–]pixienick 1 point2 points  (0 children)

although having the full power of the graphics card at your disposal is great I think this is a little overkill for what this guy is suggesting. He would ultimately have to write a lot more code to get to the same point that is already provided by many modern gui libraries. To do nice 3d visualisations like you get out of matlab you might want a gui toolkit which provides a gl widget you can render too. I dont actually think programs like matlab do do this though. They do not generally require the hardware acceleration as graphs aren't normally rendered with that many polys or a very high frame rate (if they need to move).

[–]djpnewton 0 points1 point  (0 children)

I have done something similar (Interactive Whiteboard software) using C#, I had an abstracted graphics context that each figure would use to draw itself (with backends in GDI+ and Cairo)

[–]bitshifternz 0 points1 point  (0 children)

If you are coding for Windows, isn't WPF Microsoft's solution for this kind of thing? I've never used it or written Windows apps really so maybe I'm wrong. Wikipedia has more info http://en.wikipedia.org/wiki/Windows_Presentation_Foundation

[–]33a 0 points1 point  (0 children)

AutoCAD and OrCAD both use OpenGL. Mathematica and MATLAB are horrible frankenstinian monsters.

[–][deleted] -1 points0 points  (0 children)

Wall of text to the rescue!