I am following OpenGL GLSL cookbook 4.0, I have rendered a tesselated quad, as you see in the screenshot below, and i am moving Y coordinate of every vertex using a time based sin function as given in the code in the book.

enter image description here

This program, as you see on the text in the image, runs perfectly on built in Intel HD graphics of my processor, but i have Nvidia GT 555m graphics in my laptop, (which by the way has switchable graphics) when I run the program on the graphic card, the OpenGL shader compilation fails.

It fails on following instruction..

pos.y = sin.waveAmp * sin(u);

giving error>> Error C1105 : Cannot call a non-function

I know this error is coming on the sin(u) function which you see in the instruction. I am not able to understand why? When i removed sin(u) from the code, the program ran fine on Nvidia card. Its running with sin(u) fine on Intel HD 3000 graphics.

Also, if you notice the program is almost unusable with intel HD 3000 graphics, I am getting only 9FPS, which is not enough. Its too much load for intel HD 3000.

So, sin(X) function is not defined in the OpenGL specification given by Nvidia drivers or something else??


1 Answer 1


You seem to have a variable called sin, and that interferes with the built-in function. Try changing the value name to something else.

  • 4
    \$\begingroup\$ +1 - Having two things with the same name is bad practice, even if in some cases the compiler allows it. I'm not sure what the GLSL spec has to say about it, but even if this should technically be OK for the compiler, it's confusing for coders. :) \$\endgroup\$ Commented Nov 2, 2013 at 16:21
  • 2
    \$\begingroup\$ @NathanReed It's really up to the drivers to implement the parsing and compiling process, and they do differ a bit from each other. In this case it seems the intel compiler is fine with it, but nvidia's override the built-in function. With a quick look I found nothing but this from the OpenGL wiki: opengl.org/wiki/Core_Language_(GLSL)#Reserved_names \$\endgroup\$
    – Lasse
    Commented Nov 2, 2013 at 16:25
  • 1
    \$\begingroup\$ I dunno, if this is really the LOC that throws the exception, given the unmistakable exception Cannot call a non-function I would say that sin in this scope is an object and not a function. @2am What GLSL compiler are you using? \$\endgroup\$ Commented Nov 2, 2013 at 16:30
  • \$\begingroup\$ its a fun in this scope., :) but i had a var defined as sin, which worked fine on Intel HD drivers but Nvidia implementation complained.. @LoSauer, I am sorry mate, I am not quite sure which compile is this, hell, i dont even knw we can check the version number of the compiler :) Where do we check that? \$\endgroup\$
    – 2am
    Commented Nov 2, 2013 at 17:18
  • \$\begingroup\$ @2am One way is through a google search of the vendor's driver Changelog, unless you are using a standalone compiler / debugger. In your case it could actually be either the Intel or Nvidia GLSL compiler that is used, depending on your current configuration... Cheers! \$\endgroup\$ Commented Nov 2, 2013 at 17:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .