小编Ben*_*Ben的帖子

GLSL 1.0.0 - 在顶点和片段着色器中使用“Varying”时出现问题

我正在使用 OpenGL ES 2.0.0 和 GLSL ES 1.0.0 进行开发。

目前我正在将一个正方形渲染到屏幕上,现在尝试应用纹理。

我在顶点和片段着色器中使用“不同”时遇到问题,收到错误消息:

- Failed to compile vertex shader - 
0(3) : error C5060: out can't be used with non-varying tex_varying

in vec4 texture_coord ;
in vec4 position ;
out vec2 tex_varying ;
uniform mat4 translate ;
void main ( ) 
{
  gl_Position = translate * position ;
  tex_varying = texture_coord . xy ;
}
Run Code Online (Sandbox Code Playgroud)

我已阅读文档,但无法弄清楚我做错了什么。

这是代码。

顶点:

attribute vec4 position; 
attribute vec4 texture_coord; 
varying vec2 tex_varying; 
uniform mat4 translate; 

void …
Run Code Online (Sandbox Code Playgroud)

c++ shader opengl-es glsl

4
推荐指数
1
解决办法
6070
查看次数

标签 统计

c++ ×1

glsl ×1

opengl-es ×1

shader ×1