<!--
{
  "availability" : [
    "iOS: 2.0.0 - 12.0.0",
    "iPadOS: 2.0.0 - 12.0.0",
    "macCatalyst: 2.0.0 - 12.0.0",
    "tvOS: 9.0.0 - 12.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "OpenGLES",
  "identifier" : "/documentation/OpenGLES/EAGLContext",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "OpenGL ES"
    ],
    "preciseIdentifier" : "c:objc(cs)EAGLContext"
  },
  "title" : "EAGLContext"
}
-->

# EAGLContext

An [`EAGLContext`](/documentation/OpenGLES/EAGLContext) object manages an OpenGL ES *rendering context*—the state information, commands, and resources needed to draw using OpenGL ES. To execute OpenGL ES commands, you need a current rendering context.

```
class EAGLContext
```

## Overview

Drawing resources, such as textures and renderbuffers, are managed for the [`EAGLContext`](/documentation/OpenGLES/EAGLContext) object by an [`EAGLSharegroup`](/documentation/OpenGLES/EAGLSharegroup) object associated with the context. When you initialize a new [`EAGLContext`](/documentation/OpenGLES/EAGLContext) object, you can choose to have it create a new sharegroup, or you can use one obtained from a previously created context.

Before drawing to a context, you must bind a complete framebuffer object to the context. For more information on configuring rendering contexts, see [OpenGL ES Programming Guide](https://developer.apple.com/library/archive/documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40008793).

## Topics

### Creating Contexts

[`init(api:)`](/documentation/OpenGLES/EAGLContext/init(api:)-q09o)

Initializes and returns a newly allocated rendering context with the specified version of the OpenGL ES rendering API.

[`init(api:sharegroup:)`](/documentation/OpenGLES/EAGLContext/init(api:sharegroup:)-2rt8m)

Initializes and returns a newly allocated rendering context with the specified version of OpenGL ES rendering API and the specified sharegroup.

### Setting the Current Context

[`setCurrent(_:)`](/documentation/OpenGLES/EAGLContext/setCurrent(_:))

Makes the specified context the current rendering context for the calling thread.

### Attaching Storage to a Renderbuffer

[`renderbufferStorage(_:from:)`](/documentation/OpenGLES/EAGLContext/renderbufferStorage(_:from:))

Binds a drawable object’s storage to an OpenGL ES renderbuffer object.

### Displaying a Renderbuffer

[`presentRenderbuffer(_:)`](/documentation/OpenGLES/EAGLContext/presentRenderbuffer(_:))

Displays a renderbuffer’s contents on screen.

### Getting Context Information

[`api`](/documentation/OpenGLES/EAGLContext/api)

The OpenGL ES rendering API version supported by the context. (read-only)

[`sharegroup`](/documentation/OpenGLES/EAGLContext/sharegroup)

The context’s sharegroup object. (read-only)

[`debugLabel`](/documentation/OpenGLES/EAGLContext/debugLabel)

A label describing the context for use in debugging.

[`current()`](/documentation/OpenGLES/EAGLContext/current())

Returns the current rendering context for the calling thread.

### Enabling OpenGL ES Multithreading

[`isMultiThreaded`](/documentation/OpenGLES/EAGLContext/isMultiThreaded)

A Boolean value that determines whether OpenGL ES defers work to another thread.

### Constants

[`EAGLRenderingAPI`](/documentation/OpenGLES/EAGLRenderingAPI)

Versions of OpenGL ES that a rendering context provides.

### Instance Methods

[`presentRenderbuffer(_:afterMinimumDuration:)`](/documentation/OpenGLES/EAGLContext/presentRenderbuffer(_:afterMinimumDuration:))

[`presentRenderbuffer(_:atTime:)`](/documentation/OpenGLES/EAGLContext/presentRenderbuffer(_:atTime:))

[`texImageIOSurface(_:target:internalFormat:width:height:format:type:plane:)`](/documentation/OpenGLES/EAGLContext/texImageIOSurface(_:target:internalFormat:width:height:format:type:plane:))



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)