My cross-platform graphics program uses shaders written in GLSL version 1.40. GLSL 1.40 features fully satisfy the needs of the application. In fact, very basic shaders are used for rendering textures:
vertex shader:
attribute vec2 position; attribute vec2 textureCoordinates; uniform mat3 transformationProjectionMatrix; varying vec2 interpolatedTextureCoordinates; void main() { interpolatedTextureCoordinates = textureCoordinates; gl_Position.xywz = vec4(transformationProjectionMatrix * vec3(position, 1.0), 0.0); }
fragment shader:
precision mediump float; uniform vec4 color; uniform sampler2D textureData; varying vec2 interpolatedTextureCoordinates; void main() { gl_FragColor.rgba = color * texture(textureData, interpolatedTextureCoordinates).bgra; }
Does it make sense to have several shaders in the program for different versions of GLSL that will be selected depending on the support on a specific hardware? Is it possible to get acceleration when using more modern versions of the shader language?
https://stackoverflow.com/questions/65545736/should-i-use-the-last-glsl-version-where-it-is-possible January 03, 2021 at 09:06AM
没有评论:
发表评论