Sterowanie na ocene chyba 4.0

This commit is contained in:
Pc
2025-01-07 20:49:20 +01:00
parent 4956d74c1a
commit 2afc119bb9

548
main.cpp
View File

@@ -60,7 +60,7 @@ static GLsizei lastWidth;
// Opis tekstury // Opis tekstury
BITMAPINFOHEADER bitmapInfoHeader; // nagłówek obrazu BITMAPINFOHEADER bitmapInfoHeader; // nagłówek obrazu
unsigned char* bitmapData; // dane tekstury unsigned char* bitmapData; // dane tekstury
unsigned int texture[2]; // obiekt tekstury unsigned int texture[2]; // obiekt tekstury
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
@@ -76,7 +76,7 @@ int monitormodecounter = 0;
std::time_t monitormodehelper; std::time_t monitormodehelper;
//Zmienne do ruchu ############################################## //Zmienne do ruchu ##############################################
/*
float Foward = 0.0f; // Pozycja łazika w przód/tył float Foward = 0.0f; // Pozycja łazika w przód/tył
float Sides = 0.0f; // Pozycja łazika w lewo/prawo float Sides = 0.0f; // Pozycja łazika w lewo/prawo
float Rotation = 0.0f; // Rotacja łazika (w stopniach) float Rotation = 0.0f; // Rotacja łazika (w stopniach)
@@ -110,6 +110,92 @@ void RotateRoverAndCamera(float angle) {
if (Rotation >= 360.0f) Rotation -= 360.0f; if (Rotation >= 360.0f) Rotation -= 360.0f;
if (Rotation < 0.0f) Rotation += 360.0f; if (Rotation < 0.0f) Rotation += 360.0f;
} }
*/
//Zmienne do ruchu ##############################################^^^^^^^^^^^^^^^^^^^^^^^^^^^^
bool keyWPressed = false;
bool keySPressed = false;
bool keyAPressed = false;
bool keyDPressed = false;
float Foward = 0.0f; // Pozycja łazika w przód/tył
float Sides = 0.0f; // Pozycja łazika w lewo/prawo
float Rotation = 0.0f; // Rotacja łazika (w stopniach)
float CameraHeight = 50.0f; // Wysokość kamery
float MoveSpeed = 3.0f; // Prędkość poruszania się
// Funkcja do poruszania łazikiem
void MoveRover(bool forward) {
// Zamieniamy kąt na radiany
float radRotation = Rotation * GL_PI / 180.0f;
// Wektor ruchu w kierunku przód/tył (kierunek łazika)
float moveX = cos(radRotation);
float moveZ = sin(radRotation);
// Ruch w przód
if (forward) {
Sides -= MoveSpeed * moveX;
Foward -= MoveSpeed * moveZ;
}
// Ruch w tył
else {
Sides += MoveSpeed * moveX;
Foward += MoveSpeed * moveZ;
}
}
// Funkcja do obracania łazika wokół osi Y
void RotateRoverAndCamera(float angle) {
Rotation += angle;
if (Rotation >= 360.0f) Rotation -= 360.0f;
if (Rotation < 0.0f) Rotation += 360.0f;
}
void UpdateRover() {
if (keyWPressed) {
if (keyAPressed) {
// Ruch do przodu i skręt w lewo
RotateRoverAndCamera(3.0f); // Dostosuj wartość kąta według potrzeb
MoveRover(true);
}
else if (keyDPressed) {
// Ruch do przodu i skręt w prawo
RotateRoverAndCamera(-3.0f); // Dostosuj wartość kąta według potrzeb
MoveRover(true);
}
else {
// Ruch do przodu bez skrętu
MoveRover(true);
}
}
else if (keySPressed) {
if (keyAPressed) {
// Ruch do tyłu i skręt w lewo
RotateRoverAndCamera(-3.0f); // Dostosuj wartość kąta według potrzeb
MoveRover(false);
}
else if (keyDPressed) {
// Ruch do tyłu i skręt w prawo
RotateRoverAndCamera(3.0f); // Dostosuj wartość kąta według potrzeb
MoveRover(false);
}
else {
// Ruch do tyłu bez skrętu
MoveRover(false);
}
}
else {
if (keyAPressed) {
// Obrót w miejscu w lewo
RotateRoverAndCamera(3.0f); // Dostosuj wartość kąta według potrzeb
}
else if (keyDPressed) {
// Obrót w miejscu w prawo
RotateRoverAndCamera(-3.0f); // Dostosuj wartość kąta według potrzeb
}
}
}
// Change viewing volume and viewport. Called when window is resized // Change viewing volume and viewport. Called when window is resized
void ChangeSize(GLsizei w, GLsizei h) { void ChangeSize(GLsizei w, GLsizei h) {
@@ -153,7 +239,7 @@ void ChangeSize(GLsizei w, GLsizei h) {
unsigned char* LoadBitmapFile(char* filename, BITMAPINFOHEADER* bitmapInfoHeader) { unsigned char* LoadBitmapFile(char* filename, BITMAPINFOHEADER* bitmapInfoHeader) {
FILE* filePtr; // wskaźnik pozycji pliku FILE* filePtr; // wskaźnik pozycji pliku
BITMAPFILEHEADER bitmapFileHeader; // nagłówek pliku BITMAPFILEHEADER bitmapFileHeader; // nagłówek pliku
unsigned char* bitmapImage; // dane obrazu unsigned char* bitmapImage; // dane obrazu
int imageIdx = 0; // licznik pikseli int imageIdx = 0; // licznik pikseli
unsigned char tempRGB; // zmienna zamiany składowych unsigned char tempRGB; // zmienna zamiany składowych
@@ -238,7 +324,7 @@ void SetDCPixelFormat(HDC hDC) {
} }
lazik user(10.0f, 0.0f, 0.0f, "res/models/lazik4.obj"); lazik user(10.0f, 0.0f, 0.0f, "res/models/lazik4.obj");
plane mapa(0.0f, 0.0f, 0.0f, "res/models/mapka2.obj"); plane mapa(0.0f, 0.0f, 0.0f, "res/models/mapka2.obj");
void SetupRC() { void SetupRC() {
// Light values and coordinates // Light values and coordinates
@@ -278,7 +364,7 @@ void SetupRC() {
// White background // White background
glClearColor(1.0f, 1.0f, 1.0f, 1.0f); glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
// Black brush // Black brush
glColor3f(0.0, 0.0, 0.0); glColor3f(0.0, 0.0, 0.0);
// Initialize GLEW // Initialize GLEW
@@ -295,7 +381,7 @@ void SetupRC() {
// do przepisania kodu na podobny do tego stąd: // do przepisania kodu na podobny do tego stąd:
// https://github.com/opengl-tutorials/ogl/blob/master/tutorial07_model_loading/tutorial07.cpp // https://github.com/opengl-tutorials/ogl/blob/master/tutorial07_model_loading/tutorial07.cpp
timestampedCout("Inicjalizowanie GLFW3..."); timestampedCout("Inicjalizowanie GLFW3...");
if(!glfwInit()) { if (!glfwInit()) {
timestampedCout("Failed to initialize GLFW"); timestampedCout("Failed to initialize GLFW");
} }
timestampedCout("Zainicjalizowano GLFW3."); timestampedCout("Zainicjalizowano GLFW3.");
@@ -332,11 +418,11 @@ void RenderScene(void) {
// ); // );
switch (polygonmode) { switch (polygonmode) {
case 1: case 1:
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
break; break;
default: default:
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
} }
// prymitywny licznik FPS // prymitywny licznik FPS
@@ -385,15 +471,17 @@ void RenderScene(void) {
// Rysowanie łazika (porusza się i obraca) // Rysowanie łazika (porusza się i obraca)
glPushMatrix(); glPushMatrix();
glTranslatef(Foward, 0.0f, Sides); // Translacja łazika na jego pozycję glTranslatef(Foward, 0.0f, Sides); // Translacja łazika na jego pozycję
glRotatef(Rotation, 0.0f, 1.0f, 0.0f); // Obrót łazika wokół własnej osi glRotatef(Rotation, 0.0f, 1.0f, 0.0f); // Obrót łazika wokół własnej osi
glColor3f(1.0, 0.0, 0.0); // Czerwony kolor dla łazika glColor3f(1.0, 0.0, 0.0); // Czerwony kolor dla łazika
user.draw(); user.draw();
UpdateRover();
glPopMatrix(); glPopMatrix();
// Zamiana buforów (double buffering) // Zamiana buforów (double buffering)
// Swap buffers // Swap buffers
//glfwSwapBuffers(window); //glfwSwapBuffers(window);
@@ -547,243 +635,253 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
static HGLRC hRC; // Permenant Rendering context static HGLRC hRC; // Permenant Rendering context
static HDC hDC; // Private GDI Device context static HDC hDC; // Private GDI Device context
float radRotation = Rotation * GL_PI / 180.0f; float radRotation = Rotation * GL_PI / 180.0f;
switch (message) { switch (message) {
// Window creation, setup for OpenGL // Window creation, setup for OpenGL
case WM_CREATE: case WM_CREATE:
// Store the device context // Store the device context
hDC = GetDC(hWnd); hDC = GetDC(hWnd);
// Select the pixel format // Select the pixel format
SetDCPixelFormat(hDC); SetDCPixelFormat(hDC);
// Create palette if needed // Create palette if needed
hPalette = GetOpenGLPalette(hDC); hPalette = GetOpenGLPalette(hDC);
// Create the rendering context and make it current // Create the rendering context and make it current
hRC = wglCreateContext(hDC); hRC = wglCreateContext(hDC);
wglMakeCurrent(hDC, hRC); wglMakeCurrent(hDC, hRC);
SetupRC(); SetupRC();
/*
glGenTextures(2, &texture[0]); // tworzy obiekt tekstury
// ładuje pierwszy obraz tekstury: /*
bitmapData = LoadBitmapFile((char*)"Bitmapy\\checker.bmp", &bitmapInfoHeader); glGenTextures(2, &texture[0]); // tworzy obiekt tekstury
glBindTexture(GL_TEXTURE_2D, texture[0]); // aktywuje obiekt tekstury // ładuje pierwszy obraz tekstury:
bitmapData = LoadBitmapFile((char*)"Bitmapy\\checker.bmp", &bitmapInfoHeader);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glBindTexture(GL_TEXTURE_2D, texture[0]); // aktywuje obiekt tekstury
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
// tworzy obraz tekstury glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, bitmapInfoHeader.biWidth, glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
bitmapInfoHeader.biHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, bitmapData);
if (bitmapData) free(bitmapData); // tworzy obraz tekstury
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, bitmapInfoHeader.biWidth,
bitmapInfoHeader.biHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, bitmapData);
// ładuje drugi obraz tekstury: if (bitmapData) free(bitmapData);
bitmapData = LoadBitmapFile((char*)"Bitmapy\\crate.bmp", &bitmapInfoHeader);
glBindTexture(GL_TEXTURE_2D, texture[1]); // aktywuje obiekt tekstury
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); // ładuje drugi obraz tekstury:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); bitmapData = LoadBitmapFile((char*)"Bitmapy\\crate.bmp", &bitmapInfoHeader);
glBindTexture(GL_TEXTURE_2D, texture[1]); // aktywuje obiekt tekstury
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
// tworzy obraz tekstury glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, bitmapInfoHeader.biWidth, glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
bitmapInfoHeader.biHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, bitmapData);
if (bitmapData) free(bitmapData); // tworzy obraz tekstury
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, bitmapInfoHeader.biWidth,
bitmapInfoHeader.biHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, bitmapData);
// ustalenie sposobu mieszania tekstury z tłem if (bitmapData) free(bitmapData);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
*/ // ustalenie sposobu mieszania tekstury z tłem
break; glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
*/
break;
// Window is being destroyed, cleanup // Window is being destroyed, cleanup
case WM_DESTROY: case WM_DESTROY:
// Deselect the current rendering context and delete it // Deselect the current rendering context and delete it
wglMakeCurrent(hDC, NULL); wglMakeCurrent(hDC, NULL);
wglDeleteContext(hRC); wglDeleteContext(hRC);
// Delete the palette if it was created // Delete the palette if it was created
if (hPalette != NULL) DeleteObject(hPalette); if (hPalette != NULL) DeleteObject(hPalette);
// Tell the application to terminate after the window // Tell the application to terminate after the window
// is gone. // is gone.
PostQuitMessage(0); PostQuitMessage(0);
break; break;
// Window is resized. // Window is resized.
case WM_SIZE: case WM_SIZE:
// Call our function which modifies the clipping // Call our function which modifies the clipping
// volume and viewport // volume and viewport
ChangeSize(LOWORD(lParam), HIWORD(lParam)); ChangeSize(LOWORD(lParam), HIWORD(lParam));
break; break;
// The painting function. This message sent by Windows // The painting function. This message sent by Windows
// whenever the screen needs updating. // whenever the screen needs updating.
case WM_PAINT: case WM_PAINT:
// Call OpenGL drawing code // Call OpenGL drawing code
RenderScene(); RenderScene();
SwapBuffers(hDC); SwapBuffers(hDC);
// Validate the newly painted client area // Validate the newly painted client area
if (!monitormode) ValidateRect(hWnd, NULL); if (!monitormode) ValidateRect(hWnd, NULL);
else InvalidateRect(hWnd, NULL, FALSE); else InvalidateRect(hWnd, NULL, FALSE);
break; break;
// Windows is telling the application that it may modify // Windows is telling the application that it may modify
// the system palette. This message in essance asks the // the system palette. This message in essance asks the
// application for a new palette. // application for a new palette.
case WM_QUERYNEWPALETTE: case WM_QUERYNEWPALETTE:
// If the palette was created. // If the palette was created.
if (hPalette) { if (hPalette) {
int nRet; int nRet;
// Selects the palette into the current device context // Selects the palette into the current device context
SelectPalette(hDC, hPalette, FALSE); SelectPalette(hDC, hPalette, FALSE);
// Map entries from the currently selected palette to // Map entries from the currently selected palette to
// the system palette. The return value is the number // the system palette. The return value is the number
// of palette entries modified. // of palette entries modified.
nRet = RealizePalette(hDC); nRet = RealizePalette(hDC);
// Repaint, forces remap of palette in current window // Repaint, forces remap of palette in current window
InvalidateRect(hWnd, NULL, FALSE); InvalidateRect(hWnd, NULL, FALSE);
return nRet; return nRet;
} }
break; break;
// This window may set the palette, even though it is not the // This window may set the palette, even though it is not the
// currently active window. // currently active window.
case WM_PALETTECHANGED: case WM_PALETTECHANGED:
// Don't do anything if the palette does not exist, or if // Don't do anything if the palette does not exist, or if
// this is the window that changed the palette. // this is the window that changed the palette.
if ((hPalette != NULL) && ((HWND)wParam != hWnd)) { if ((hPalette != NULL) && ((HWND)wParam != hWnd)) {
// Select the palette into the device context // Select the palette into the device context
SelectPalette(hDC, hPalette, FALSE); SelectPalette(hDC, hPalette, FALSE);
// Map entries to system palette // Map entries to system palette
RealizePalette(hDC); RealizePalette(hDC);
// Remap the current colors to the newly realized palette // Remap the current colors to the newly realized palette
UpdateColors(hDC); UpdateColors(hDC);
return 0; return 0;
} }
break;
case WM_KEYUP:
switch (wParam) {
case 'W':
keyWPressed = false;
break;
case 'S':
keySPressed = false;
break;
case 'A':
keyAPressed = false;
break;
case 'D':
keyDPressed = false;
break;
// Obsługa innych klawiszy
}
break;
case WM_KEYDOWN:
switch (wParam) {
case VK_UP:
xRot -= 5.0f;
break; break;
// Key press, check for arrow keys to do cube rotation. case VK_DOWN:
case WM_KEYDOWN: xRot += 5.0f;
switch (wParam) {
case VK_UP:
xRot -= 5.0f;
break;
case VK_DOWN:
xRot += 5.0f;
break;
case VK_LEFT:
yRot -= 5.0f;
break;
case VK_RIGHT:
yRot += 5.0f;
break;
case 'Q':
zRot += 5.0f;
break;
case 'E':
zRot -= 5.0f;
break;
case 'R':
xRot = 0;
yRot = 0;
zRot = 0;
break;
case ' ': // 32
polygonmode = !polygonmode;
if (polygonmode) timestampedCout("Uwaga! Tryb wireframe jest niewydajny i powinien sluzyc tylko do debugowania!");
break;
case 'W': // Ruch w przód
MoveRover(true);
break;
case 'S': // Ruch w tył
MoveRover(false);
break;
case 'A': // Obrót w lewo
RotateRoverAndCamera(5.0f); // Obrót łazika i kamery w lewo
break;
case 'D': // Obrót w prawo
RotateRoverAndCamera(-5.0f); // Obrót łazika i kamery w prawo
break;
case 'J': // Obrót w lewo (wokół własnej osi)
Rotation += 5.0f;
if (Rotation > 360.0f || Rotation < 0.0f) Rotation -= 360.0f;
break;
case 'K': // Obrót w prawo (wokół własnej osi)
Rotation -= 5.0f;
if (Rotation > 360.0f || Rotation < 0.0f) Rotation += 360.0f;
break;
case 114: // F3
monitormode = !monitormode;
if (monitormode) {
monitormodehelper = std::time(nullptr) - 1;
timestampedCout("Wlaczono tryb monitorowania wydajnosci.");
}
if (!monitormode) timestampedCout("Wylaczono tryb monitorowania wydajnosci.");
break;
default:
timestampedCout("Nacisnieto nierozpoznany klawisz: " << (int)wParam);
}
xRot = (const int)xRot % 360;
yRot = (const int)yRot % 360;
zRot = (const int)zRot % 360;
InvalidateRect(hWnd, NULL, FALSE);
break; break;
case VK_LEFT:
yRot -= 5.0f;
break;
case VK_RIGHT:
yRot += 5.0f;
break;
case 'Q':
zRot += 5.0f;
break;
case 'E':
zRot -= 5.0f;
break;
case 'R':
xRot = 0;
yRot = 0;
zRot = 0;
break;
case ' ': // 32
polygonmode = !polygonmode;
if (polygonmode) timestampedCout("Uwaga! Tryb wireframe jest niewydajny i powinien sluzyc tylko do debugowania!");
break;
case 'W':
keyWPressed = true;
break;
case 'S':
keySPressed = true;
break;
case 'A':
keyAPressed = true;
break;
case 'D':
keyDPressed = true;
break;
case 114: // F3
monitormode = !monitormode;
if (monitormode) {
monitormodehelper = std::time(nullptr) - 1;
timestampedCout("Wlaczono tryb monitorowania wydajnosci.");
}
if (!monitormode) timestampedCout("Wylaczono tryb monitorowania wydajnosci.");
break;
default:
timestampedCout("Nacisnieto nierozpoznany klawisz: " << (int)wParam);
}
xRot = (const int)xRot % 360;
yRot = (const int)yRot % 360;
zRot = (const int)zRot % 360;
InvalidateRect(hWnd, NULL, FALSE);
break;
// A menu command // A menu command
case WM_COMMAND: case WM_COMMAND:
switch (LOWORD(wParam)) { switch (LOWORD(wParam)) {
// Exit the program // Exit the program
case ID_FILE_EXIT: case ID_FILE_EXIT:
DestroyWindow(hWnd); DestroyWindow(hWnd);
break;
// Display the about box
case ID_HELP_ABOUT:
DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG_ABOUT), hWnd, (DLGPROC)AboutDlgProc);
break;
}
break; break;
default: // Passes it on if unproccessed // Display the about box
return (DefWindowProc(hWnd, message, wParam, lParam)); case ID_HELP_ABOUT:
DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG_ABOUT), hWnd, (DLGPROC)AboutDlgProc);
break;
}
break;
default: // Passes it on if unproccessed
return (DefWindowProc(hWnd, message, wParam, lParam));
} }
return (0L); return (0L);
@@ -794,46 +892,46 @@ BOOL APIENTRY AboutDlgProc(HWND hDlg, UINT message, UINT wParam, LONG lParam) {
switch (message) { switch (message) {
// Initialize the dialog box // Initialize the dialog box
case WM_INITDIALOG: case WM_INITDIALOG:
int i; int i;
GLenum glError; GLenum glError;
// glGetString demo // glGetString demo
SetDlgItemText(hDlg, IDC_OPENGL_VENDOR, reinterpret_cast<LPCSTR>(glGetString(GL_VENDOR))); SetDlgItemText(hDlg, IDC_OPENGL_VENDOR, reinterpret_cast<LPCSTR>(glGetString(GL_VENDOR)));
SetDlgItemText(hDlg, IDC_OPENGL_RENDERER, (LPCSTR)glGetString(GL_RENDERER)); SetDlgItemText(hDlg, IDC_OPENGL_RENDERER, (LPCSTR)glGetString(GL_RENDERER));
SetDlgItemText(hDlg, IDC_OPENGL_VERSION, (LPCSTR)glGetString(GL_VERSION)); SetDlgItemText(hDlg, IDC_OPENGL_VERSION, (LPCSTR)glGetString(GL_VERSION));
SetDlgItemText(hDlg, IDC_OPENGL_EXTENSIONS, (LPCSTR)glGetString(GL_EXTENSIONS)); SetDlgItemText(hDlg, IDC_OPENGL_EXTENSIONS, (LPCSTR)glGetString(GL_EXTENSIONS));
// gluGetString demo // gluGetString demo
SetDlgItemText(hDlg, IDC_GLU_VERSION, (LPCSTR)gluGetString(GLU_VERSION)); SetDlgItemText(hDlg, IDC_GLU_VERSION, (LPCSTR)gluGetString(GLU_VERSION));
SetDlgItemText(hDlg, IDC_GLU_EXTENSIONS, (LPCSTR)gluGetString(GLU_EXTENSIONS)); SetDlgItemText(hDlg, IDC_GLU_EXTENSIONS, (LPCSTR)gluGetString(GLU_EXTENSIONS));
// Display any recent error messages // Display any recent error messages
i = 0; i = 0;
do { do {
glError = glGetError(); glError = glGetError();
SetDlgItemText(hDlg, IDC_ERROR1 + i, (LPCSTR)gluErrorString(glError)); SetDlgItemText(hDlg, IDC_ERROR1 + i, (LPCSTR)gluErrorString(glError));
i++; i++;
} while (i < 6 && glError != GL_NO_ERROR); } while (i < 6 && glError != GL_NO_ERROR);
return (TRUE); return (TRUE);
break; break;
// Process command messages // Process command messages
case WM_COMMAND: case WM_COMMAND:
// Validate and Make the changes // Validate and Make the changes
if (LOWORD(wParam) == IDOK) EndDialog(hDlg, TRUE); if (LOWORD(wParam) == IDOK) EndDialog(hDlg, TRUE);
break; break;
// Closed from sysbox // Closed from sysbox
case WM_CLOSE: case WM_CLOSE:
EndDialog(hDlg, TRUE); EndDialog(hDlg, TRUE);
break; break;
} }