---
id: wiki-2026-0508-opengl-es
title: OpenGL ES
category: 10_Wiki/Topics
status: verified
canonical_id: self
aliases: [GLES, OpenGL for Embedded Systems]
duplicate_of: none
source_trust_level: A
confidence_score: 0.9
verification_status: applied
tags: [graphics, mobile, gpu, rendering]
raw_sources: []
last_reinforced: 2026-05-10
github_commit: pending
tech_stack:
  language: GLSL
  framework: OpenGL ES 3.2
---

# OpenGL ES

## 매 한 줄
> **"매 mobile/embedded GPU 의 lingua franca — 2026 에도 매 Android/legacy iOS 매 핵심 graphics API"**. Khronos Group 매 2003 발표 이래로 매 모바일 3D rendering standard, 매 modern Vulkan 으로 매 점진적 migration 진행 중이지만 매 GLES 3.2 매 widespread support (99%+ Android devices).

## 매 핵심

### 매 versions
- **GLES 1.x** (2003): Fixed-function pipeline. 매 deprecated.
- **GLES 2.0** (2007): Programmable shaders (vertex + fragment). 매 baseline.
- **GLES 3.0** (2012): Transform feedback, instancing, MSAA, ETC2 textures.
- **GLES 3.1** (2014): Compute shaders, indirect draws, SSBO.
- **GLES 3.2** (2015): Geometry/tessellation shaders, ASTC, debug output.

### 매 platform support
- **Android**: 매 native API (NDK + EGL). 매 99%+ devices support GLES 3.0+.
- **iOS**: 매 deprecated since iOS 12 (Metal preferred), 매 still functional.
- **WebGL**: 매 GLES 2.0/3.0 subset over JavaScript.
- **Embedded Linux**: 매 Mali/Adreno/PowerVR drivers.

### 매 응용
1. Mobile games (Unity/Unreal default backend on legacy Android).
2. Map rendering (Mapbox GL, Google Maps).
3. AR frameworks (ARCore rendering layer).
4. Video filters (Snapchat, Instagram shaders).

## 💻 패턴

### EGL context init (Android NDK)
```c
EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
eglInitialize(display, NULL, NULL);

EGLint attribs[] = {
    EGL_RENDERABLE_TYPE, EGL_OPENGL_ES3_BIT,
    EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
    EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8,
    EGL_DEPTH_SIZE, 24,
    EGL_NONE
};
EGLConfig config;
EGLint num_configs;
eglChooseConfig(display, attribs, &config, 1, &num_configs);

EGLint ctx_attribs[] = { EGL_CONTEXT_CLIENT_VERSION, 3, EGL_NONE };
EGLContext context = eglCreateContext(display, config, EGL_NO_CONTEXT, ctx_attribs);
EGLSurface surface = eglCreateWindowSurface(display, config, native_window, NULL);
eglMakeCurrent(display, surface, surface, context);
```

### Vertex + fragment shader (GLES 3.0)
```glsl
// vertex.glsl
#version 300 es
layout(location = 0) in vec3 a_position;
layout(location = 1) in vec2 a_uv;
uniform mat4 u_mvp;
out vec2 v_uv;
void main() {
    v_uv = a_uv;
    gl_Position = u_mvp * vec4(a_position, 1.0);
}

// fragment.glsl
#version 300 es
precision mediump float;
in vec2 v_uv;
uniform sampler2D u_tex;
out vec4 fragColor;
void main() {
    fragColor = texture(u_tex, v_uv);
}
```

### Shader compile + link
```c
GLuint compile(GLenum type, const char *src) {
    GLuint s = glCreateShader(type);
    glShaderSource(s, 1, &src, NULL);
    glCompileShader(s);
    GLint ok; glGetShaderiv(s, GL_COMPILE_STATUS, &ok);
    if (!ok) { char log[512]; glGetShaderInfoLog(s, 512, NULL, log); LOGE("%s", log); }
    return s;
}
GLuint vs = compile(GL_VERTEX_SHADER, vsrc);
GLuint fs = compile(GL_FRAGMENT_SHADER, fsrc);
GLuint prog = glCreateProgram();
glAttachShader(prog, vs); glAttachShader(prog, fs);
glLinkProgram(prog);
```

