Jump to content
This is not recommended for shared computers
Sign in anonymously
Don't add me to the active users list
Bring your ideas to life with a Gaming Degree from Full Sail University
10 February 2014 - 12:34 PM
Thanks for the explanation
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
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 ;)
09 February 2014 - 07:16 AM
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;
long file_size = -1;
//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");
glGetShaderiv(shader_id, GL_COMPILE_STATUS, &status);
ExitOnGLError("ERROR: Could not compile shader");
int infologLength = 0;
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);
If anyone can point me in the right direction i would be very grateful.
07 February 2014 - 12:24 AM
I'm getting version 3.3.0.
I could draw 1 objects but when i try to create a second one i get the error that you can read in my first post.
As requested my vertex shader code:
layout(location=0) in vec4 in_Position;
layout(location=1) in vec4 in_Color;
out vec4 ex_Color;
uniform mat4 ModelMatrix;
uniform mat4 ViewMatrix;
uniform mat4 ProjectionMatrix;
gl_Position = (ProjectionMatrix * ViewMatrix * ModelMatrix) * in_Position;
ex_Color = in_Color;
Thanks for the response allready
23 January 2014 - 11:57 AM
No not really. Is it better to use -> or is it nicer to read just?
Thanks for all the tips
GameDev.net™, the GameDev.net logo, and GDNet™ are trademarks of GameDev.net, LLC