PDA

View Full Version : Making a second Window...



Carlop
04-20-2003, 07:45 PM
Heh..Hi it's me again...
Sorry to bother you all again, but, once more, I have a question...

I was wondering if it's possible to create a second window in OpenGL? Well, technically, it would be the first to run...Since it would be the window where the user inputs his initial settings, then it would start up a new OpenGL window with the animations...

I don't really care what type of window it is, it could even be the normal black and white console window, as long as the user could input or just "cin" his values.

I was thinking of maybe chaning my program to run in GLUT cause it seems like starting a console window is alot easier(though i cant find a way to cin, since it gives errors when i try that)...

If all else fails, i was thinking of two different programs, one normal program to enter values, which would write to a file, then the other would read it once it would start up...But i dont think my teacher would like that...

Any suggestions?

nexusone
04-21-2003, 10:43 AM
Yes you can create multiple windows with GLUT.
And you can dictate which window has keyboard functions.


Originally posted by Carlop:
Heh..Hi it's me again...
Sorry to bother you all again, but, once more, I have a question...

I was wondering if it's possible to create a second window in OpenGL? Well, technically, it would be the first to run...Since it would be the window where the user inputs his initial settings, then it would start up a new OpenGL window with the animations...

I don't really care what type of window it is, it could even be the normal black and white console window, as long as the user could input or just "cin" his values.

I was thinking of maybe chaning my program to run in GLUT cause it seems like starting a console window is alot easier(though i cant find a way to cin, since it gives errors when i try that)...

If all else fails, i was thinking of two different programs, one normal program to enter values, which would write to a file, then the other would read it once it would start up...But i dont think my teacher would like that...

Any suggestions?

Carlop
04-22-2003, 06:14 PM
Yea..I just converted all my code to glut...

one question though...I need an hDC and hWnd value for a font creation function...
In normal OpenGL hWnd was given a value when youd pass CreateGlWindow(..)...and hDC was based on hWnd...except in glut, its a totally different way to create a window...

How can i get, or substitute these values?

Carlop
04-22-2003, 07:42 PM
Uh...and another thing:
WHat does this mean?

GLUT: Warning in C:\Project\Debug\Project.exe: The following is a
new check for GLUT 3.0; update your code.
GLUT: Fatal Error in C:\Project\Debug\Project.exe: redisplay neede
d for window 1, but no display callback.
Press any key to continue


this is in brief what my main function is:




glutInit(int param1, char **param2);
int h=480;
int w=640;
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);

glutInitWindowSize (w, h);
glutInitWindowPosition (0, 0);
glutCreateWindow("Bleh");


glutInitWindowSize (200, 200);
glutInitWindowPosition (500, 500);
glutCreateWindow("Info");
glutDisplayFunc(Render2);


glShadeModel(GL_SMOOTH); glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbient);
glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuse);
glLightfv(GL_LIGHT1, GL_POSITION,LightPosition); glEnable(GL_LIGHT1);
glEnable(GL_TEXTURE_2D);
LoadGLTextures();
BuildFont();
glMatrixMode(GL_PROJECTION);

glutDisplayFunc(RenderScene);
glutKeyboardFunc(Input);
glutSpecialFunc(Input);

gluPerspective(45, (GLfloat)w/(GLfloat)h, 1.0, 450.0);
glMatrixMode(GL_MODELVIEW);
glutMainLoop();



I get that message when i run this...
Now, If i run it, with my Second Window Initialized first, it works...the window with the animation has the animation, but the smaller one has nothing...really nothing...it's actually transparent-like...

Any ideas?

[This message has been edited by Carlop (edited 04-22-2003).]