Reputation: 5446
Can anyone tell me if there is any function for changing size of glui window? Also do anyone have any idea about how to add scroll bars to glut window? Thanx in advance.
Upvotes: 2
Views: 4472
Reputation: 93410
You didn't specify the version you are using, but v2.2 comes with some examples. If you check example5.cpp and example3.cpp, you'll notice that a GLUI window is created on top of a GLUT window (see the code below):
int main_window = glutCreateWindow( "GLUI Example" ); // Creating GLUT window
// Setting up callbacks
glutDisplayFunc( myGlutDisplay );
GLUI_Master.set_glutReshapeFunc( myGlutReshape ); // Humm, this could be it!
GLUI_Master.set_glutKeyboardFunc( myGlutKeyboard );
GLUI_Master.set_glutSpecialFunc( NULL );
GLUI_Master.set_glutMouseFunc( myGlutMouse );
// Blah Blah to create objects and make it fancy
GLUI* glui = GLUI_Master.create_glui( "GLUI", 0, 400, 500 ); // Create GLUI window
glui->set_main_gfx_window( main_window ); // Associate it with GLUT
So it seems you have 2 options: the first, execute the callback myGlutReshape()
directly to see if it resizes the window (specified below):
void myGlutReshape( int x, int y )
{
int tx, ty, tw, th;
GLUI_Master.get_viewport_area( &tx, &ty, &tw, &th );
glViewport( tx, ty, tw, th );
xy_aspect = (float)tw / (float)th;
glutPostRedisplay();
}
or (the second), which is calling glutReshapeWindow()
to change the window dimensions (probably followed by glutPostRedisplay()) .
glutReshapeWindow( 800, 600);
glutPostRedisplay(); // This call may or may not be necessary
Notice that glutReshapeWindow()
is also executed by the callback, so this cold be the answer after all.
Upvotes: 3
Reputation: 3090
did you try glutReshapeWindow?
void glutReshapeWindow(int width, int height);
glutReshapeWindow requests a change in the size of the current window. The width and height parameters are size extents in pixels. The width and height must be positive values.
Upvotes: 3