 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Joey Rios Guest
|
Posted: Wed Aug 04, 2004 8:45 pm Post subject: OpenGL and MDI apps |
|
|
Are there any tutorials/references/samples of projects using OpenGL
in an MDI application available online? I am trying to get
various child windows to have there own OpenGL stuff going on. I
have gotten child windows to draw a box when they are created, but
have trouble when switching between various open windows.
This is my first Builder and first OpenGL project, so any advice
would be appreciated. Thanks in advance.
Joey
|
|
| Back to top |
|
 |
Bruce Salzman Guest
|
Posted: Thu Aug 05, 2004 12:43 am Post subject: Re: OpenGL and MDI apps |
|
|
| Quote: | Are there any tutorials/references/samples of projects using OpenGL
in an MDI application available online? I am trying to get
various child windows to have there own OpenGL stuff going on. I
have gotten child windows to draw a box when they are created, but
have trouble when switching between various open windows.
This is my first Builder and first OpenGL project, so any advice
would be appreciated. Thanks in advance.
Joey
|
Hi, Joey
Here are my tips:
The internal state of the OpenGL library is global to the machine. You
have to manage resources to make sure that you render the correct
display lists to the proper rendering contexts.
Use glGenLists() to generate your display list numbers. They need to
be unique.
Call wglMakeCurrent() before rendering.
Call glFlush(); and GdiFlush(); after rendering your window.
Regards,
Bruce
|
|
| Back to top |
|
 |
Joey Rios Guest
|
Posted: Sat Aug 07, 2004 8:57 pm Post subject: Re: OpenGL and MDI apps |
|
|
| Quote: | Hi, Joey
Here are my tips:
The internal state of the OpenGL library is global to the machine. You
have to manage resources to make sure that you render the correct
display lists to the proper rendering contexts.
Use glGenLists() to generate your display list numbers. They need to
be unique.
Call wglMakeCurrent() before rendering.
Call glFlush(); and GdiFlush(); after rendering your window.
Regards,
Bruce
|
Thanks Bruce.
I think I am using my wglMakeCurrent() and glFlush() correctly
thus far. Haven't heard of GdiFlush() so will look into it.
My problem right now is that I can get any number of child
windows that render a scene (just a green box on a white
background) and while the current child window keeps itself
refreshed properly through resizing and moving, all the
obscured windows won't refresh themselves until I make them
active. I am guessing that I need to have the parent window
do some sort of stepping through its children and refresh
them, but I could easily be wrong. Any advice on this?
Yours appreciatively,
Joey
|
|
| Back to top |
|
 |
Bruce Salzman Guest
|
Posted: Mon Aug 09, 2004 1:34 pm Post subject: Re: OpenGL and MDI apps |
|
|
| Quote: | I think I am using my wglMakeCurrent() and glFlush() correctly
thus far. Haven't heard of GdiFlush() so will look into it.
My problem right now is that I can get any number of child
windows that render a scene (just a green box on a white
background) and while the current child window keeps itself
refreshed properly through resizing and moving, all the
obscured windows won't refresh themselves until I make them
active. I am guessing that I need to have the parent window
do some sort of stepping through its children and refresh
them, but I could easily be wrong. Any advice on this?
|
Try setting the window style bits WS_CLIPSIBLINGS and WS_CLIPCHILDREN
in your MDI Child windows.
Regards,
Bruce
|
|
| Back to top |
|
 |
Joey Rios Guest
|
Posted: Wed Aug 11, 2004 8:39 am Post subject: Re: OpenGL and MDI apps |
|
|
| Quote: |
Try setting the window style bits WS_CLIPSIBLINGS and WS_CLIPCHILDREN
in your MDI Child windows.
|
Thanks again for the reply Bruce,
I have found a reference to these flags in the Win32 Help
provided with Builder, but can't see how to set them as they
seem to normally be passed in the CreateWindow function in
the windows API. I guess Builder hides the call to that
function well enough to keep me from figuring out how to get those bits set.
I know I may be running the risk of sounding totally ignorant, but that hasn't stopped me yet! Where do I set these flags? Or
better yet, is there somewhere you could point me to learn a
little more about these topics? How do you guys know all this stuff!? This is still my first Builder and first OpenGL project and I GREATLY appreciate your help...
Joey
PS: I think a lot of these questions might be cleared up if
there were a good OpenGL MDI example app somewhere. Anyone
know where a newb like me can find such a thing? No success
hunting on my own...
|
|
| Back to top |
|
 |
Bruce Salzman Guest
|
Posted: Thu Aug 12, 2004 3:16 am Post subject: Re: OpenGL and MDI apps |
|
|
| Quote: | I have found a reference to these flags in the Win32 Help
provided with Builder, but can't see how to set them as they
seem to normally be passed in the CreateWindow function in
the windows API. I guess Builder hides the call to that
function well enough to keep me from figuring out how to get those
bits set.
Add this function to your MDIChild class: |
void __fastcall TMDIChild::CreateParams(Controls::TCreateParams
&Params)
{
TForm::CreateParams(Params);
Params.ExStyle |= WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
}
CreateWnd() calls this function before creating the window.
| Quote: | I know I may be running the risk of sounding totally ignorant, but
that hasn't stopped me yet! Where do I set these flags? Or
better yet, is there somewhere you could point me to learn a
little more about these topics? How do you guys know all this
stuff!? This is still my first Builder and first OpenGL project and I
GREATLY appreciate your help...
|
Don't worry, if you do this long enough you'll gradually soak it up
:^). I think I used www.msdn.microsoft.com when I first attempted
OpenGL. And www.opengl.org is full of good stuff.
Regards,
Bruce
|
|
| Back to top |
|
 |
Bruce Salzman Guest
|
Posted: Thu Aug 12, 2004 3:19 am Post subject: Re: OpenGL and MDI apps |
|
|
That should be
Params.Style |= WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|