質問するログイン新規登録

質問編集履歴

3

更新

2019/04/23 12:41

投稿

miiichat
miiichat

スコア72

title CHANGED
File without changes
body CHANGED
@@ -7,11 +7,7 @@
7
7
  texture2Dは削除されたとあるみたいですが、調べてみてもよくわかりませんでした、、
8
8
  #####error
9
9
  ```
10
- Compile Error infragment shader
10
+
11
- ERROR: 0:7: 'function' : is removed in Forward Compatible context texture2D
12
- ERROR: 0:7: 'texture2D' : no matching overloaded function found (using implicit conversion)
13
- ERROR: 0:7: 'texture2D' : function is not known
14
- ERROR: 0:6: 'assign' : cannot convert from 'const highp float' to 'FragUserData 4-component vector of highp float'
15
11
  ```
16
12
  #####
17
13
  ```pointvert
@@ -29,9 +25,9 @@
29
25
  #version 330 core
30
26
  in vec2 vuv;
31
27
  out vec4 fragment;
32
- uniform sampler2D texture;
28
+ uniform sampler2D tex;
33
29
  void main(void){
34
- fragment = texture2D(texture, vuv);
30
+ fragment = texture(tex, vuv);
35
31
  }
36
32
  ```
37
33
  ```main
@@ -296,7 +292,7 @@
296
292
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
297
293
 
298
294
  glBindTexture(GL_TEXTURE_2D, 0);
299
- int textureLocation = glGetUniformLocation(program, "texture");
295
+ int textureLocation = glGetUniformLocation(program, "tex");
300
296
  glUniform1i(textureLocation, 0);
301
297
  }
302
298
 

2

更新

2019/04/23 12:40

投稿

miiichat
miiichat

スコア72

title CHANGED
File without changes
body CHANGED
@@ -8,13 +8,10 @@
8
8
  #####error
9
9
  ```
10
10
  Compile Error infragment shader
11
- ERROR: 0:? : 'variable' : is removed in Forward Compatible context gl_FragColor
12
- ERROR: 0:6: 'function' : is removed in Forward Compatible context texture2D
11
+ ERROR: 0:7: 'function' : is removed in Forward Compatible context texture2D
13
- ERROR: 0:6: 'texture2D' : no matching overloaded function found (using implicit conversion)
12
+ ERROR: 0:7: 'texture2D' : no matching overloaded function found (using implicit conversion)
14
- ERROR: 0:6: 'texture2D' : function is not known
13
+ ERROR: 0:7: 'texture2D' : function is not known
15
- ERROR: 0:5: 'assign' : cannot convert from 'const mediump float' to 'FragColor 4-component vector of mediump float'
14
+ ERROR: 0:6: 'assign' : cannot convert from 'const highp float' to 'FragUserData 4-component vector of highp float'
16
-
17
-
18
15
  ```
19
16
  #####
20
17
  ```pointvert

1

追加

2019/04/23 12:34

投稿

miiichat
miiichat

スコア72

title CHANGED
File without changes
body CHANGED
@@ -31,9 +31,10 @@
31
31
  ```pointfrag
32
32
  #version 330 core
33
33
  in vec2 vuv;
34
+ out vec4 fragment;
34
35
  uniform sampler2D texture;
35
36
  void main(void){
36
- gl_FragColor = texture2D(texture, vuv);
37
+ fragment = texture2D(texture, vuv);
37
38
  }
38
39
  ```
39
40
  ```main
@@ -124,7 +125,8 @@
124
125
  glAttachShader(program, fobj);
125
126
  glDeleteShader(fobj);
126
127
  }
128
+ glBindFragDataLocation(program, 0, "fragment");
127
- glLinkProgram(program);
129
+ glLinkProgram(program);
128
130
 
129
131
  if (printProgramInfoLog(program))
130
132
  return program;