### VBO + VAO setup (GLES 3.0)
```c
GLuint vao, vbo;
glGenVertexArrays(1, &vao);
glGenBuffers(1, &vbo);
glBindVertexArray(vao);
glBindBuffer(GL_ARRAY_BUFFER, vbo);
glBufferData(GL_ARRAY_BUFFER, sizeof(verts), verts, GL_STATIC_DRAW);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5*sizeof(float), (void*)0);
glEnableVertexAttribArray(0);
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5*sizeof(float), (void*)(3*sizeof(float)));
glEnableVertexAttribArray(1);
```

### Texture upload
```c
GLuint tex;
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glGenerateMipmap(GL_TEXTURE_2D);
```

### Compute shader (GLES 3.1+)
```glsl
#version 310 es
layout(local_size_x = 16, local_size_y = 16) in;
layout(rgba8, binding = 0) uniform image2D u_img;
void main() {
    ivec2 p = ivec2(gl_GlobalInvocationID.xy);
    vec4 c = imageLoad(u_img, p);
    imageStore(u_img, p, vec4(1.0 - c.rgb, c.a)); // invert
}
```
```c
glUseProgram(compute_prog);
glBindImageTexture(0, tex, 0, GL_FALSE, 0, GL_READ_WRITE, GL_RGBA8);
glDispatchCompute(w/16, h/16, 1);
glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT);
```

### Framebuffer object (offscreen render)
```c
GLuint fbo, color, depth;
glGenFramebuffers(1, &fbo);
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
glGenTextures(1, &color);
glBindTexture(GL_TEXTURE_2D, color);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, color, 0);
glGenRenderbuffers(1, &depth);
glBindRenderbuffer(GL_RENDERBUFFER, depth);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, w, h);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depth);
```

## 매 결정 기준
| 상황 | Approach |
|---|---|
| New mobile project (2026) | Vulkan (Android) / Metal (iOS) |
| Cross-platform legacy support | OpenGL ES 3.0 |
| Web target | WebGL 2.0 (GLES 3.0 subset) / WebGPU |
| Compute on mobile | GLES 3.1 compute or Vulkan compute |
| Maximum device reach | GLES 2.0 (단 functionality 제약) |

**기본값**: 매 new code 매 Vulkan, 매 legacy support 매 GLES 3.0.

## 🔗 Graph
- 부모: [[GPU-Programming]]
- 변형: [[Vulkan]] · [[Metal]] · [[WebGL]] · [[WebGPU]]
- 응용: [[Mobile-Augmented-Reality]]
- Adjacent: [[GLSL]]

## 🤖 LLM 활용
**언제**: 매 cross-platform mobile graphics, 매 WebGL/embedded targeting, 매 legacy Android (API < 24) 매 support 필요.
**언제 X**: 매 modern Android-only (Vulkan), 매 iOS-only (Metal), 매 desktop-first (Vulkan/DX12).

## ❌ 안티패턴
- **glGetError 매 polling 매 hot loop**: 매 sync stall — 매 KHR_debug callback 사용.
- **매 frame VBO 매 recreate**: 매 GPU memory thrash — 매 persistent buffer + glBufferSubData.
- **precision highp 매 fragment shader 남용**: 매 mobile GPU 성능 hit — 매 mediump default.
- **immediate mode mindset**: 매 GLES 매 retained mode — 매 batch draw calls.
- **driver-specific extensions 의존**: 매 portability 깨짐 — 매 core spec 우선.

## 🧪 검증 / 중복
- Verified (Khronos OpenGL ES 3.2 spec, Android NDK docs).
- 신뢰도 A.

## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — full GLES API guide with EGL/shader/compute patterns |
