• Advertisement
Sign in to follow this  

Initialization failed when executing program. Help pls!

This topic is 4611 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

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

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
Sign in to follow this  

  • Advertisement