Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 05 Jan 2014
Offline Last Active Apr 07 2015 06:36 AM

Posts I've Made

In Topic: Trying to use gluUnProject/gluProject to check if hitting objects

06 May 2014 - 02:36 PM

Thanks for the tip, i'm going to try it.

If i have questions i will let you know :P

In Topic: Drawing to different models

16 April 2014 - 01:07 PM

I solved my problem, i needed to add following lines to my draw function:

    int sizeVertex=sizeof(GetVertices().front());
    int vertexEllements=GetVertices().size();
    int sizeVertexes=sizeVertex*vertexEllements;
    glBindBuffer(GL_ARRAY_BUFFER,GetBufferIds(1));// BufferIds[1]);//BufferIdsTemp

    glBufferData(GL_ARRAY_BUFFER, sizeVertexes, &GetVertices().front(), GL_STATIC_DRAW);

In Topic: Drawing multiple objects

10 February 2014 - 12:34 PM

Thanks for the explanation :D


Now i can finally try to draw more then one object one my screen, just need to find out how to position them seperatly ;)


Thanks guys, really i didn't understand why it wouldn't work :D

In Topic: Drawing multiple objects

10 February 2014 - 11:39 AM



The char array is exactly the same as the first object that is created without any problem.


I have added the line :

#extension GL_ARB_explicit_attrib_location : enable

To my vertex shader as suggested by beans222, and now i'm not getting any error when trying to create the second object.


What does this line do exactly? Is it a problem with nvidia cards?


Thanks for all the help guys ;)

In Topic: Drawing multiple objects

09 February 2014 - 07:16 AM

Hi again,


i'm getting these errors when i'm loading my shaders for the second time for a new model:


ERROR: 0:4: 'GL_ARB_explicit_attrib_location' : extension is disabled
ERROR: 0:6: 'GL_ARB_explicit_attrib_location' : extension is disabled

If googled it but can't get wise out of it.


The code to load my shaders is this:

GLuint LoadShader(const char* filename, GLenum shader_type)
    GLuint shader_id = 0;
    FILE* file;
    long file_size = -1;
      GLchar* glsl_source;
      //added by me
     const GLchar* glsl_source_gl;
    if (NULL != (file = fopen(filename, "rb")) &&
        0 == fseek(file, 0, SEEK_END) &&
        -1 != (file_size = ftell(file)))
        if (NULL != (glsl_source = (char*)malloc(file_size + 1)))
            if (file_size == (long)fread(glsl_source, sizeof(char), file_size, file))
                //added by me

                glsl_source[file_size] = '\0';

                if (0 != (shader_id = glCreateShader(shader_type)))

                    glShaderSource(shader_id, 1, (&glsl_source_gl), NULL);
                    ExitOnGLError("Could not compile a shader");

                    GLint status=1;
                     glGetShaderiv(shader_id, GL_COMPILE_STATUS, &status);
                        ExitOnGLError("ERROR: Could not compile shader");

                    int infologLength = 0;
    int maxLength;

    char infoLog[256];

        glGetShaderInfoLog(shader_id, maxLength, &infologLength, infoLog);

    if (infologLength > 0)

                    fprintf(stderr, "ERROR: Could not create a shader.\n");
                fprintf(stderr, "ERROR: Could not read file %s\n", filename);
            fprintf(stderr, "ERROR: Could not allocate %i bytes.\n", file_size);

        fprintf(stderr, "ERROR: Could not open file %s\n", filename);

    return shader_id;

If anyone can point me in the right direction i would be very grateful.