Opengl Error Gllinkprogram - Gl_invalid_value
Contents |
OpenGL) GL_INVALID_OPERATION on glLinkProgram (Read 1055 times) 0 Members and 1 Guest are viewing this topic. lolz123 Sr. Member Posts: 259 (SFML + OpenGL) GL_INVALID_OPERATION on glLinkProgram « on: May 01, 2014, 05:53:45 pm » Hello,I am having some difficulties gllinkprogram error resolving a OpenGL related error. I am posting on these forums since I never had
Glgetprogramiv Gl_link_status
these issues with SDL, but with SFML I do, so it might be related to SFML.Basically, I made a custom shader loader gllinkprogram check error (the same one I used to use with SDL), but glLinkProgram generates GL_INVALID_VALUE.The specs say:QuoteGL_INVALID_VALUE is generated if program is not a value generated by OpenGL.for glLinkProgram.This would seem to indicate that the program handle I passed
Glgetprograminfolog
it is bogus. But, I generated the ID a mere 8 lines before that, and it is non-zero.Loading the shader is first thing my application does after opening a window and calling glewInit.This error does not affect the program for my machine, it runs fine, but it doesn't work on others. It runs on mine (ATI) but not on that of my friend (NVidia). However, my machine does still throw the error, but gldetachshader it only shows itself when I am running it through gDEBugger.I also noticed through gDEBugger that SFML is creating 3 OpenGL contexts for some reason.Anybody have any ideas as to what may be going on? Logged Have you heard about the new Cray super computer? It’s so fast, it executes an infinite loop in 6 seconds. binary1248 SFML Team Hero Member Posts: 1282 I am awesome. Re: (SFML + OpenGL) GL_INVALID_OPERATION on glLinkProgram « Reply #1 on: May 01, 2014, 06:06:06 pm » Yes... SFML creates 3 contexts even if you only have a single window. This is an internal detail. Might change in the future.Can you show the lines around where the window is created and where the shader is loaded? What exactly do you do between them? Do you use multiple threads? Do you use any of the SFML API between those sections?We need more information. There are so many things that might go wrong, and the easiest way to rule things out is by seeing some concrete code. Logged SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning). lolz123 Sr. Member Posts: 259 Re: (SFML + OpenGL) GL_INVALID_OPERATION on glLinkProgram « Reply #2 on: May 01, 2014, 06:16:52 pm
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting
Gl_link_status False
ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the
Glvalidateprogram
Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a gllinkprogram unlink minute: Sign up OpenGL glLinkProgram returns false but info log is empty; checked everything up vote 7 down vote favorite 2 I must admit this is my first time implementing shaders, previously I have only worked with fixed function pipeline; however, http://en.sfml-dev.org/forums/index.php?topic=15101.0 though I am certain that everything I did is correct - there must be an error. glLinkProgram(program) - returns GL_FALSE when queried for GL_LINK_STATUS. In addition, the info log is empty (when I query the log length - it is 1, which is the null terminator per the docs, it checks out). So linker errors, and no logs. In addition, I had just discovered that the linker problems occur as soon as I make any use of gl_Position variable in vertex shader, both http://stackoverflow.com/questions/8599607/opengl-gllinkprogram-returns-false-but-info-log-is-empty-checked-everything during assignment and if I use it for calculations. I tried all sorts of shader variations, it errors but it fails to produce the logs - it just seems to return GL_FALSE any time gl_Position is touched. Interestingly enough, fragment shader doesn't cause any problems. Both fragment and vertex shaders compile fine with no errors. When I introduce syntax errors, they are detected, printed, and the process is aborted prior to program creation (so it seems to work fine). I debugged and made sure that files get loaded properly, source is null terminated, sizes are correct, I checked the number of attached programs after attachment and it is 2 (correct lol). It is removed for clarity, I have the checkForErrors() method that checks and prints opengl errors - none are detected. I am stumped, please someone help! I've been losing sleep over this for 2 days now... This is the code to load the shader: FILE *file = fopen(fileName.c_str(), "rb"); if(file == NULL) { Log::error("file does not exist: \"" + fileName + "\""); return NULL; } // Calculate file size fseek(file , 0 , SEEK_END); int size = ftell(file); rewind(file); // If file size is 0 if(size == 0) { Log::error("file is empty: \"" + fileName + "\""); return NULL; } char **source = new char*[1]; source[0] = new char[size+1]; source[0][size] = '\0'; // If we weren't able to read the entire file into memory int readSize = fread(source[0], sizeof(char), size, file); if(size != readSize)
Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta http://gamedev.stackexchange.com/questions/33989/shaders-not-linking-correctly Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Game https://bugs.chromium.org/p/chromium/issues/detail?id=183581 Development Questions Tags Users Badges Unanswered Ask Question _ Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it opengl error only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top Shaders not linking correctly up vote 1 down vote favorite I'm writing a rather simple "ShaderManager" which aids me with loading shaders in Open GL, altough I am opengl error gllinkprogram having a few issues: The shaders don't link correctly The the attributes don't bind Here's the output of my program: The shaders did not link correctly. Could not bind attribute: v_coord3d Could not bind attribute: v_color Could not bind uniform: mvp And here's the relevant code and header file... void ShaderManager::create_program(std::string name) { GLuint vertexshader; GLuint fragmentshader; GLint link_ok = GL_FALSE; if ((vertexshader = create_shader(name + ".v.glsl", GL_VERTEX_SHADER)) == 0) { print_shader_errors(&vertexshader); } if ((fragmentshader = create_shader(name + ".f.glsl", GL_FRAGMENT_SHADER)) == 0) { print_shader_errors(&fragmentshader); } program_values.emplace_back(glCreateProgram()); program_keys.emplace_back(name); glAttachShader(program_values[program_values.back()], vertexshader); glAttachShader(program_values[program_values.back()], fragmentshader); glLinkProgram(program_values[program_values.back()]); glGetProgramiv(program_values[program_values.back()], GL_LINK_STATUS, &link_ok); if (!link_ok) { std::cout << "The shaders did not link correctly." << "\n"; } } bool ShaderManager::bind_attribute(std::string shader_name, std::string attribute_name) { GLuint attribute = glGetAttribLocation(get_program(shader_name), attribute_name.c_str()); if (attribute != -1) { attribute_values.emplace_back(attribute); attribute_keys.emplace_back(attribute_name); return true; } std::cout << "Could not bind attribute: " << attribute_name << "\n"; return false; } // bind uniform function is much the same as the above class ShaderManager { public: ShaderManager(); virtual ~ShaderManager(); static GLuint get_program(std::string shader_name); static int get_index_of_program_key(std::
highp changes Starred by 3 users Project Member Reported by jam...@chromium.org, Mar 12 2013 Back to list Status: Fixed Owner: briander...@chromium.org Closed: Apr 2013 Cc: backer@chromium.org, gman@chromium.org, jen...@chromium.org, vangelis@chromium.org, skyos...@chromium.org, piman@chromium.org, marc...@chromium.org, pfeldman@chromium.org, nduca@chromium.org, jamescook@chromium.org, osh...@chromium.org Components: Internals>Compositing NextAction: ---- OS: ---- Pri: 1 Type: Bug Sign in to add a comment A bunch of mask-related layout tests are failing with a regression range of http://build.chromium.org/f/chromium/perf/dashboard/ui/changelog.html?url=/trunk/src&mode=html&range=187486:187481. Output from one of them: STDERR: [29941:29941:10734864134920:ERROR:program_binding.cc(49)] Failed to create fragment shader STDERR: [29941:29941:10734864137537:ERROR:gles2_cmd_decoder.cc(975)] .CompositorContext: GL ERROR :GL_INVALID_VALUE : glBindUniformLocationCHROMIUM: unknown program STDERR: [29941:29941:10734864137585:ERROR:gles2_cmd_decoder.cc(975)] .CompositorContext: GL ERROR :GL_INVALID_VALUE : glBindUniformLocationCHROMIUM: unknown program STDERR: [29941:29941:10734864137620:ERROR:gles2_cmd_decoder.cc(975)] .CompositorContext: GL ERROR :GL_INVALID_VALUE : glBindUniformLocationCHROMIUM: unknown program STDERR: [29941:29941:10734864137654:ERROR:gles2_cmd_decoder.cc(975)] .CompositorContext: GL ERROR :GL_INVALID_VALUE : glBindUniformLocationCHROMIUM: unknown program STDERR: [29941:29941:10734864137688:ERROR:gles2_cmd_decoder.cc(975)] .CompositorContext: GL ERROR :GL_INVALID_VALUE : glBindUniformLocationCHROMIUM: unknown program STDERR: [29941:29941:10734864137722:ERROR:gles2_cmd_decoder.cc(975)] .CompositorContext: GL ERROR :GL_INVALID_VALUE : glBindUniformLocationCHROMIUM: unknown program STDERR: [29941:29941:10734864137755:ERROR:gles2_cmd_decoder.cc(975)] .CompositorContext: GL ERROR :GL_INVALID_VALUE : glBindUniformLocationCHROMIUM: unknown program STDERR: [29941:29941:10734864137797:ERROR:gles2_cmd_decoder.cc(975)] .CompositorContext: GL ERROR :GL_INVALID_VALUE : glBindUniformLocationCHROMIUM: unknown program STDERR: [29941:29941:10734864137832:ERROR:gles2_cmd_decoder.cc(975)] .CompositorContext: GL ERROR :GL_INVALID_VALUE : glLinkProgram: unknown program STDERR: [29941:29941:10734864137875:ERROR:program_binding.cc(66)] Failed to link shader program STDERR: ../../gpu/command_buffer/client/../client/gles2_implementation_impl_autogen.h(290): GPU_DCHECK(program != 0 (0)) failed. STDERR: DumpRe