new to open GL - drawing 2d chart with GLUT and C

Hi there,

I am relatively new to openGL and would like some help getting started with what i am trying to do.

Basically in the language C i wish to create a very simple bar chart with the GLUT library functions. The chart will ned to be drawn from a variable who’s values are seperated by commas.

e.g. the variable might be something like this:

graph = “10,20”

I’d need the Y axis to go up to the highest number and the x axis to cater for the amount of elements within the variable which are split up by commas.

Does anybody have a simple example of how to create a 2d graph in C using GLUT?

I know that there’s many tutorials out there for drawing in openGL but one specifically for drawing graphs would be good.

If anybody can make a simple tutorial up or perhaps post a possible solution to what i have asked then that would be great. But as i say, i have a variable and i wish it’s values separated by commas to be displayed in a graph. Each element from the split will be a bar in the graph and the labels for axis don’t matter too much.

Again, just to mention, this is for C and not C++. Any good recommendations are apprechiated


Option 1:
Learn to do it without OpenGL and come back if you have any OpenGL related problems. A general C forum sounds like a good place to start.

Option 2:
Send me money and I will do it for you. But a C program will be more expensive than C++.

Option 3:
Wait and pray that another forum user is stu… I mean nice enough to do your work for you.

Option 4:
Tell us what you have achieved and what your current problem is. If it is OpenGL related you will get an answer, if not back to Option 1, 2 or 3.

Free gift:

happy coding

Hi there,

Well i do feel that you’re being a bit harsh there considering this is a part of the forum for “beginners”, we all have to start somewhere.

I have looked around the net for chart examples but a lot of them just lead to drawing shapes. Rather than working out what should be drawn etc. i was after an example using the glut library functions that draw a graph which i could work through instead of doing it all manually and figuring it out by drawing shapes, obviously i’ll have to keep looking or alternatively start by drawing shapes and making one by figuring out how to bodge shapes/lines together manually.

Anyways thanks for the input

I don’t think so.

Yes, for OpenGL beginners.

For you a good place to start would be the link I gave you. Much to read but it will help you enormously in the long run. You will learn why your first post was not smart at all. And reading this will tell you why your second post was not very clever either.

I don’t comment on this to not embarrass you even more.

Sounds good to me. If you have any problems with the drawing search the web for the mysterious NeHe and you will find enlightenment. If the great NeHe cannot help you come back and we will be glad to do so.

Your welcome. But beware, perhaps I will be harsh the next time, just to show you the difference. :wink:

You probably have solved or forgotten about this, but I found resource here which may be useful.

By the way, I agree the other response you got was unhelpful and rude.