日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

OpenGL 与 GLSL 版本号

發(fā)布時間:2025/3/21 编程问答 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 OpenGL 与 GLSL 版本号 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

來自:https://github.com/mattdesl/lwjgl-basics/wiki/GLSL-Versions

You can use the?#version?command as the first line of your shader to specify GLSL version:

#version 120void main() {gl_FragColor = vec4(1.0); }

GLSL versions are released alongside GL versions. See the following charts to decide which version you would like to target.

GLSL Versions

OpenGL VersionGLSL Version
2.0110
2.1120
3.0130
3.1140
3.2150
3.3330
4.0400
4.1410
4.2420
4.3430

GLSL ES Versions (Android, iOS, WebGL)

OpenGL ES has its own Shading Language, and the versioning starts fresh. It is based on OpenGL Shading Language version 1.10.

OpenGL ES VersionGLSL ES Version
2.0100
3.0300

So, for example, if a feature is available in GLSL 120, it probably won't be available in GLSL ES 100 unless the ES compiler specifically allows it.

Differences at a Glance

Differences between (desktop) GLSL versions.

Version 100

Vertex shader:

uniform mat4 projTrans;attribute vec2 Position; attribute vec2 TexCoord;varying vec2 vTexCoord;void main() {vTexCoord = TexCoord;gl_Position = u_projView * vec4(Position, 0.0, 1.0); }

Fragment shader:

uniform sampler2D tex0;varying vec2 vTexCoord;void main() {vec4 color = texture2D(tex0, vTexCoord);gl_FragColor = color; }

Version 330

As of GLSL 130+,?in?and?out?are used instead of?attribute?and?varying. GLSL 330+ includes other features like layout qualifiers and changes?texture2D?to?texture.

Vertex shader:

#version 330uniform mat4 projTrans;layout(location = 0) in vec2 Position; layout(location = 1) in vec2 TexCoord;out vec2 vTexCoord;void main() {vTexCoord = TexCoord;gl_Position = u_projView * vec4(Position, 0, 1); }

Fragment shader:

#version 330 uniform sampler2D tex0;in vec2 vTexCoord;//use your own output instead of gl_FragColor out vec4 fragColor;void main() {//'texture' instead of 'texture2D'fragColor = texture(tex0, vTexCoord); }

Other Significant Changes

GLSL 120 Additions

  • You can initialize arrays within a shader, like so:
float a[5] = float[5](3.4, 4.2, 5.0, 5.2, 1.1); float b[5] = float[](3.4, 4.2, 5.0, 5.2, 1.1);

However, the above is not supported on Mac OSX Snow Leopard, even with GLSL 120.(1)

  • You can initialize uniforms in a shader, and the value will be set at link time:
uniform float val = 1.0;
  • You can use built-ins like?sin()?when setting a?const?value
  • Integers are implicitly converted to floats when necessary, for example:
float f = 1.0; <-- valid float g = 1; <-- only supported in GLSL 120 vec2 v = vec2(1, 2.0); <-- only supported in GLSL 120
  • You can use?f?to define a float:?float f = 2.5f;

GLSL 130 Additions

  • int?and?uint?support (and bitwise operations with them)
  • switch?statement support
  • New built-ins:?trunc(),?round(),?roundEven(),?isnan(),?isinf(),?modf()
  • Fragment output can be user-defined
  • Input and output is declared with?in?and?out?syntax instead of?attribute?andvarying

GLSL 150 Additions

  • texture()?should now be used instead of?texture2D()

GLSL 330 Additions

  • Layout qualifiers can declare the location of vertex shader inputs and fragment shader outputs, eg:
layout(location = 2) in vec3 values[4];

Formally this was only possible with?ARB_explicit_attrib_location?extension

總結(jié)

以上是生活随笔為你收集整理的OpenGL 与 GLSL 版本号的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 日韩一区二区三区四区在线 | 国产区在线观看 | 99热官网 | 高潮毛片7777777毛片 | 女婴高潮h啪啪 | 亚洲免费av网 | 恶虐女帝安卓汉化版最新版本 | 天堂网av在线 | 91香蕉黄| 国产精品久久久久久人 | 日产精品一区二区 | 亚洲人视频在线观看 | 中文字幕网址在线 | 黄色片视频在线观看 | 国产a久久 | 精品69 | 夜夜摸夜夜爽 | 国产女主播喷水视频在线观看 | 成年人在线免费观看 | 久热精品免费视频 | 狠狠狠狠狠狠狠干 | 强开小嫩苞一区二区三区网站 | 久久极品 | 岛国片在线免费观看 | 日本免费在线视频观看 | av成人在线免费观看 | 久久久久久久久亚洲 | 伊人av网 | 精品人妻中文无码av在线 | 欧美深夜在线 | 中文有码在线 | 美女av网址 | 成人做爰69片免费观看 | 久久久久久久久久久久国产精品 | 久久人人爽人人人人片 | 黄色一级片av| 久久久久久国 | 在线天堂中文字幕 | 亲子乱一区二区三区 | 亚洲激情视频小说 | 美女光屁屁露胸胸 | 亚洲精品久久一区二区三区777 | 99精品网站| 99精品区 | 色爽 av| 爱情岛论坛自拍亚洲品质极速最新章 | 神秘马戏团在线观看免费高清中文 | 新版红楼梦在线高清免费观看 | 午夜a视频| 成年人免费毛片 | 日本午夜激情 | 蜜桃成人在线视频 | 自拍偷拍第2页 | 欧美日一区二区 | 国产精品一区在线 | 三度诱惑免费版电影在线观看 | 樱花电影最新免费观看国语版 | 午夜精品久久久久久久久久蜜桃 | 欧美a级在线免费观看 | 91chinese在线| 亚洲精品免费网站 | 亚洲毛片在线观看 | 国产日韩欧美不卡 | 日韩亚洲精品中文字幕 | 国产精品自拍偷拍 | 国产又粗又猛又爽 | 亚洲AV无码国产精品午夜字幕 | 91九色中文 | 成熟了的熟妇毛茸茸 | 中文字字幕一区二区三区四区五区 | 亚洲熟妇av一区二区三区漫画 | 国产91视频在线观看 | 丁香五色月 | 一个色在线 | 亚洲精品一区三区三区在线观看 | 国产精品-区区久久久狼 | 国产精视频 | xxxxwww国产| 天堂在线播放 | 人妻丝袜一区二区三区 | 欧美日韩综合一区二区 | 日韩精品国产一区 | 91抖音成人 | 九色麻豆| 亚洲做受高潮 | 麻豆网站在线免费观看 | 禁漫天堂在线 | 日本两性视频 | av免费在线观 | 成人性做爰aaa片免费看不忠 | 性生交大片免费看l | 美女福利视频在线 | 日韩av在线影院 | 国产xx在线观看 | 黄色成人在线网站 | 2019年中文字幕 | 91在线视频在线观看 | 黄色网免费 | 色欲狠狠躁天天躁无码中文字幕 |