nVidia GLSL不支持sampler1D? [英] sampler1D not supported in nVidia GLSL?

查看:379
本文介绍了nVidia GLSL不支持sampler1D?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

GLSL规范有关GLSL的其他资源,采样器类型有三个维度: sampler1D sampler2D sampler3D



然而,当我尝试在Chrome中使用WebGL编译GLSL程序(包括常规和加纳利)时, sampler2D sampler3D 被接受,但sampler1D给出语法错误。代码:

  uniform sampler1D tex1; 

错误:

  FS错误:错误:0:9:'sampler1D':语法错误

错误发生,即使我给金丝雀命令行参数 - 使用gl =桌面



我正在运行Chrome 12.0.742.68 beta-m和Canary 13.0.782.1。
我拥有的芯片组是Nvidia Quadro NVS 160M。



Nvidia可能允许2维和3维纹理采样器,但不支持1D?我尝试搜索信息,但没有发现任何东西。

解决方案

不,您的问题不相关到NVIDIA GLSL。 WebGL基于OpenGL ES 2.0,而OpenGL ES 2.0没有1D纹理,只有2D和3D纹理(作为扩展名),因此您将无法在WebGL中使用sampler1D。



解决方案?注意:如果您使用Desktop OpenGL(OpenGL> = 2.0),您将可以使用1D(1D)纹理和sampler1D。

In the GLSL spec, and other sources about GLSL, sampler types are available in 3 dimensions: sampler1D, sampler2D, and sampler3D.

However when I try to compile GLSL programs using WebGL in Chrome (both regular, and also in Canary), sampler2D and sampler3D are accepted but sampler1D gives a syntax error. Code:

uniform sampler1D tex1;

Error:

FS ERROR: ERROR: 0:9: 'sampler1D' : syntax error 

This error occurs even if I give Canary the command line argument --use-gl=desktop.

I am running Chrome 12.0.742.68 beta-m, and Canary 13.0.782.1. The chipset I have is Nvidia Quadro NVS 160M.

Is it possible that Nvidia allows 2- and 3-dimensional texture samplers, but not 1D? I've tried searching for information to that effect, but have not found anything.

解决方案

No, your problem isn't related to "NVIDIA GLSL". WebGL is based on OpenGL ES 2.0, and OpenGL ES 2.0 doesn't have 1D textures, only 2D and 3D textures (as extensions), so you won't be able to use a sampler1D in WebGL.

Solution? Just use a 2D texture with a height of 1 with a sampler2D.

Note: If you use Desktop OpenGL (OpenGL >= 2.0), you will be able to use 1D textures and sampler1D's.

这篇关于nVidia GLSL不支持sampler1D?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