Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
WebGL Tutorial
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
최형택
WebGL Tutorial
Commits
cd282adc
Commit
cd282adc
authored
3 years ago
by
Hyung-Taik Choi
Browse files
Options
Downloads
Patches
Plain Diff
Update header tags in README
parent
78c5cd25
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
README.md
+20
-21
20 additions, 21 deletions
README.md
with
20 additions
and
21 deletions
README.md
+
20
−
21
View file @
cd282adc
...
@@ -39,10 +39,10 @@
...
@@ -39,10 +39,10 @@
## Moving from WebGL1 to WebGL2
## Moving from WebGL1 to WebGL2
1.
`getContext`
를 호출할 때
`webgl`
대신
`webgl2`
를 사용한다.
###
`getContext`를 호출할 때 `webgl` 대신 `webgl2`를 사용한다.
`var gl = someCanvas.getContext("webgl2");`
`var gl = someCanvas.getContext("webgl2");`
2.
WebGL1의 많은 확장들이 WebGL2 표준에 포함되어 확장을 덜 사용해도 된다.
###
WebGL1의 많은 확장들이 WebGL2 표준에 포함되어 확장을 덜 사용해도 된다.
WebGL1:
WebGL1:
```
javascript
```
javascript
var
ext
=
gl
.
getExtension
(
"
OES_vertex_array_object
"
);
var
ext
=
gl
.
getExtension
(
"
OES_vertex_array_object
"
);
...
@@ -55,9 +55,9 @@ if (!ext) {
...
@@ -55,9 +55,9 @@ if (!ext) {
WebGL2:
WebGL2:
`var someVAO = gl.createVertexArray();`
`var someVAO = gl.createVertexArray();`
3.
`GLSL 300 es`
사용하기
###
`GLSL 300 es` 사용하기
사용하는 쉐이더를 GLSL 3.00 ES로 업그레이드 하면 좋다. 그러기 위해선 쉐이더 선언의 첫 줄이
`#version 300 es`
면 된다. 반드시 첫 줄이여야 하기 때문에 주석이나 개행이 이루어지면 안된다.
사용하는 쉐이더를 GLSL 3.00 ES로 업그레이드 하면 좋다. 그러기 위해선 쉐이더 선언의 첫 줄이
`#version 300 es`
면 된다. 반드시 첫 줄이여야 하기 때문에 주석이나 개행이 이루어지면 안된다.
안 좋은 예:
```
javascript
```
javascript
// BAD!!!! +---There's a new line here!
// BAD!!!! +---There's a new line here!
// BAD!!!! V
// BAD!!!! V
...
@@ -65,18 +65,17 @@ var vertexShaderSource = `
...
@@ -65,18 +65,17 @@ var vertexShaderSource = `
#version 300 es
#version 300 es
..
..
`
;
`
;
```
좋은 예:
// GOOD
```
javascript
var
vertexShaderSource
=
`#version 300 es
var
vertexShaderSource
=
`#version 300 es
...
...
`
;
`
;
```
```
1.
`attribute`
을
`in`
으로 바꾸기
2.
`varying`
을
`in/out`
으로 바꾸기
#### `attribute`을 `in`으로 바꾸기
3.
`gl_FragColor`
대신 원하는 변수 사용 가능
#### `varying`을 `in/out`으로 바꾸기
4.
`texture2D`
을
`texture`
로 바꾸기
#### `gl_FragColor` 대신 원하는 변수 사용 가능
#### `texture2D`을 `texture`로 바꾸기
```
javascript
```
javascript
// WebGL1
// WebGL1
vec4
color1
=
texture2D
(
u_some2DTexture
,
...);
vec4
color1
=
texture2D
(
u_some2DTexture
,
...);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment