Advertisement Jump to content
Sign in to follow this  

my program crash when i use shaders

This topic is 4888 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, my program works well on my radeon 9600 but when i execute exactly the same code on my mobility X700 the program crash when a load, compile,... a shader. If i put in commentary the line which load shaders it don't crash... Can you help me ? PS: i'm using visual C++ 7 (2003), glut, glew, sdl_image.

Share this post

Link to post
Share on other sites
In fact, i have found that it was because my graphics drivers is made for opengl 1.5, and my program for opengl 2.0. I have gone on ati web site and the acer notebook isn't managed by the notebook drivers from ati. I have gone the acer site too and its always opengl 1.5 drivers. How can i do ?

Share this post

Link to post
Share on other sites
In my opinion you bug is elsewhere; it's in your code.
A decent OpenGL driver should not crash the app.
Probably the extension is not supported and you are passing a NULL or invalid function pointer.

Share this post

Link to post
Share on other sites
ok so this is the function's code which make crash the program :

loadShader::loadShader(char *fileName1, char *fileName2)

GLuint vsh = glCreateShader(GL_VERTEX_SHADER);
GLuint fsh = glCreateShader(GL_FRAGMENT_SHADER);

loadStrings(fileName1) ;
//content=textFileRead(fileName1) ;
const char *cContent = content ;

ofstream oFile1("sortie shader1.txt");
oFile1<<cContent ;

glShaderSource(vsh, 1, &cContent, NULL);

loadStrings(fileName2) ;
//content2=textFileRead(fileName2) ;
const char *cContent2 = content ;

ofstream oFile2("sortie shader2.txt");
oFile2<<cContent2 ;

glShaderSource(fsh, 1, &cContent2, NULL);


GLuint ph = glCreateProgram();//program handler
glAttachShader(ph, vsh);
glAttachShader(ph, fsh);


int status=0 ;
glGetObjectParameterivARB(ph, GL_OBJECT_LINK_STATUS_ARB, &status);
cout<<"status "<<dec<<status<<endl ;


GLint infologLength = 0;
GLint charsWritten = 0;
GLchar *infoLog;

glGetObjectParameterivARB(ph, GL_OBJECT_INFO_LOG_LENGTH_ARB, &infologLength);

if (infologLength > 0)
cout<<"shader "<<infologLength<<endl ;
infoLog = (char *)malloc(infologLength);
glGetInfoLogARB(ph, infologLength, &charsWritten, infoLog);
ofstream oFile3("infoLogFile.txt");
oFile3<<infoLog ;
/*errCode = glGetError() ;
errString = gluErrorString(errCode) ;
cout<<"!!!opengl error shader loader "<<errString<<endl ;*/


Share this post

Link to post
Share on other sites
i forgot this one :

void loadShader::loadStrings(char *fileName)
ifstream file ;, ios::binary);

file.seekg(0, ios::end);

fileLength = file.tellg();
content = (char *)malloc(sizeof(char) * (fileLength+1));
//content = new char[fileLength + 1];
//memset(content, NULL, fileLength + 1);

file.seekg(0, ios::beg);, fileLength);

content[fileLength] = '\0' ;


Share this post

Link to post
Share on other sites
i have used a breakpoint and it crash at the first line in the function which load the shader :

GLuint vsh = glCreateShader(GL_VERTEX_SHADER);

Share this post

Link to post
Share on other sites
I suppose you're passing a NULL pointer, too.
If the implemention of glCreateShader is not found in your driver, glCreateShader points to some place in memory where actually no function resides. You must set glCreateShader to NULL if it isn't found and check for this whenever you call the function:


for example.

Since ATI doesn't officially support Mobility Cards, that doesn't mean the ATI driver does not work with it, it just won't install out of the box. You need to either rewrite some .ini files or use the following tool:
DH Mod Tool

Get the newest Catalyst driver from the ATI website, extract the files from the setup file and use the tool. Then install.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!