Sign in to follow this  
Addict1

Initialization failed when executing program. Help pls!

Recommended Posts

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 ..

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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;
}


Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this