@@ -88,13 +88,14 @@ unsafe fn create_full_context(settings: &WGLAttributes,
88
88
hdc : winapi:: HDC ,
89
89
share : winapi:: HGLRC )
90
90
-> Result < ( winapi:: HGLRC , winapi:: HDC ) , String > {
91
- if extensions. split ( ' ' ) . find ( |& i| i == "WGL_ARB_create_context" ) . is_none ( ) {
91
+ let mut extensions = extensions. split ( ' ' ) ;
92
+ if extensions. find ( |& i| i == "WGL_ARB_create_context" ) . is_none ( ) {
92
93
return create_basic_context ( hdc, share) ;
93
94
}
94
95
95
96
let mut attributes = Vec :: new ( ) ;
96
97
if settings. opengl_es {
97
- if extensions. split ( ' ' ) . find ( |& i| i == "WGL_EXT_create_context_es2_profile" ) . is_some ( ) {
98
+ if extensions. find ( |& i| i == "WGL_EXT_create_context_es2_profile" ) . is_some ( ) {
98
99
attributes. push ( wgl_ext:: CONTEXT_PROFILE_MASK_ARB as c_int ) ;
99
100
attributes. push ( wgl_ext:: CONTEXT_ES2_PROFILE_BIT_EXT as c_int ) ;
100
101
} else {
@@ -127,9 +128,11 @@ unsafe fn create_full_context(settings: &WGLAttributes,
127
128
io:: Error :: last_os_error( ) ) ) ;
128
129
}
129
130
131
+ if wgl:: MakeCurrent ( hdc as * const _ , ctx as * const _ ) == 0 {
132
+ return Err ( "wglMakeCurrent failed" . to_owned ( ) ) ;
133
+ }
130
134
// Disable or enable vsync
131
- if extensions. split ( ' ' ) . find ( |& i| i == "WGL_EXT_swap_control" ) . is_some ( ) {
132
- let _guard = try!( CurrentContextGuard :: make_current ( hdc, ctx as winapi:: HGLRC ) ) ;
135
+ if extensions. find ( |& i| i == "WGL_EXT_swap_control" ) . is_some ( ) {
133
136
if extra. SwapIntervalEXT ( if settings. vsync { 1 } else { 0 } ) == 0 {
134
137
return Err ( "wglSwapIntervalEXT failed" . to_owned ( ) ) ;
135
138
}
@@ -139,7 +142,6 @@ unsafe fn create_full_context(settings: &WGLAttributes,
139
142
}
140
143
141
144
unsafe fn create_hidden_window ( ) -> Result < winapi:: HWND , & ' static str > {
142
-
143
145
let class_name = register_window_class ( ) ;
144
146
let mut rect = winapi:: RECT {
145
147
left : 0 ,
0 commit comments