OpenGL and BCB3 IDE

OpenGL and BCB3 IDE

Post by Lajos Keleme » Wed, 29 Jul 1998 04:00:00



Hi

I have a problem:
If I run an OGL program using VCL from IDE it hangs (acces violation).
If I run it without the IDE it works.
I use BCB 3.0 + patch 1 on win95 and
GlSkeleton By John R. Thomas Jr.

Any solution ?

Leo

 
 
 

OpenGL and BCB3 IDE

Post by Inpri » Wed, 29 Jul 1998 04:00:00


Is it by chance a floating point exception?
The IDE will catch these exceptions by default and display a MessageBox.
I suggest masking floating point exceptions.
In either your form constructor or in the OnCreate method add this line:
_control87(MCW_EM, MCW_EM);
Hope this helps,
JohnT.

  vcard.vcf
< 1K Download

 
 
 

OpenGL and BCB3 IDE

Post by Inpri » Wed, 29 Jul 1998 04:00:00


This is the first time I have heard of this behavior. Do you know specifically
where it is happening? Try stepping through the code to determine exactly
where the access violation is happening. Let me know.
//jt

  vcard.vcf
< 1K Download
 
 
 

OpenGL and BCB3 IDE

Post by Lajos Keleme » Thu, 30 Jul 1998 04:00:00


It didn't help. It is an access violation not a floating point exception.
Any other IDEa ?
Quote:> Is it by chance a floating point exception?
> The IDE will catch these exceptions by default and display a MessageBox.
> I suggest masking floating point exceptions.
> In either your form constructor or in the OnCreate method add this line:
> _control87(MCW_EM, MCW_EM);
> Hope this helps,
> JohnT.

 
 
 

OpenGL and BCB3 IDE

Post by Lajos Keleme » Thu, 30 Jul 1998 04:00:00


This is the codesnippet. It hangs on:
    PixelFormat = ChoosePixelFormat(ghDC, &pfd);

void __fastcall TForm1::SetPixelFormatDescriptor()
{
 PIXELFORMATDESCRIPTOR pfd = {
     sizeof(PIXELFORMATDESCRIPTOR),
        1,
        PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER,
        PFD_TYPE_RGBA,
        24,
        0,0,0,0,0,0,
        0,0,
        0,0,0,0,0,
        32,
        0,
        0,
        PFD_MAIN_PLANE,
        0,
        0,0,
        };
    PixelFormat = ChoosePixelFormat(ghDC, &pfd);
    if (PixelFormat == 0)
    {
   Application->MessageBox("ChoosePixelFormat() failed:","",MB_OK);
      Application->Terminate();
    }

    if (!SetPixelFormat(ghDC, PixelFormat, &pfd))
    {
   Application->MessageBox("SetPixelFormat() failed:","",MB_OK);
      Application->Terminate();
    }

}

> This is the first time I have heard of this behavior. Do you know specifically
> where it is happening? Try stepping through the code to determine exactly
> where the access violation is happening. Let me know.

 
 
 

OpenGL and BCB3 IDE

Post by Inpri » Thu, 30 Jul 1998 04:00:00


Do you set the ghDC variable to the Window's HDC?
You can use ghDC =  ::GetDC(Form1->Handle); to grab it.
I have a feeling this might be the culprit.
//jt
 
 
 

OpenGL and BCB3 IDE

Post by Lajos Keleme » Fri, 31 Jul 1998 04:00:00


Here is the code snippet I use:
HWND  ghWnd;
HDC   ghDC;
HGLRC ghRC;

void __fastcall TForm1::FormActivate(TObject *Sender)
{
      ghWnd = Form1->Handle;

   /*  this was needed in place of HDC ghDC Form1->Handle  */

       ghDC = GetDC(ghWnd);

    if(ghDC == NULL)
     ShowMessage(":-( hdc == NULL");
    SetPixelFormatDescriptor();

    ghRC = wglCreateContext(ghDC);
    if(ghRC == NULL)
     ShowMessage(":-) hrc == NULL");
    if(wglMakeCurrent(ghDC, ghRC) == false)
     ShowMessage("Could not MakeCurrent");
    w = ClientWidth;
    h = ClientHeight;

}

> Do you set the ghDC variable to the Window's HDC?
> You can use ghDC =  ::GetDC(Form1->Handle); to grab it.
> I have a feeling this might be the culprit.
> //jt

 
 
 

OpenGL and BCB3 IDE

Post by Inpri » Fri, 31 Jul 1998 04:00:00


