Initialization failed when executing program. Help pls!

Started by
3 comments, last by Addict1 18 years, 9 months ago
Everything was fine until when i start to execute the program the message pop out "initialization failed". How to solve this problem? help please! Btw, i'm using win32 app and on lesson #9 ..
Advertisement
Check the different variable's values at the crash that can cause that message (either with a debugger or with a logging function).
If you still cannot find the error, you can always post the variable's name and value.
Killers don't end up in jailThey end up on a high-score!
sorry i still couldnt find the error, but is it related to this part of coding?


int InitGL(GLvoid)
{
if (!LoadGLTextures())
{
return FALSE;
}
glEnable(GL_TEXTURE_2D);
glShadeModel(GL_SMOOTH);
glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
glClearDepth(1.0f);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
glEnable(GL_BLEND);

for (loop=0; loop<num; loop++)
{
star[loop].angle=0.0f;
star[loop].dist=(float(loop)/num)*5.0f;
star[loop].r=rand()%256;
star[loop].g=rand()%256;
star[loop].b=rand()%256;
}
return TRUE;
}

because since the error is from this part...

if (!InitGL()) {
KillGLWindow(); MessageBox(NULL,"Initialization Failed.","ERROR",MB_OK|MB_ICONEXCLAMATION);
return FALSE; }
return TRUE;
}


U sure u put the required image file in the same directory as the executable? If you're using VS, you need to put a copy of the image into bin/debug (or bin/release, whichever option you're using).
thanks guys, it works! :D

This topic is closed to new replies.

Advertisement