Piszę program który będzie miał dwa okna w jednym jest scena w drugim treść kodu potrzebny do utworzenia danego efektu. Niestety mam problem z menu kontekstowym, scena rysuje mi się od razu z wypełnieniem zamiast bez i po kliknięciu w menu(lewym przyciskiem na lewym oknie scena dalej się nie zmienia do szkieletu)
Nie wiem jaki mam błąd, czego mi brakuje.

Robię to w Opengl 3.3 w wersji rdzennej, dlatego dodaje dodatkową biblitekę szaderów i macierzy

#include <GLTools.h>	// OpenGL toolkit
#include <GLMatrixStack.h>
#include <GLFrame.h>
#include <GLFrustum.h>
#include <GLBatch.h>
#include <GLGeometryTransform.h>

#define FREEGLUT_STATIC
#include <GL/glut.h>

GLShaderManager		shaderManager;
GLMatrixStack		frameProjectionMatrix;
GLMatrixStack		projectionMatrix;
GLMatrixStack		modelViewMatrix;
GLFrustum			frameFrustum;
GLFrame             viewFrame;
GLFrustum			viewFrustum;
GLuint window, world, command;
GLBatch				floorBatch;
GLGeometryTransform	transformPipeline;

int rzutow=2,wsc=1;


void MakeFloor(GLBatch& floorBatch)
	{
	GLfloat x = 50.0f;
    GLfloat y = -10.0f;

	floorBatch.Begin(GL_TRIANGLE_FAN, 4, 1);
		floorBatch.Vertex3f(-x, y, x);
		floorBatch.Vertex3f(-x, y, -x);
		floorBatch.Vertex3f(x, y, -x);
		floorBatch.Vertex3f(x, y, x);
	floorBatch.End();
	}

void RenderFloor(void)
	{

	
	GLfloat vRed[] = { 1.0f, 0.0f, 0.0f, 1.0f};
	glEnable(GL_BLEND);
	glEnable(GL_LINE_SMOOTH);
	if(wsc=1){
			shaderManager.UseStockShader(GLT_SHADER_FLAT, transformPipeline.GetModelViewProjectionMatrix(), vRed);
			glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
			floorBatch.Draw();}
	if(wsc=2){
			shaderManager.UseStockShader(GLT_SHADER_FLAT, transformPipeline.GetModelViewProjectionMatrix(), vRed);
			glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
			floorBatch.Draw();
	}
	}

void WorldRenderScene(void)
	{
	
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	modelViewMatrix.PushMatrix(viewFrame);
	RenderFloor();
	modelViewMatrix.PopMatrix();
	glutSwapBuffers();
	}

void redisplay_all(void)
{
    glutSetWindow(command);
    glutPostRedisplay();
    glutSetWindow(world);
    glutPostRedisplay();
}

void MainChangeSize(int width,  int height) 
{
    glViewport(0, 0, width, height);
	frameFrustum.SetOrthographic(0,(width), (height),0,0,0);
	frameProjectionMatrix.LoadMatrix(frameFrustum.GetProjectionMatrix());
    
    glutSetWindow(world);
    glutPositionWindow(10, 10);
    glutReshapeWindow(width/2-20, height-20);
    glutSetWindow(command);
    glutPositionWindow(10+width/2-10, 10);
    glutReshapeWindow(width/2-20, height-20);
}

void main_display(void)
{
    glClearColor(0.5, 0.5, 0.5, 0.0);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glutSwapBuffers();
}

void command_display(void)
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    
    glClearColor(0.0, 0.0, 0.0, 1.0);
   
    glutSwapBuffers();
}

void commandChangeSize(int width, int height)
{
    glViewport(0, 0, width, height);
	
}

void WorldChangeSize(int w, int h)
	{
	glViewport(0, 0, w, h);
	if(h==0) h=1;
	if (rzutow=2)	{viewFrustum.SetPerspective(35.0f, float(w) / float(h),1.0f, 300.0f);}
	else
	{viewFrustum.SetOrthographic(-100.0f,100.0f,-100.0f,100.0f,-100.0f,100.0f);}

	projectionMatrix.LoadMatrix(viewFrustum.GetProjectionMatrix());
	transformPipeline.SetMatrixStacks(modelViewMatrix, projectionMatrix);
	}


void SetupRC()
	{
	glutSetWindow(world);
	shaderManager.InitializeStockShaders();
	glClearColor(0.0f, 0.0f, 0.0f, 1.0f );
	glEnable(GL_DEPTH_TEST);
	glLineWidth(2.5f);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
	viewFrame.MoveForward(15.0f);
	MakeFloor(floorBatch);
	
	}

void SpecialKeys(int key, int x, int y)
	{
	if(key == GLUT_KEY_UP)
		viewFrame.RotateWorld(m3dDegToRad(-5.0), 1.0f, 0.0f, 0.0f);

	if(key == GLUT_KEY_DOWN)
		viewFrame.RotateWorld(m3dDegToRad(5.0), 1.0f, 0.0f, 0.0f);
        
	if(key == GLUT_KEY_LEFT)
		viewFrame.RotateWorld(m3dDegToRad(-5.0), 0.0f, 1.0f, 0.0f);
        
	if(key == GLUT_KEY_RIGHT)
		viewFrame.RotateWorld(m3dDegToRad(5.0), 0.0f, 1.0f, 0.0f);

	// Refresh the Window
	glutPostRedisplay();
	}

void rzut(int r)
	{
	switch (r) {
    case 1:
	rzutow=1;
	break;
	case 2:
	rzutow=2;
	break;
	rzutow=1;
	glutReshapeFunc(WorldChangeSize);
	}
}
void scena(int r)
	{
	switch (r) {
    case 1:
	wsc=1;
	break;
	case 2:
	wsc=2;
	break;
	glutPostRedisplay();
	}}


int main(int argc, char* argv[])
	{
	gltSetWorkingDirectory(argv[0]);
	
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_STENCIL);
	glutInitWindowSize(1000, 600);
	glutInitWindowPosition(50, 50);
	window = glutCreateWindow("GLook");
	glutReshapeFunc(MainChangeSize);
	glutDisplayFunc(main_display);

	world = glutCreateSubWindow(window, 10, 10, 480, 580);
	glutReshapeFunc(WorldChangeSize);
	glutSpecialFunc(SpecialKeys);
	glutDisplayFunc(WorldRenderScene);

	glutCreateMenu(scena);
	glutAddMenuEntry("Szkielet", 1);
	glutAddMenuEntry("Wypełnienie", 2);

	glutAttachMenu(GLUT_LEFT_BUTTON);
	

	command = glutCreateSubWindow(window, 510, 10, 480, 580);
	glutReshapeFunc(commandChangeSize);
	glutDisplayFunc(command_display);
	

	GLenum err = glewInit();
	if (GLEW_OK != err)
		{
		/* Problem: glewInit failed, something is seriously wrong. */
		fprintf(stderr, "Error: %s\n", glewGetErrorString(err));
		return 1;
		}

	SetupRC();
	redisplay_all();
	glutMainLoop();
	glutDestroyWindow(window); 
	return 0;
	}