Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions glutin/src/api/ios/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,13 @@ impl Context {

unsafe fn create_context(mut version: ffi::NSUInteger) -> Result<ffi::id, CreationError> {
let context_class = Class::get("EAGLContext").expect("Failed to get class `EAGLContext`");
let eagl_context: ffi::id = msg_send![context_class, alloc];
let mut valid_context = ffi::nil;
while valid_context == ffi::nil && version > 0 {
valid_context = msg_send![eagl_context, initWithAPI: version];
let mut eagl_context: ffi::id = ffi::nil;
while eagl_context.is_null() && version > 0 {
eagl_context = msg_send![context_class, alloc];
eagl_context = msg_send![eagl_context, initWithAPI: version];
version -= 1;
}
if valid_context == ffi::nil {
if eagl_context.is_null() {
Err(CreationError::OsError(
"Failed to create an OpenGL ES context with any version".to_string(),
))
Expand Down