From: Brian P. <bri...@tu...> - 2005-06-21 03:16:47
|
arivanbastos wrote: > Thank you for help. >=20 > I'm trying to recover context information, but I'm getting "Segmentatio= n > Fault (SDL Parachute Deployed)". My code to init the window and recover > context info is like that: >=20 > if( SDL_Init(SDL_INIT_VIDEO) < 0 ){ ... // error } >=20 > atexit( SDL_Quit ); >=20 > info =3D SDL_GetVideoInfo(); > if(!info){ ... // error } >=20 > width =3D 640; height =3D 480; > bpp =3D info->vfmt->BitsPerPixel; > SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);=09 > ... > SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); > SDL_Surface* window =3D SDL_SetVideoMode(width, height, bpp,=20 > =09 > SDL_OPENGL); > // recover the context info=20 > SDL_SysWMinfo* sysWNinfo; > HDC hdc; HGLRC hrc; > =20 > hdc =3D NULL; hrc =3D NULL; sysWNinfo =3D NULL; =20 > =09 > // Segmentation fault pparently is caused by the row above =20 > if ( !SDL_GetWMInfo(sysWNinfo) ) { ... //error } >=20 > hdc =3D GetDC(sysWNinfo->window); > hrc =3D wglCreateContext(hdc); =20 > =20 > if ( wglMakeCurrent(hdc, hrc) ) { > // can try to recover ARB functions pointers > } else { ... // error } > =09 > Am I doing a stupid thing? I tried to use > wglMakeCurrent(wglGetCurrentContext(), wglGetCurrentDC()) but I get a > error code n=B06 (ERROR_INVALID_HANDLE) in wglMakeCurrent(). Perhaps wglGetCurrentContext() or wglGetCurrentDC() is returning an=20 invalid value. Have you looked over the Mesa wgl code for those=20 functions? -Brian |