sai pallavi
sai pallavi

Reputation: 177

Failure compiling the shaders, do I need openGL drivers for ubuntu on Intel platforms?

I am trying to write a simple program with vertex shaders on ubuntu, it goes like this.

const GLchar* vertexSource = (const GLchar*) "#version 130 core \n in vec2 position; \n void main() \n { \n gl_Position = vec4(position, 0.0, 1.0); \n }";

this is my shader, and I am compiling it like this, in the program

GLuint vertexShader = glCreateShader(GL_VERTEX_SHADER);  
glShaderSource(vertexShader, 1, &vertexSource,  0);  
glCompileShader(vertexShader);

I tried passing the length of the vertex shader string in the glShaderSourceFunction, but that is giving me the same error.

but glGetShaderiv() gives me error in compiling the code. I could not understand whats going wrong here.

Am I missing something? or its the error being raised because of the absend of the driver?

I installed ubuntu 12.04 on my Intel i5 windows 8 system, does that mean that I do not have openGL graphics drivers on ubuntu? could somebody please point me to where I can get them? besides, when the drivers are not present, isnt openGL supposed to do the whole thing in software??

Upvotes: 0

Views: 1012

Answers (2)

yuyoyuppe
yuyoyuppe

Reputation: 1602

You can get your shader compilation log with following code:

GLint log_len;
glGetShaderiv(vertexshader, GL_INFO_LOG_LENGTH, &log_len);
GLchar* comp_log = new GLchar[log_len + 1];
glGetShaderInfoLog(vertexshader, log_len, NULL, comp_log);
std::cout << "Shader compilation result: " << comp_log << std::endl;
delete[] comp_log;

Upvotes: 0

genpfault
genpfault

Reputation: 52083

#version 130 core
             ^^^^ wat

There are no Core contexts in OpenGL 3.0.

Upvotes: 2

Related Questions