Programming and animation
Programming and animation ideas, articles, tutors, scripts, plugins in the 3d-
GLSL shaders tips: NVidia and AMD difference.
Posted on 29 May 2010 Neill No commentsOn my personal experience in adaptation glsl shaders to AMD.I wrote “adaptation”, because this process can not be called in another manner, after setting up under the NVidia card.1) AMD does not like ARB_draw_buffers require flag in the shader. And if you do not specify any flag at all, shader compiles without any problems. But NVidia gives me a warning that I should include this flag to work with MRT.When the Cg shaders, there is another story, you need a ATI_draw_buffers flag.http://developer.nvidia.com/forums/index.php?showtopic=2572
http://developer.nvidia.com/forums/index.php?showtopic=2703&st=0&gopid=7686&#entry7686
2) AMD swears the presence sampler2DRect and sampler2D in one shader. Also from the category of “not paying attention” on such a warning.Graphics, Miscellaneous GLSL, OpenGL, shaders, Tips -
GLSL shaders notes
Posted on 9 November 2009 Neill No commentsIn the course of work with the GLSL shaders I have a few helpful notes on compatibility:
1) # version 120 – a string indicating the version of the shader should be the first in the code, otherwise ATI swears at compile time. I have this error was the result of the shader assembly of parts.2) most of the old ATI and INTEL cards do not support glsl shaders, instead they have only enhance GL_ARB_VERTEX_PROGRAM, GL_ARB_FRAGMENT_PROGRAM. Out here there is very concise – download library CG from NVidia and recompile the shaders into the arb programs.
For example: cgc-glsl shader.glsl-profile arbvp1-o vertex.vp
In this case, profile arbvp1 for vertex programs and arbfp1 – for the fragment.
3) The emergence glsl shaders, command glGetString complemented with new possible argument GL_SHADING_LANGUAGE_VERSION, which returns the version of the glsl shader.
4) Remember that NVidia has a very useful utility ShaderPerf – analysis of the number of shader instructions, and the speed of execution, as well as sweep shader performance for different video cards and a family of graphics NVidia chipsets. There is also an opportunity to compare the performance of two different shaders to each other.
5) Do not specify real numbers with f at the end as 1.0f, simply write 1.0. Also, ATI is very picky to the writting a real number with no fractional part.
6) Useful utility OpenGL Extension Viewer with a database of support OpenGL extensions for most video cards. http://www.realtech-vr.com/glview/
Graphics, Programming GLSL, OpenGL, Tips -
GLSL error – pre-mature EOF
Posted on 25 September 2009 Neill No commentsAt a ATI video cards shaders refuse to compile reference to this error. The reason – comments in Russian.
Graphics, Programming GLSL, OpenGL, Tips -
GLSL: missing uniform location
Posted on 9 September 2009 Neill No commentsI have faced with such a feature of the GLSL compiler. If the variable is not used in the shader, then find its location there would be no possibility, it is simply truncated from the shader.
The search function on behalf of the Uniform position.
int loc = glGetUniformLocationARB (, ); Moreover, even if caught insidious, like the variable is used, but the result of further calculations is not, and that’s why, again, to find the ancestral variable is not possible.
Graphics, Programming C++, GLSL, OpenGL -
GLSL error C7549
Posted on 17 January 2009 Neill 2 commentsCompiling of my old glsl fragment shader was fall down with warning C7549: OpenGL does not allow C style initializers and warning
In fragment shader I have float array
1float weights[] = float[](1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
171.0000,
0.9394,
0.7788,
0.5697,
0.3678,
0.2096,
0.1053,
0.0467,
0.01831);To make it work properly, I add #version 120 command to my fragment shader, and rewrite array like this:
1float weights[] = float[](1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
171.0000,
0.9394,
0.7788,
0.5697,
0.3678,
0.2096,
0.1053,
0.0467,
0.0183Graphics GLSL, OpenGL1);

English
Russian
Recent Comments