小编Igg*_*ggy的帖子

结构中的GLSL sampler2D

在GLSL中,当我尝试将带有sampler2D属性的统一结构传递给前向声明的函数时,似乎存在着色器的链接错误.如果我删除前向声明并将函数移到main之上,则代码有效.这是非法代码吗?

#version 330 core

in vec2 texcoords;
out vec4 color;

struct Material{
    sampler2D tex; // Sampler inside a struct
}; 

uniform Material material;

// Forward Declaration
vec4 add(Material m);

void main() {
    color = add(material);
}

// Function Definition
vec4 add(Material m) {
    return vec4(texture(m.tex, texcoords));
}

// C++
glUniform1f(glGetUniformLocation(shader, "material.tex"), 0);
glBindTexture(GL_TEXTURE_2D, texture);
Run Code Online (Sandbox Code Playgroud)

编辑: 所以经过一些搜索后,它似乎是AMD驱动程序中的一个错误.我个人使用ATI Mobility Radeon HD 4670,它很老,但它仍然运行OpenGL 3.3.在AMD的论坛上,我发现了一个类似的帖子,所以知道AMD的显卡有多大会很有趣.因为如果您正在开发英特尔或NVidia,那么您如何知道您的着色器无法在某些AMD的图形卡上编译?我们应该保持安全,不要在带有采样器的结构上使用原型,甚至不要将采样器完全放入结构中吗?...还值得注意的是,WebGL甚至不允许采样器在结构内部.

错误信息:

Vertex shader(s) failed to link, fragment shader(s) failed to link.
unexpected error. …
Run Code Online (Sandbox Code Playgroud)

opengl glsl

5
推荐指数
1
解决办法
3777
查看次数

如何为 Google Play 游戏签署 Unity 应用程序包

我需要从 Unity 签署我的 Android 应用程序包才能将其上传到 Google Play。我已经完成了在三个不同版本中签名的步骤;但是当我构建和上传时,我不断收到错误

要在 Unity 2019.2 中签署应用程序包,我将打开构建设置,勾选构建应用程序包的箭头;然后导航至播放器设置;发布设置,创建新的密钥库和带有密码的别名。并构建。与 2019.1 和 2018.4 几乎相同。

例子:

例子

我希望应用程序包能够被签名并上传;然而谷歌游戏一直说它没有签名。

signing unity-game-engine google-play

5
推荐指数
1
解决办法
6219
查看次数

标签 统计

glsl ×1

google-play ×1

opengl ×1

signing ×1

unity-game-engine ×1