Graphing program

I have been working on a math parser that I wish to put to the test in a graphing program… Naturally, when I thought of graphics, I thought of OpenGL. I am having a tought time getting the domain and range to match up with the OpenGL window (Which is a window declared in a static image box on a dialog box.) The user of my wonderful program can enter the size of the domain and range much like a Ti graphing calculator, but much unlike a Ti graphing calculator, it doesn’t work. I thought I could do this with glViewport or something like that, but it didn’t work… any help would be greatly appreciated! Thanks!

First glViewport is the size of the rendering area, window or screen 320x 200, 640x480, etc. Most people use the size of the window set this.

But this is not the viewing area, in which openGL uses for world data.
Your gl world could be 1000 x 1000, but it will be rendered to the size of the view port.

The openGL view area is set with glOrtho or glPerspective.

example:
// view port set to 320 x 200
glViewPort(0,0,320,200);
// Our GL view is ortho mode, with a top corner -8, 8 and lower corner of 8, -8. with a depth of 30.
glOrtho(-8.0, 8.0, 8.0, -8.0, 1.0, 30.0);

Eventhough our gl view is a 16 x 16 unit area, it will be rendered to fix our 320x200 sized window.
And anytime we change the view port size, the only thing that will change about the scene will be the size in which it renders to.

So just figure what size world you want to work with and set it by glOrtho.

Originally posted by HairyBill:
I have been working on a math parser that I wish to put to the test in a graphing program… Naturally, when I thought of graphics, I thought of OpenGL. I am having a tought time getting the domain and range to match up with the OpenGL window (Which is a window declared in a static image box on a dialog box.) The user of my wonderful program can enter the size of the domain and range much like a Ti graphing calculator, but much unlike a Ti graphing calculator, it doesn’t work. I thought I could do this with glViewport or something like that, but it didn’t work… any help would be greatly appreciated! Thanks!