building a 2d Graph in opengl


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

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.

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

You’ll need to set up an orthogonal projection, take a look at


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

I do not have experience with XCode, I use Eclispe in MacOS. But you just need to add the OpenGL framework.

and how do you find using eclipse for c/c++?

There is no big deal. Just download eclipse cdt c++ ( and it is ready to use.

Might be worth taking a look at

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