@@ -553,11 +553,6 @@ GLDisplayPlatform* GLDisplay::GetAs() {
553
553
type_checked = std::is_same<GLDisplayPlatform, GLDisplayX11>::value;
554
554
#endif // defined(USE_GLX)
555
555
break ;
556
- case WGL:
557
- #if BUILDFLAG(IS_WIN)
558
- type_checked = std::is_same<GLDisplayPlatform, GLDisplayWGL>::value;
559
- #endif // BUILDFLAG(IS_WIN)
560
- break ;
561
556
}
562
557
if (type_checked)
563
558
return static_cast <GLDisplayPlatform*>(this );
@@ -575,11 +570,6 @@ template EXPORT_TEMPLATE_DEFINE(GL_EXPORT)
575
570
GLDisplayX11* GLDisplay::GetAs<GLDisplayX11>();
576
571
#endif // defined(USE_GLX)
577
572
578
- #if BUILDFLAG(IS_WIN)
579
- template EXPORT_TEMPLATE_DEFINE(GL_EXPORT)
580
- GLDisplayWGL* GLDisplay::GetAs<GLDisplayWGL>();
581
- #endif // BUILDFLAG(IS_WIN)
582
-
583
573
#if defined(USE_EGL)
584
574
GLDisplayEGL::EGLGpuSwitchingObserver::EGLGpuSwitchingObserver (
585
575
EGLDisplay display)
@@ -941,159 +931,4 @@ bool GLDisplayX11::Initialize(gl::GLDisplay*) {
941
931
}
942
932
#endif // defined(USE_GLX)
943
933
944
- #if BUILDFLAG(IS_WIN)
945
-
946
- namespace {
947
- const PIXELFORMATDESCRIPTOR kPixelFormatDescriptor = {
948
- sizeof (kPixelFormatDescriptor ), // Size of structure.
949
- 1 , // Default version.
950
- PFD_DRAW_TO_WINDOW | // Window drawing support.
951
- PFD_SUPPORT_OPENGL | // OpenGL support.
952
- PFD_DOUBLEBUFFER, // Double buffering support (not stereo).
953
- PFD_TYPE_RGBA, // RGBA color mode (not indexed).
954
- 24 , // 24 bit color mode.
955
- 0 , 0 , 0 , 0 , 0 , 0 , // Don't set RGB bits & shifts.
956
- 8 , 0 , // 8 bit alpha
957
- 0 , // No accumulation buffer.
958
- 0 , 0 , 0 , 0 , // Ignore accumulation bits.
959
- 0 , // no z-buffer.
960
- 0 , // no stencil buffer.
961
- 0 , // No aux buffer.
962
- PFD_MAIN_PLANE, // Main drawing plane (not overlay).
963
- 0 , // Reserved.
964
- 0 , 0 , 0 , // Layer masks ignored.
965
- };
966
-
967
- LRESULT CALLBACK IntermediateWindowProc (HWND window,
968
- UINT message,
969
- WPARAM w_param,
970
- LPARAM l_param) {
971
- switch (message) {
972
- case WM_ERASEBKGND:
973
- // Prevent windows from erasing the background.
974
- return 1 ;
975
- case WM_PAINT:
976
- // Do not paint anything.
977
- PAINTSTRUCT paint;
978
- if (BeginPaint (window, &paint))
979
- EndPaint (window, &paint);
980
- return 0 ;
981
- default :
982
- return DefWindowProc (window, message, w_param, l_param);
983
- }
984
- }
985
- } // namespace
986
-
987
- GLDisplayWGL::GLDisplayWGL (uint64_t system_device_id, DisplayKey display_key)
988
- : GLDisplay(system_device_id, display_key, WGL),
989
- module_handle_(0 ),
990
- window_class_(0 ),
991
- window_handle_(0 ),
992
- device_context_(0 ),
993
- pixel_format_(0 ) {}
994
-
995
- GLDisplayWGL::~GLDisplayWGL () {
996
- if (window_handle_)
997
- DestroyWindow (window_handle_);
998
- if (window_class_)
999
- UnregisterClass (reinterpret_cast <wchar_t *>(window_class_),
1000
- module_handle_);
1001
- }
1002
-
1003
- bool GLDisplayWGL::Init (bool software_rendering) {
1004
- // We must initialize a GL context before we can bind to extension entry
1005
- // points. This requires the device context for a window.
1006
- if (!GetModuleHandleEx (GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT |
1007
- GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
1008
- reinterpret_cast <wchar_t *>(IntermediateWindowProc),
1009
- &module_handle_)) {
1010
- LOG (ERROR) << " GetModuleHandleEx failed." ;
1011
- return false ;
1012
- }
1013
-
1014
- WNDCLASS intermediate_class;
1015
- intermediate_class.style = CS_OWNDC;
1016
- intermediate_class.lpfnWndProc = IntermediateWindowProc;
1017
- intermediate_class.cbClsExtra = 0 ;
1018
- intermediate_class.cbWndExtra = 0 ;
1019
- intermediate_class.hInstance = module_handle_;
1020
- intermediate_class.hIcon = LoadIcon (NULL , IDI_APPLICATION);
1021
- intermediate_class.hCursor = LoadCursor (NULL , IDC_ARROW);
1022
- intermediate_class.hbrBackground = NULL ;
1023
- intermediate_class.lpszMenuName = NULL ;
1024
- intermediate_class.lpszClassName = L" Intermediate GL Window" ;
1025
- window_class_ = RegisterClass (&intermediate_class);
1026
- if (!window_class_) {
1027
- LOG (ERROR) << " RegisterClass failed." ;
1028
- return false ;
1029
- }
1030
-
1031
- window_handle_ = CreateWindowEx (WS_EX_NOPARENTNOTIFY,
1032
- reinterpret_cast <wchar_t *>(window_class_),
1033
- L" " ,
1034
- WS_OVERLAPPEDWINDOW,
1035
- 0 ,
1036
- 0 ,
1037
- 100 ,
1038
- 100 ,
1039
- NULL ,
1040
- NULL ,
1041
- NULL ,
1042
- NULL );
1043
- if (!window_handle_) {
1044
- LOG (ERROR) << " CreateWindow failed." ;
1045
- return false ;
1046
- }
1047
-
1048
- device_context_ = GetDC (window_handle_);
1049
- pixel_format_ = ChoosePixelFormat (device_context_,
1050
- &kPixelFormatDescriptor );
1051
- if (pixel_format_ == 0 ) {
1052
- LOG (ERROR) << " Unable to get the pixel format for GL context." ;
1053
- return false ;
1054
- }
1055
-
1056
- bool result = false ;
1057
- if (software_rendering) {
1058
- // wglSetPixelFormat needs to be called instead of SetPixelFormat to allow
1059
- // a differently named software GL implementation library to set up its
1060
- // internal data. The windows gdi.dll SetPixelFormat call directly calls
1061
- // into the stock opengl32.dll, instead of opengl32sw.dll for example.
1062
- typedef BOOL (WINAPI * wglSetPixelFormatProc)(
1063
- HDC, int , const PIXELFORMATDESCRIPTOR*);
1064
- wglSetPixelFormatProc wglSetPixelFormatFn =
1065
- reinterpret_cast <wglSetPixelFormatProc>(
1066
- GetGLProcAddress (" wglSetPixelFormat" ));
1067
-
1068
- result = wglSetPixelFormatFn (device_context_, pixel_format_,
1069
- &kPixelFormatDescriptor );
1070
- } else {
1071
- result = SetPixelFormat (device_context_, pixel_format_,
1072
- &kPixelFormatDescriptor );
1073
- }
1074
- if (!result) {
1075
- LOG (ERROR) << " Unable to set the pixel format for temporary GL context." ;
1076
- return false ;
1077
- }
1078
- return true ;
1079
- }
1080
-
1081
- void * GLDisplayWGL::GetDisplay () const
1082
- {
1083
- return device_context ();
1084
- }
1085
-
1086
- bool GLDisplayWGL::IsInitialized () const
1087
- {
1088
- return true ;
1089
- }
1090
- void GLDisplayWGL::Shutdown ()
1091
- {
1092
- }
1093
- bool GLDisplayWGL::Initialize (gl::GLDisplay*) {
1094
- // FIXME?
1095
- return false ;
1096
- }
1097
- #endif // BUILDFLAG(IS_WIN)
1098
-
1099
934
} // namespace gl
0 commit comments