WebGL
WebGL(Web Graphics Library)은 플러그인을 사용하지 않고 웹 브라우저에서 상호작용 가능한 3D와 2D 그래픽을 표현하기 위한 JavaScript API입니다. WebGL은 HTML5 <canvas>
요소에서 사용할 수 있는, OpenGL ES 2.0을 대부분 충족하는 API를 제공합니다.
WebGL은 Firefox 4+, Google Chrome 9+, Opera 12+, Safari 5.1+, Internet Explorer 11+, Microsoft Edge build 10240+에서 사용할 수 있습니다. 그러나 사용자 장치의 하드웨어도 WebGL 기능을 지원해야 합니다.
참고서
표준 인터페이스
확장
ANGLE_instanced_arrays
EXT_blend_minmax
EXT_color_buffer_float
EXT_color_buffer_half_float
EXT_disjoint_timer_query
EXT_float_blend
ExperimentalEXT_frag_depth
EXT_sRGB
EXT_shader_texture_lod
EXT_texture_compression_bptc
EXT_texture_compression_rgtc
EXT_texture_filter_anisotropic
OES_element_index_uint
OES_fbo_render_mipmap
ExperimentalOES_standard_derivatives
OES_texture_float
OES_texture_float_linear
OES_texture_half_float
OES_texture_half_float_linear
OES_vertex_array_object
WEBGL_color_buffer_float
WEBGL_compressed_texture_astc
WEBGL_compressed_texture_atc
WEBGL_compressed_texture_etc
WEBGL_compressed_texture_etc1
WEBGL_compressed_texture_pvrtc
WEBGL_compressed_texture_s3tc
WEBGL_compressed_texture_s3tc_srgb
WEBGL_debug_renderer_info
WEBGL_debug_shaders
WEBGL_depth_texture
WEBGL_draw_buffers
WEBGL_lose_context
이벤트
상수와 자료형
WebGL 2
WebGL 2는 WebGL2RenderingContext
인터페이스를 통해 제공되는 WebGL 메이저 업데이트다. OpenGL ES 3.0 을 기반으로 하며 다음과 같은 특징을 포함한다:
- 3D textures,
- Sampler objects,
- Uniform Buffer objects,
- Sync objects,
- Query objects,
- Transform Feedback objects,
- WebGL 2의 핵심이 된 확장 기능: Vertex Array objects, instancing, multiple render targets, fragment depth.
"WebGL 2 lands in Firefox" 블로그 포스트와와 and webglsamples.org/WebGL2Samples 데모도 참고.
안내서와 자습서
안내서
- WebGL의 데이터
-
WebGL 코드를 작성할 때 사용하는 변수, 버퍼와 그 외 다른 형태의 데이터를 알아봅니다.
- WebGL 우수 사례
-
WebGL 콘텐츠의 품질, 성능, 안정성을 높일 수 있는 팁과 제안입니다.
- 확장 사용
-
WebGL 확장을 사용하는 법을 알아봅니다.
자습서
- WebGL 자습서
-
초심자를 위한 WebGL 핵심 개념입니다. WebGL을 접해보지 않았다면 여기서 시작해보세요.
예제
- 기초 WebGL 2D 애니메이션 예제
-
This example demonstrates the simple animation of a one-color shape. Topics examined are adapting to aspect ratio differences, a function to build shader programs from sets of multiple shaders, and the basics of drawing in WebGL.
- 예제로 알아보는 WebGL
-
A series of live samples with short explanations that showcase WebGL concepts and capabilities. The examples are sorted according to topic and level of difficulty, covering the WebGL rendering context, shader programming, textures, geometry, user interaction, and more.
고급 자습서
- WebGL 모델 뷰 프로젝션
-
A detailed explanation of the three core matrices that are typically used to represent a 3D object view: the model, view and projection matrices.
- 웹을 위한 행렬 계산
-
A useful guide to how 3D transform matrices work, and can be used on the web — both for WebGL calculations and in CSS3 transforms.
참고자료
- Raw WebGL: An introduction to WebGL A talk by Nick Desaulniers that introduces the basics of WebGL. This is a great place to start if you've never done low-level graphics programming.
- Khronos WebGL site The main web site for WebGL at the Khronos Group.
- Learning WebGL A site with tutorials on how to use WebGL.
- WebGL Fundamentals A basic tutorial with fundamentals of WebGL.
- WebGL playground An online tool for creating and sharing WebGL projects. Good for quick prototyping and experimenting.
- WebGL Academy An HTML/JavaScript editor with tutorials to learn basics of webgl programming.
- WebGL Stats A site with statistics about WebGL capabilities in browsers on different platforms.
Libraries
- glMatrix is a JavaScript matrix and vector library for high-performance WebGL apps.
- PhiloGL is a WebGL framework for data visualization, creative coding, and game development.
- Pixi.js is a fast, open-source 2D WebGL renderer.
- PlayCanvas is an open-source game engine.
- Sylvester is an open-source library for manipulating vectors and matrices. Not optimized for WebGL but extremely robust.
- three.js is an open-source, fully featured 3D WebGL library.
- Phaser is a fast, free and fun open source framework for Canvas and WebGL powered browser games
명세
Specification |
---|
WebGL Specification # 5.14 |
WebGL 2.0 Specification # 3.7 |
브라우저 호환성
api.WebGLRenderingContext
BCD tables only load in the browser
api.WebGL2RenderingContext
BCD tables only load in the browser