Odd. This has definitely worked for me in the past. Try moving the
initialization code from that function to the OnCreate event. I've since
done this with my Glkeleton after more thought.
//jt
 
 
 

OpenGL and BCB3 IDE

Post by Lajos Keleme » Sat, 01 Aug 1998 04:00:00


Sorry John but no banana.
It sometimes works sometimes doesn't.
Something in VCL is very unreliable.
Other IDEa?
L.K.

> Odd. This has definitely worked for me in the past. Try moving the
> initialization code from that function to the OnCreate event. I've since
> done this with my Glkeleton after more thought.
> //jt

 
 
 

OpenGL and BCB3 IDE

Post by Mike Harri » Sun, 02 Aug 1998 04:00:00


Quote:>It sometimes works sometimes doesn't.
>Something in VCL is very unreliable.
>Other IDEa?
>L.K.

try removing the object, ils, ilc or any other file that is
produced by the ide and compile, seems sometimes the data becomes corrupt.
this has solved this problem for me.
Oh, and I think John linked the lib files to his project.
remove the link
 
 
 

OpenGL and BCB3 IDE

Post by Lajos Keleme » Sun, 02 Aug 1998 04:00:00


It doesn't help.
I'm very disappointed.
I bought BCB3 to make an OpenGL based modeler
using VCL. It seems to me that it can't be done.

> try removing the object, ils, ilc or any other file that is
> produced by the ide and compile, seems sometimes the data becomes corrupt.
> this has solved this problem for me.
> Oh, and I think John linked the lib files to his project.
> remove the link

 
 
 

OpenGL and BCB3 IDE

Post by Inpri » Mon, 03 Aug 1998 04:00:00


Quote:> It seems to me that it can't be done.

Can you send me your project? This is the first I have heard of this
behavior and would like to get to the bottom of it. Zip up the .bpr, and

//jt
 
 
 

OpenGL and BCB3 IDE

Post by Mike Harri » Mon, 10 Aug 1998 04:00:00


This is the codesnippet. It hangs on:
    PixelFormat = ChoosePixelFormat(ghDC, &pfd);

hmmm....

This would happen to me at times the compiler complains.

Solution : The headers (gl.h  glu.h) that come with BCB3Pro(anyway)
seemed to be the culprit. I used SGI's or GNU headers and this problem
has gone away

 
 
 

OpenGL and BCB3 IDE

Post by Lajos Keleme » Mon, 10 Aug 1998 04:00:00


Sorry Mike but no bananas again.
Try to give some working solution

> This is the codesnippet. It hangs on:
>     PixelFormat = ChoosePixelFormat(ghDC, &pfd);

> hmmm....

> This would happen to me at times the compiler complains.

> Solution : The headers (gl.h  glu.h) that come with BCB3Pro(anyway)
> seemed to be the culprit. I used SGI's or GNU headers and this problem
> has gone away

 
 
 

OpenGL and BCB3 IDE

Post by Mike Harri » Tue, 11 Aug 1998 04:00:00


Quote:>Try to give some working solution

It is difficult when one knows only part of the problem.
keep in mind, On my Win95 BCB Pro Ver3 with 1st Patch
It took me more than one attempt to get this OpenGl thing
to work without error,  however, once I did. My component
is now efficient and WITHOUT error

It is possible the solution is working!

You can use an older gl/glu.h in John's example and compile it.
But it is still not optimised

 
 
 

1. OpenGL and BCB3 IDE and VCL

As I wrote a couple of week ago if I use VCL and some OpenGL code
then I have an access violation error in BCB3 IDE on Win95 when I run
the program
from the IDE.

Now if I set my program to standalone mode:

Project|Options|Linker-> (uncheck use dynamic RTL)
Project|Options|Packages-> (uncheck build with runtime packages)

the access violation in the IDE is very rare but instead of this I can't

exit
from the program. I have to use program reset from the IDE.
Any ideas ?

Leo

2. HELP :246 gray scale images

3. OpenGL and BCB3 IDE with VCL

4. PC Monitor w/ Mac?

5. OpenGL with VCL and BCB3 IDE

6. International _Prohibition_ Symbol - Overlay/Plug-in?

7. OpenGL with BCB3

8. opengl in bcb3 problem

9. OpenGL with FLTK and BCB3 or BCB4

10. Help, BCB3 doesn't support OpenGL glBindTexture

11. OpenGL Optimizer under BCB3

12. OpenGL and BCB3