Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 2D graphics library suitable for graphing
Index -> General Discussion
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Insectoid




PostPosted: Sun Jul 31, 2011 3:13 pm   Post subject: 2D graphics library suitable for graphing

I'm working on a graphing program in C++ at the moment, and I'd like to find a suitable graphics library for drawing the graphs, after I finish writing the parser. Something really basic, that can draw lines and points similar to Turing's Draw commands (in fact, Turing's graphics are perfect, though I don't want to use Turing). I've worked with SDL, however afaik it hasn't got much support for drawing polygons more complicated than rectangles. I guess I could draw 2D vectors in OpenGL, but that seems like a huge amount of work for a small throwaway practice program. Google hasn't been much help.


Basically I want to draw lines and dots on an otherwise blank window.
Sponsor
Sponsor
Sponsor
sponsor
zero-impact




PostPosted: Sun Jul 31, 2011 3:56 pm   Post subject: Re: 2D graphics library suitable for graphing

Allegro has a very simple 2D graphics interface.

Qt is much more than a graphics library, it is an entire cross-platform application framework. It might be worth looking into if you are looking to create any sort of GUI. As well, it has very extensive 2D drawing capabilities, including support for OpenGL acceleration.
Insectoid




PostPosted: Sun Jul 31, 2011 4:24 pm   Post subject: RE:2D graphics library suitable for graphing

That actually looks excellent! And friendlier to game development later on than SDL!
mirhagk




PostPosted: Sun Jul 31, 2011 4:25 pm   Post subject: RE:2D graphics library suitable for graphing

I have to say that my favourite way to draw things I came across while working with assembly, sadly it only works on xp and earlier. Direct memory access was nice.,
Insectoid




PostPosted: Sun Jul 31, 2011 6:11 pm   Post subject: RE:2D graphics library suitable for graphing

@Zero-impact; I tried compiling alegro, but my compiler complained about a syntax error. I took a peek at the source and yep, they were trying to return true/false from a void function. I dunno about you guys, but I'm pretty sure you can't do that in C.
mirhagk




PostPosted: Sun Jul 31, 2011 7:02 pm   Post subject: RE:2D graphics library suitable for graphing

allegro's history is interesting, Shawn Hargreaves is one of the big shots with XNA, and has made countless tutorials about XNA. From that alone, I can tell you the library will be pretty good (judging from the quality of his tutorials).
zero-impact




PostPosted: Sun Jul 31, 2011 8:55 pm   Post subject: RE:2D graphics library suitable for graphing

Insectoid,

I don't know what could be causing that. I have only ever used the precompiled allegro libraries on windows.

I would be very surprised if there was a bug in allegro that prevented it from compiling. Maybe take a look at some getting started guides for your platform if there are any?
Insectoid




PostPosted: Sun Jul 31, 2011 11:41 pm   Post subject: RE:2D graphics library suitable for graphing

I dunno about that. This function (line 545 in allegro/src/opengl/extensions.c) doesn't quite look right to me.
code:
void *al_get_opengl_proc_address(const char *name)
{
   void *symbol = NULL;
#ifdef ALLEGRO_MACOSX
   CFStringRef function;
#endif
   ALLEGRO_DISPLAY *disp;
   
   disp = al_get_current_display();
   if (!disp)
      return false;

   if (!(disp->flags & ALLEGRO_OPENGL))
      return false;
}
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Mon Aug 01, 2011 11:28 am   Post subject: RE:2D graphics library suitable for graphing

Well, I talked to one of the Allegro devs, and yeah, it's an error (though when said dev tried compiling he didn't even get warnings...). Note that I was mistaken, the function returns a void pointer, which is completely different from returning void (I actually read up on void pointers a couple hours before trying to compile it). I do have an older version of Xcode though, so I'll be compiling it again once I download the newer version.

Bonus: I get credit for the svn commit!

EDIT: After a slight change in the code (returning NULL instead of false) it compiled and installed fine. So now when I get to that part of the project I can make use of it, and finally fully rid myself of any excuse at all to use Turing. Hopefully you guys will get to see the fruits of my efforts soon, but I'm working on 3 personal projects at the moment AND I'm really lazy so it might take a while. If one of my coding binges lasts longer than a day, I might finish a part of one of my projects.
zero-impact




PostPosted: Mon Aug 01, 2011 8:12 pm   Post subject: RE:2D graphics library suitable for graphing

Wow! Good catch! Smile
Display posts from previous:   
   Index -> General Discussion
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 10 Posts ]
Jump to:   


Style:  
Search: