Shell + OpenGL window

I did a class which contains simulation data.
I’d like to create a main which first opens a shell (i ll put my simulation parameters in it),
then creates an OpenGL window drawing the results.
I used some tutorials about opengl and I ve been able to draw some objects etc… But I still don’t know how to use class methods in the main
using cout or cin for example (need a shell).
I realy don’t know if i must use glu, glut, or glui, i’m realy lost among them.

I guess you’ll need glut (or freeglut). GLU is just a set of helpful functions, and GLUI is for creating user interface inside OpenGL window (buttons, lists, etc. are drawn using OpenGL).

Yes i thought so, but even using it I still don’t know how to do…
The main I use at the moment is :
int main( int argc, char *argv[ ], char *envp[ ]
found in a tutorial, it works for opening an opengl window but not for what i want as described lately.

If I understood correctly, you arguments to the simulation HAVE TO be treated inside argv. AFAIK I don’t know extra new exotic parameters to add to main.

For the rest, can you be more precise ? In fact I don’t really understand.

I’m sorry. I’m c++ beginner and my english isn’t very good.
Actualy I want to make a .exe which first opens a shell, in it i’ll put some parameters ( cin >> ).In the main i need to use some class methods dealing with the parameters.
Then an opengl window appears. Drawing what is in some privates of the class.
But I think I just managed to do this.
In the tutorial in foud, you’re told to create a windows application project. I tried to create a project shell application (by the way i use dev-cpp), and it seems to work. I know have a shell and then an opengl window. I’m not sure at the moment, but thanks anyway. I’ll ask again if that way isn’t ok.

Hum actualy it doesn’t seem to work.
There is the file, maybe it will be clearer.
This works, but if i use cubic cube; and cubic cube.saisir(); , the .exe fail (but compilation is still ok)

#include <cstdlib>
#include <iostream>
#include <gl/glut.h>
#include <cubic.h>
using namespace std;

int WindowName;

void Reshape(int width, int height)

void Draw()



int main(int argc, char *argv[])
//cubic cube;
//cubic cube.saisir();


glutInit(&argc, argv); 

WindowName = glutCreateWindow(“OpenGL Window”);



 return EXIT_SUCCESS;       


Try to debug your program, it looks more like an error from within your class. This kind of code is expected to work.

Yes as shown it works, but when cubic cube; and
cube.saisir(); are on, the program fails, even if i debug. The class is ok, i tried it in another program without opengl.

You were right jide, it seems like there were too much private in the class, thanks a lot.
The problem now (not directly related to the topic), is I don’t know how to put some class data (from methods) in the drawing function.
For example in order to draw, I’d like to put ‘Dx’ as a coordinate for a vertex, and I get it thanks to the method ‘cube.getDx’ .
But it looks like class methods are not recognized in Draw() (they are in the main now),
and I don’t think the function allows parameters.
Any idea ?

Thanks for answers.

What you actually need is to learn about what programmation is, about your programming language and surely other things (maths…). This will definately help you A LOT.

Unfortunately this forum is not dedicated to that. If I don’t tell you that, others will.
There are many sites that might help you. Or best, buy a book. Have a look at Amazon for that (or Eyrolles as it seems you’re french).

But for your conveniencies, until you have your books, here is a hint:

cubic cube;

should be declared global and before any other functions.

Ok sorry, thanks anyway.