Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: Loading shader firom file: GL_error 'illigal counting'

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Intern Contributor
    Join Date
    Jul 2013

    Loading shader firom file: GL_error 'illigal counting'

    Hi all,
    I'm using a shader that on and off generates an error.
    Code :
    //std::ifstream::pos_type mSize;
    int mSize;
    std::ifstream ctFile ("F:/Projekter/GLFW3_2/vertShader6.txt", std::ios::in|std::ios::binary|std::ios::ate);
        if (ctFile.is_open())
            printf("ctFile is_open\n");
            mSize = ctFile.tellg();
            printf("ctFile mSize : %i \n", mSize ) ;
            checkErrors() ;
            char *buffer = new char [mSize];
            ctFile.seekg (0, std::ios::beg);
   (buffer, mSize);
            buffer[mSize] = '\0';
            const GLchar *vertexShaderChars[] = { buffer };
    I detect the error at checkErrors(). It's printed in my local language and translates to something like 'illigal counting'
    The error sometimes generates a faul status:
    glGetShaderiv(vertShader, GL_COMPILE_STATUS, &status);

    I make a printf() of 'buffer' and it provides a correct visual impression of the shader-code/text.

    It 'did' bypass GL_COMPILE_STATUS earlier without the error spawning a faul status, and I would have a functioning program ..

    It probably takes a newbie to produce the code above ... any suggestion of a more straightforward code is welcome.

  2. #2
    Intern Contributor
    Join Date
    Jul 2013
    I changed my approach to a very elegant way presented at
    ... and I get the same error.
    It would belong to something about 'vec4 coll' ..?

    #version 330 core
    precision mediump float;
    precision mediump int;
    layout(location = 0) in vec4 position;
    layout(location = 1) in vec4 normal;
    uniform mat4 modelM;
    uniform mat4 cameraM;
    uniform mat4 projectionM;
    uniform vec3 normal;
    uniform vec3 camPosition;
    uniform vec3 lightPos;
    out vec4 coll;
    void main()
    coll = vec4(1.0f,1.0f,1.0f,1.0f);
    mat4 tmp1 = cameraM*modelM;
    mat4 tmp2 = projectionM * tmp1;
    gl_Position = tmp2 * position;

    ... ups, noticed the doubly named variable 'normal'. Changing it has made an immediate change to the better ..
    Last edited by CarstenT; 11-24-2013 at 01:12 PM.

  3. #3
    Intern Contributor
    Join Date
    Jul 2013
    hi again,
    the error 'illegal counting' persists, but it does not knock the program out right away. It runs a good handful of seconds and displays what it's supposed to display, then pops a fatal error 1 (?) and says that too many errors has occurred. The errors are not caught in the application.
    I counted the chars of the shader and it matches the right size. I display the shader-source in printf() and it's not garbled .. it adds a couple of blank lines in the console though.
    I've changed a simple draw-triangle program (working perfectly with the same shader [and error?]) to display a height-field of 1201*1201 vertices (bitbanging to little-endian). I should go look for errors in that load and associated changes.

  4. #4
    Intern Contributor
    Join Date
    Jul 2013
    alas ..
    Index and Vertex MAX_COUNT exceeded ;o/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts