View Full Version : building a 2d Graph in opengl

03-22-2011, 01:15 AM

Can anyone show me how to go about creating a 2d graph in opengl. I am going to extract information from xml files and the use the information to create a graph. I have tried to find something, a tutorial maybe on how to make one but I cannot seem to find anything.

If possible could someone maybe direct me towards how to do it.

Thank you

03-22-2011, 06:49 AM
Do you wanna create a graph using OpenGL or just display a graph using OpenGL?

Looks like you're confusing of what OpenGL can or can't do.

03-22-2011, 07:34 AM
Basically I have information from an xml file and I want to display a graph with months on the bottom and user rating on the left with each value being plotted etc

03-22-2011, 07:59 AM
You'll need to set up an orthogonal projection, take a look at

glOrtho (http://www.opengl.org/sdk/docs/man/xhtml/glOrtho.xml)

03-22-2011, 02:21 PM
Thank you very much I'll look into it.

Incidentally can I ask, do you know how to set it up in Xcode4 for mac?

Thanks again

03-22-2011, 04:10 PM
I do not have experience with XCode, I use Eclispe in MacOS. But you just need to add the OpenGL framework.

03-22-2011, 04:54 PM
and how do you find using eclipse for c/c++?

03-23-2011, 07:13 AM
There is no big deal. Just download eclipse cdt c++ (http://www.eclipse.org/cdt/) and it is ready to use.

04-07-2011, 10:33 PM
Might be worth taking a look at http://www.codeproject.com/KB/openGL/OGLGraph.aspx

Whilst not a tutorial its an opensource graphing component for opengl which should give you some ideas about how to go about this. (Depends on your c++/opengl knowledge i guess)

Incidentally its lGPLv3 licensed