bonjours,
j'essaie de faire un editeur pour mon jeu en utilisant 4 vues a la fois(comme les logiciels 3dsmax,...)

je utilise l'api win32 mais j'ai un gros bug :


voici mon code d'affichage :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
int DrawGLScene(GLvoid)									// Here's Where We Do All The Drawing
{
glClear(GL_COLOR_BUFFER_BIT);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(5,5,5,0,0,0,0,1,0);
glColor3d(1,0,0);
glBegin(GL_QUADS);
 
glVertex3i(1,1,1);
glVertex3i(1,-1,1);
glVertex3i(-1,-1,1);
glVertex3i(-1,1,1);
	//1 face
 
glVertex3i(1,1,-1);
glVertex3i(1,-1,-1);
glVertex3i(-1,-1,-1);
glVertex3i(-1,1,-1);
	//2 faces
 
glVertex3i(1,1,1);
glVertex3i(1,-1,1);
glVertex3i(1,-1,-1);
glVertex3i(1,1,-1);
	//3 faces
 
glVertex3i(-1,1,1);
glVertex3i(-1,-1,1);
glVertex3i(-1,-1,-1);
glVertex3i(-1,1,-1);
	//4 faces
 
glVertex3i(-1,1,-1);
glVertex3i(-1,1,1);
glVertex3i(1,1,1);
glVertex3i(1,1,-1);
	//5 faces
 
glVertex3i(-1,-1,-1);
glVertex3i(-1,-1,1);
glVertex3i(1,-1,1);
glVertex3i(1,-1,-1);
	//6 faces
glEnd(); 	
 
   SwapBuffers(hDC[0]);
   SwapBuffers(hDC[1]);
   SwapBuffers(hDC[2]);
   SwapBuffers(hDC[3]);
	return TRUE;
}
et mon code de creation de fenetres :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
BOOL CreateGLWindow(HWND hwnd,char* title,int x, int y, int width, int height, int bits, bool fullscreenflag,WNDPROC proc)
{
	GLuint		PixelFormat;			// Holds The Results After Searching For A Match
	WNDCLASS	wc;						// Windows Class Structure
	DWORD		dwExStyle;				// Window Extended Style
	DWORD		dwStyle;				// Window Style
	RECT		WindowRect;				// Grabs Rectangle Upper Left / Lower Right Values
	WindowRect.left=(long)x;			// Set Left Value To 0
	WindowRect.right=(long)width;		// Set Right Value To Requested Width
	WindowRect.top=(long)y;				// Set Top Value To 0
	WindowRect.bottom=(long)height;		// Set Bottom Value To Requested Height
 
	fullscreen=fullscreenflag;			// Set The Global Fullscreen Flag
 
	hInstance2			= GetModuleHandle(NULL);				// Grab An Instance For Our Window
 
 
 
 
		dwExStyle= WS_EX_CLIENTEDGE;			// Window Extended Style
		dwStyle=WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | ES_NUMBER | ES_LEFT;							// Windows Style
 
	//AdjustWindowRectEx(&WindowRect, dwStyle, FALSE, dwExStyle);		// Adjust Window To True Requested Size
 
	// Create The Window
	if (!(hWnd[num_child]=CreateWindowEx(	dwExStyle,							// Extended Style For The Window
								"OpenGL",							// Class Name
								title,								// Window Title
								dwStyle,					// Required Window Style
								WindowRect.left, WindowRect.top,								// Window Position
								WindowRect.right,	// Calculate Window Width
								WindowRect.bottom,	// Calculate Window Height
								hwnd,								// No Parent Window
								NULL,								// No Menu
								hInstance2,							// Instance
								NULL)))								// Dont Pass Anything To WM_CREATE
	{
		KillGLWindow(num_child-1);								// Reset The Display
		MessageBox(NULL,"Window Creation Error.","ERROR",MB_OK|MB_ICONEXCLAMATION);
		return FALSE;								// Return FALSE
	}
 
	static	PIXELFORMATDESCRIPTOR pfd=				// pfd Tells Windows How We Want Things To Be
	{
		sizeof(PIXELFORMATDESCRIPTOR),				// Size Of This Pixel Format Descriptor
		1,											// Version Number
		PFD_DRAW_TO_WINDOW |						// Format Must Support Window
		PFD_SUPPORT_OPENGL |						// Format Must Support OpenGL
		PFD_DOUBLEBUFFER,							// Must Support Double Buffering
		PFD_TYPE_RGBA,								// Request An RGBA Format
		16,										// Select Our Color Depth
		0, 0, 0, 0, 0, 0,							// Color Bits Ignored
		0,											// No Alpha Buffer
		0,											// Shift Bit Ignored
		0,											// No Accumulation Buffer
		0, 0, 0, 0,									// Accumulation Bits Ignored
		32,											// 32Bit Z-Buffer (Depth Buffer)  
		0,											// No Stencil Buffer
		0,											// No Auxiliary Buffer
		0,								// Main Drawing Layer
		0,											// Reserved
		0, 0, 0										// Layer Masks Ignored
	};
 
	if (!(hDC[num_child]=GetDC(hWnd[num_child])))							// Did We Get A Device Context?
	{
		KillGLWindow(num_child-1);								// Reset The Display
		MessageBox(NULL,"Can't Create A GL Device Context.","ERROR",MB_OK|MB_ICONEXCLAMATION);
		return FALSE;								// Return FALSE
	}
 
	if (!(PixelFormat=ChoosePixelFormat(hDC[num_child],&pfd)))	// Did Windows Find A Matching Pixel Format?
	{
		KillGLWindow(num_child-1);								// Reset The Display
		MessageBox(NULL,"Can't Find A Suitable PixelFormat.","ERROR",MB_OK|MB_ICONEXCLAMATION);
		return FALSE;								// Return FALSE
	}
 
	if(!SetPixelFormat(hDC[num_child],PixelFormat,&pfd))		// Are We Able To Set The Pixel Format?
	{
		KillGLWindow(num_child-1);								// Reset The Display
		MessageBox(NULL,"Can't Set The PixelFormat.","ERROR",MB_OK|MB_ICONEXCLAMATION);
		return FALSE;								// Return FALSE
	}
 
	if (!(hRC[num_child]=wglCreateContext(hDC[num_child])))				// Are We Able To Get A Rendering Context?
	{
		KillGLWindow(num_child-1);								// Reset The Display
		MessageBox(NULL,"Can't Create A GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION);
		return FALSE;								// Return FALSE
	}
 
	if(!wglMakeCurrent(hDC[num_child],hRC[num_child]))					// Try To Activate The Rendering Context
	{
		KillGLWindow(num_child-1);								// Reset The Display
		MessageBox(NULL,"Can't Activate The GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION);
		return FALSE;								// Return FALSE
	}
 
	ShowWindow(hWnd[num_child],SW_SHOW);						// Show The Window
	SetForegroundWindow(hWnd[num_child]);						// Slightly Higher Priority
	SetFocus(hWnd[num_child]);									// Sets Keyboard Focus To The Window
	ReSizeGLScene(width, height);					// Set Up Our Perspective GL Screen
 
    num_child++;
	return TRUE;
}
et je cree mes 4 sous fenetres comme ceci :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
WNDCLASS wc;
             wc.style			= 0;	// Redraw On Size, And Own DC For Window.
	         wc.lpfnWndProc		= (WNDPROC)WndProc2;					// WndProc Handles Messages
	         wc.cbClsExtra		= 0;									// No Extra Window Data
	         wc.cbWndExtra		= 0;									// No Extra Window Data
	         wc.hInstance		= NULL;							// Set The Instance
	         wc.hIcon			= LoadIcon(NULL, IDI_WINLOGO);			// Load The Default Icon
	         wc.hCursor			= LoadCursor(NULL, IDC_ARROW);			// Load The Arrow Pointer
	         wc.hbrBackground	= NULL;									// No Background Required For GL
	         wc.lpszMenuName		= NULL;								// We Don't Want A Menu
	         wc.lpszClassName	= "openGL";								// Set The Class Name
 
	         if (!RegisterClass(&wc))									// Attempt To Register The Window Class
	         {
		        MessageBox(NULL,"Failed To Register The Window Class.","ERROR",MB_OK|MB_ICONEXCLAMATION);
	         	return FALSE;											// Return FALSE
             }
             CreateGLWindow(hwnd,"face",0,0,320, 215,16, 0,(WNDPROC) WndProc2);
             CreateGLWindow(hwnd,"dessus",320,0,320, 215,16, 0,(WNDPROC) WndProc2);
             CreateGLWindow(hwnd,"cote",0,215,320, 215,16, 0,(WNDPROC) WndProc2);
             CreateGLWindow(hwnd,"vue 3D",320,215,320, 215,16, 0,(WNDPROC) WndProc2);
 
InitGL();
avez vous une idee sur ce qui cause ce bug?

delfare