hello I am pretty new to glsl and opengl
I have the 2 shaders attached and they are compiled successfully but the program linking fails like in exception image attachment what wrong i did ?? , forgive about my bad english
hello I am pretty new to glsl and opengl
I have the 2 shaders attached and they are compiled successfully but the program linking fails like in exception image attachment what wrong i did ?? , forgive about my bad english
Please provide some more code. The error you posted shouldn't have anything to do with OpenGL itself. Memory access violations occur if you try to read or write to a memory location that is not reserved for your program. For example, if you access the 3. element of an array which only has 2 members or if you store a reference/pointer to an object which is deleted before you use it.
yes sure, the shader is the parent of all of my shaders it got some common functions to set uniforms and to compile , link program and the shader info is the place where I hold path and type of shader and the entity shader is the child of shader that I am using to render that uses the attached vertex and fragment shader
24 minutes ago, DerTroll said:Please provide some more code. The error you posted shouldn't have anything to do with OpenGL itself. Memory access violations occur if you try to read or write to a memory location that is not reserved for your program. For example, if you access the 3. element of an array which only has 2 members or if you store a reference/pointer to an object which is deleted before you use it.
here is the full project on github https://github.com/ahmedTohami/opentk
Don't know much about c#, but I couldn't detect anything that looks like an obvious error. Try setting a breakpoint in each line of the foreach loop and at the linkProgram command and step through them step by step until the program crashes. Sometimes the wrong line is marked when an error occurs. If your IDE is telling the truth, you should loop through the breakpoints twice before you get to the line which links the program. Also, check the values at each breakpoint. Especially what is inside both lists.
9 minutes ago, DerTroll said:Don't know much about c#, but I couldn't detect anything that looks like an obvious error. Try setting a breakpoint in each line of the foreach loop and at the linkProgram command and step through them step by step until the program crashes. Sometimes the wrong line is marked when an error occurs. If your IDE is telling the truth, you should loop through the breakpoints twice before you get to the line which links the program. Also, check the values at each breakpoint. Especially what is inside both lists.
when I did what you told and I modified the fragment shader code to like in attachment and now as you see it passed sounds the problem comes from the fragment shader code
Okay, well, in your compile function there is this one branch:
if (!string.IsNullOrEmpty(log))
{
Console.WriteLine("failed to comile sahder " + path + '\n' + log);
}
Have you checked the console output when the program still crashed? As I said, I have no experience with C#, but if your shader did not compile, it does not seem like the program will stop. It just writes something to the output and goes on. In this case the access violation is not the initial error and therefore not relevant. Maybe an exception is the better choice there. Did you also check if this branch even get's triggered if there is a mistake in a shader? Put an obvious mistake into your shader and check the output of the console.
1 minute ago, DerTroll said:Okay, well, in your compile function there is this one branch:
if (!string.IsNullOrEmpty(log)) { Console.WriteLine("failed to comile sahder " + path + '\n' + log); }
Have you checked the console output when the program still crashed? As I said, I have no experience with C#, but if your shader did not compile, it does not seem like the program will stop. It just writes something to the output and goes on. In this case the access violation is not the initial error and therefore not relevant. Maybe an exception is the better choice there. Did you also check if this branch even get's triggered if there is a mistake in a shader? Put an obvious mistake into your shader and check the output of the console.
yes i am working on it
12 minutes ago, mandolinable said:yes i am working on it
in the watch window something i can not understand the compilation status is 1 that means successful how ever GL.getshader returns length = 483 for log and gl.getshaderinfolog returns an empty string how come ?