Menu
Forums
Login | Register

Home > Forums > OpenGL ES > GlutCreateSubWindow pocketpc 2003 Page :  1 
GlutCreateSubWindow pocketpc 2003
Hi
I am trying to create multiple windows(different colors) using GLUTES and openGL ES and I am facing following problems:

1) My sub window size is 20x20 but the width/height values that I set have no effect on the sub window.
2)The color of my sub window is still black. The glClearColor does not change the color of sub window.
3)My sub window flickers.

There are lot of examples of creating multiple sub windows on main window but somehow none works on pocketpc emulator.

Code is as given below:
// variables representing the window size
float main_window_w = 240;
float main_window_h = 320;

float sub_window1_x = 70;
float sub_window1_y = 100;
#define SUBWIN_W_W 20;
#define SUBWIN_W_H 20;

float subwindow1_w = SUBWIN_W_H;
float subwindow1_h = SUBWIN_W_H;

void main_display (void)
{
/* Clean drawing board */
glutSetWindow (main_window);
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity ();
glClearColor(1.0, 0.0, 0.0, 1.0);
glutSwapBuffers();
}


void main_reshape (int width, int height)
{
subwindow1_w = SUBWIN_W_W;
subwindow1_h = SUBWIN_W_H;

// Set subwindow 1 as current window and then reposition and resize it
glutSetWindow (subwindow_1);
glutPositionWindow (sub_window1_x,sub_window1_y);
glutReshapeWindow (subwindow1_w, subwindow1_h);
glutSetWindow (main_window);
}

void subwindow1_display (void)
{
/* Clear subwindow */
glutSetWindow (subwindow_1);
// Set background color to blue
glClearColor(0.0, 1.0, 0.0, 1.0);
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Swap front and back buffers
glutSwapBuffers ();
}
//-------------------------------------------------------------------------
// SubWindow 1 Reshape Function.
//
// Preserve aspect ratio of viewport when subwindow is resized.
//-------------------------------------------------------------------------
void subwindow1_reshape (int width, int height)
{
glViewport (sub_window1_x, sub_window1_y, width, height);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
}

void redisplay_all (void)
{
/* Update main and sub window */
glutSetWindow (main_window);
glutPostRedisplay ();
glutSetWindow (subwindow_1);
glutPostRedisplay ();
}

void menu(int entry)
{
switch(entry)
{
case 1 : exit(0); break;
}
}

void main (int argc, char **argv)
{

/**** Main Window *****/
glutInit(&argc, argv);
glutInitWindowSize (main_window_w, main_window_h);
//glutInitWindowPosition (main_window_x, main_window_y);
glutInitDisplayMode (GLUT_RGB | GLUT_DOUBLE);
main_window = glutCreateWindow (window_title);
glutDisplayFunc (main_display);
glutReshapeFunc (main_reshape);
glutIdleFunc(redisplay_all);

glutCreateMenu(menu);
glutAddMenuEntry("Quit", 1);

glutAttachMenu(GLUT_LEFT_BUTTON);

/**** Subwindow 1 *****/
subwindow_1 = glutCreateSubWindow (main_window, sub_window1_x, sub_window1_y, subwindow1_w, subwindow1_h);

glutDisplayFunc (subwindow1_display);
glutReshapeFunc (subwindow1_reshape);

// Start GLUT event processing loop
glutMainLoop();
}


I would like to know if I am missing something in the above code or is it just the fact it does not work on pocketPC?

Thanks!
Rachna

Home > Forums > OpenGL ES > GlutCreateSubWindow pocketpc 2003 Page :  1 

You need to be logged in to reply to this topic.


All Rights Reserved, © Zeus Communications, Multimedia & Development 2004-2005

Read the Disclaimer

Links