Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat is required to compile and run GLSL programs?
    primarykey
    data
    text
    <p>I'm trying to run a <a href="http://www.cs.unm.edu/~angel/BOOK/INTERACTIVE_COMPUTER_GRAPHICS/FIFTH_EDITION/PROGRAMS/CHAPTER09/PHONG/phongV.c" rel="nofollow noreferrer">GLSL example</a>, but I can't.</p> <p>The error is in the line <code>glGetShaderiv(vShader, GL_COMPILE_STATUS, &amp;status);</code> where the program exits. <code>vShader</code> is the file <a href="http://www.cs.unm.edu/~angel/BOOK/INTERACTIVE_COMPUTER_GRAPHICS/FIFTH_EDITION/PROGRAMS/CHAPTER09/PHONG/vPhong.glsl" rel="nofollow noreferrer"><code>vPhong.glsl</code></a>.</p> <p>The error returned is:</p> <pre><code>0(18) : error C0000: syntax error, unexpected $undefined at token "&lt;undefined&gt;" 0(18) : error C0501: type name expected at token "&lt;undefined&gt;" </code></pre> <p>I have 'installed' and referenced GLEW and Glut and their lib-files. I have <code>glewInit</code>'ed my program.</p> <p>The program is able to find the .glsl-files.</p> <p>The weird thing is that I am able to run a <a href="http://www.cs.unm.edu/~angel/BOOK/INTERACTIVE_COMPUTER_GRAPHICS/FIFTH_EDITION/PROGRAMS/WINDOWS_BINARIES/GLSL/GLSL%20Example/Debug/GLSL%20Example.exe" rel="nofollow noreferrer">precompiled GLSL-demo</a>, and also compile and run <a href="http://www.cs.unm.edu/~angel/BOOK/INTERACTIVE_COMPUTER_GRAPHICS/FIFTH_EDITION/PROGRAMS/WINDOWS_BINARIES/GLSL/" rel="nofollow noreferrer">the project</a> on my pc. The "initializations" in the non-working program and this are the same.</p> <p>I have tried copying the defective source into the successful project, to see if there was something in the project settings causing the error, but unfortunately, that wasn't the case. <strong>So the error seems to be in the C++ code, not the project.</strong></p> <hr> <p><strong>PROGRESS:</strong></p> <p>On my Windows 7-machine i got "Access violation" when running through Visual Studio. The program just stopped working if I ran it "alone". On a Windows XP-machine I got an uncaught exception.</p> <p>I received no errors or warnings (apart from a warning that <code>fopen</code> is unsafe) when I compiled the program.</p> <p>Visual Studio highlighted the line <code>vShader = glCreateShader(GL_VERTEX_SHADER);</code> as the source of the error.</p> <p>Adding <code>glewInit();</code> fixed the above errors.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload