OpenGL-Fenster wird nicht richtig angezeigt nach Abfragen Löschung
-
Hi Leute,
ich wollte grad mal das Beispiel programm von Nehe-Lesson 1 etwas komprimieren und hab mal versuht zu löschen was man nicht so richtig braucht. Lief eig. auch alles Wunderbar, nur jetzt als ich versucht hab ein paar if()-Abfragen zu löschen, zeigt
er mir immer ein Stück vom Desktop anstatt des schwarzen Bildschirm's an.
Meine beüfhctung ist, das es irgendwie mit dem Buffer zu tun hat.
Das sind die zusammenhängenden Abfragen die ich gelöscht hab :if (!(hDC=GetDC(hWnd))) // Haben wir einen Device Kontext erhalten? { KillGLWindow(); // Resette die Anzeige MessageBox(NULL,"Can't Create A GL Device Context.","ERROR",MB_OK|MB_ICONEXCLAMATION); return FALSE; // Gebe FALSE zurück } [code] if (!(hDC=GetDC(hWnd))) // Did We Get A Device Context? { KillGLWindow(); // 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,&pfd))) // Did Windows Find A Matching Pixel Format? { KillGLWindow(); // Reset The Display MessageBox(NULL,"Can't Find A Suitable PixelFormat.","ERROR",MB_OK|MB_ICONEXCLAMATION); return FALSE; // Return FALSE } if(!SetPixelFormat(hDC,PixelFormat,&pfd)) // Are We Able To Set The Pixel Format? { KillGLWindow(); // Reset The Display MessageBox(NULL,"Can't Set The PixelFormat.","ERROR",MB_OK|MB_ICONEXCLAMATION); return FALSE; // Return FALSE } if (!(hRC=wglCreateContext(hDC))) // Are We Able To Get A Rendering Context? { KillGLWindow(); // Reset The Display MessageBox(NULL,"Can't Create A GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION); return FALSE; // Return FALSE } if(!wglMakeCurrent(hDC,hRC)) // Try To Activate The Rendering Context { KillGLWindow(); // Reset The Display MessageBox(NULL,"Can't Activate The GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION); return FALSE; // Return FALSE }Nun, ich versteh jetzt nicht mehr, wieso er mir das so komisch anzeigt. Eigentlich dürften die Abfragen doch garkein Einfluss auf andere Code-häppchen haben !?
Ich bedanke mich schon einmal recht herzlich und wünsche eine gute vorwheinachtszeit ! :xmas1: :xmas2:
-
The wglCreateContext function creates a new OpenGL rendering context, which is suitable for drawing on the device referenced by hdc
meinste nich, dass das vielleicht wichtig sein koennte?
-
Lern ersteinmal C.
Tipp: Das was da innerhalb der if-Anfragen steht, sind Zugriffe auf Win-API-Funktionen. Diese werden, wenn du diesen Code raus schmeisst, natürlich nicht ausgeführt.
-
Ahhh ihr seit die besten, dankeeee. :xmas2: :xmas1: