Windows: Moved pixel format logic from WindowsDisplayPeerInfo.initDC to WindowsDisplay.createWindow

This commit is contained in:
Elias Naur 2008-05-01 09:55:54 +00:00
parent bf4b5a5890
commit b11fcc99f6
2 changed files with 6 additions and 2 deletions

View File

@ -174,6 +174,8 @@ final class WindowsDisplay implements DisplayImplementation {
throw new LWJGLException("Failed to get dc"); throw new LWJGLException("Failed to get dc");
} }
peer_info.initDC(getHwnd(), getHdc()); peer_info.initDC(getHwnd(), getHdc());
int format = WindowsPeerInfo.choosePixelFormat(getHdc(), 0, 0, peer_info.getPixelFormat(), null, true, true, false, true);
WindowsPeerInfo.setPixelFormat(getHdc(), format);
showWindow(getHwnd(), SW_SHOWDEFAULT); showWindow(getHwnd(), SW_SHOWDEFAULT);
if (parent == null) { if (parent == null) {
setForegroundWindow(getHwnd()); setForegroundWindow(getHwnd());

View File

@ -49,10 +49,12 @@ final class WindowsDisplayPeerInfo extends WindowsPeerInfo {
GLContext.loadOpenGLLibrary(); GLContext.loadOpenGLLibrary();
} }
final PixelFormat getPixelFormat() {
return pixel_format;
}
void initDC(long hwnd, long hdc) throws LWJGLException { void initDC(long hwnd, long hdc) throws LWJGLException {
nInitDC(getHandle(), hwnd, hdc); nInitDC(getHandle(), hwnd, hdc);
int format = choosePixelFormat(hdc, 0, 0, pixel_format, null, true, true, false, true);
setPixelFormat(hdc, format);
} }
private static native void nInitDC(ByteBuffer peer_info_handle, long hwnd, long hdc); private static native void nInitDC(ByteBuffer peer_info_handle, long hwnd, long hdc);