Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8486153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:51:52+00:00 2026-06-10T20:51:52+00:00

I am attempting to build a simple OpenGL 3.2 program which consists of a

  • 0

I am attempting to build a simple OpenGL 3.2 program which consists of a single fragment shader, but I do not seem to be able to actually compile the shader. I’m fairly sure that my shader syntax is correct, but even if it’s not, I am unable to retrieve an error message using glGetShaderInfoLog.

I have developed a short program that shows this in action:

GLuint shader = glCreateShader(GL_FRAGMENT_SHADER);

const char *shaderData =
            "#version 120\n"
            "void main()\n"
            "{\n"
            "    gl_FragColor = gl_Color;\n"
            "}\n";
glShaderSource(shader, 1, &shaderData, NULL);

GLint status;
glGetShaderiv(shader, GL_COMPILE_STATUS, &status);

if (status == GL_FALSE)
{
    GLint infoLogLength;
    glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLogLength);

    GLchar* strInfoLog = new GLchar[infoLogLength + 1];
    glGetShaderInfoLog(shader, infoLogLength, NULL, strInfoLog);

    fprintf(stderr, "Compilation error in shader %s: %s\n", this->name, strInfoLog);
    delete[] strInfoLog;
}

This yields the message:

Compilation error in shader Fragment Shader:

The issue seems to be that the call to getShaderiv to retrieve the GL_INFO_LOG_LENGTH value returns 0 every time, so therefore I allocate an empty string. I have tried hard-coding this value to 100, but I still receive nothing from getShaderInfoLog.

My concern here is not to fix the shader (I can do that myself if it is wrong), but to get the debug information. I know that this can be done, because I have used Shader Maker to develop shaders briefly, and I am able to get very detailed debug messages. For example:

ERROR: 0:11: 'undefined_variable' : syntax error syntax error

Unless Shader Marker has its own validation tool internally, I’m sure it has to be using the same method that I am trying to use. I have seen several examples on the internet in which people retrieve the error message for a shader in the same way, so I’m fairly sure I’m doing it correctly.

Now, I am getting a compile-time warning which could potentially explain this problem:

#warning gl.h and gl3.h are both included. Compiler will not invoke errors if using removed OpenGL functionality.

After doing a full text search, I cannot find anywhere where I call #include <OpenGL/gl.h>, so I am guessing that this header is being included by one of the NSOpenGL* classes. I’m fairly sure that I’m not using any removed functionality in this short program, and this issue only has about 5 hits on Google, but I thought I’d better mention this anyway.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T20:51:53+00:00Added an answer on June 10, 2026 at 8:51 pm

    As noted in a previous comment, the glCompileShader call was missing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not sure if I'm using classes correctly. I'm attempting to build a simple
Seems simple, but not. I know how to exclude JAVA files from the build
I'm attempting to build a simple plugin like this (function($) { $.fn.gpSlideOut = function(options,
Attempting to build a C# NPAPI plugin I have found a tutorial which describes
Attempting to build a C# project which has numerous references to assemblies in NuGet
I am attempting to build a simple WPF Application using msbuild via a custom
I'm attempting to build a very simple wxPython GUI that monitors and displays external
I'm attempting to compile a simple hello world program in c with lcc-win32/wedit, and
I am attempting to build a simple C# TCP proxy for my business so
I am attempting to build a simple content management system using Twitter's Bootstrap for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.