Re:wglCreateContext random access violation
Scott / All
Thanks for the reply
I already had - the basic _control87(MCW_EM, MCW_EM) does not stop all the
problems, I found that _clear87() after each routine makes calls OpenGL is
necessary as well.
My current problem occurs on wglCreateContext and seems to only happen 25%
of the time - and I so far noticed it if the Borland IDE is running (which
is most of the time since I am still building).
void __fastcall TOpenGLView::FormCreate(TObject *Sender)
{
hdc = GetDC(Handle);
SetPixelFormatDescriptor();
hrc = wglCreateContext(hdc); <<< Dies here
...
void __fastcall TOpenGLView::SetPixelFormatDescriptor()
{
PIXELFORMATDESCRIPTOR pfd = {
sizeof(PIXELFORMATDESCRIPTOR),
1,
PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER,
PFD_TYPE_RGBA,
24, // 24-bit colour depth
0,0,0,0,0,0,
0,0,
0,0,0,0,0,
32, // 32-bit z-buffer
0,
0,
PFD_MAIN_PLANE,
0,
0,0,0
};
PixelFormat = ChoosePixelFormat(hdc, &pfd);
SetPixelFormat(hdc, PixelFormat, &pfd);
I may have made some standard Windows faux-pas.
Any ideas out there?
Best wishes...
Peter
Quote
"Scott Heiman" <who...@nospam.net> wrote in message
news:3bcf6718$1_2@dnews...
Quote
> I use OpenGL with Borland a lot. I have never had this problem. Is your
> hdc valid? How do you obtain it?
> Did you disable the floating point error handlers (details can be found on
> my OpenGL page). Although this "fix" seems unrelated, it generally
> eliminates "random" crashes in Borland/OpenGL applications.
> --
> Regards,
> Scott
> http://members.home.net/scottheiman/