 |
|
|
 |
|
 |
While what you've done works *most of the time*, it's unsafe and could cause fatal errors under certain conditions.
OpenGL windows need to have the CS_OWNDC window style set. Without this, under low-memory conditions Windows (may) recycle your HDC even if you have not released it. While you will not lose the HDC--the handle remains valid--subhandle setup within the context may change making your render context invalid and (possibly) crashing the driver.
I was curious about the example specifically *because* I was looking for some way to use dialog-editor created windows without running into the CS_OWNDC problem and without using SetWindowLong to alter the window style: merely flagging CS_OWNDC with SetWindowLong is not enough, as some other window styles that may already be attached to the class such as WS_EX_COMPOSITED are unsafe to use with CS_OWNDC.
I'm bummed. I'd still love an (easy) way to do this.
You might still use dialog editor created windows if you created your own subclassed custom control that set the CS_OWNDC style appropriately, but that's a lot more code, aargh.
|
|
|
|
 |
|
 |
I wanted to change the background color from black, however, when I modify the values from (0,0,0) to (1,1,1) or any other for that matter, I see no change!
What is going on?
|
|
|
|
 |
|
 |
glClearColor(1.0,1.0,1.0,0.0);//white
glClear(GL_COLOR_BUFFER_BIT);
Gita
|
|
|
|
 |
|
 |
How to run 2 different(or same) OpenGL objects in one DialogBox?
IDC_STATIC1 is a first OpenGL objects Scene window.
IDC_STATIC2 is a second OpenGL objects Scene window.
IDC_STATIC1 and IDC_STATIC2 ,they are placed on IDD_DIALOG1.
code:
pclStatic = (CStatic *)GetDlgItem(IDC_OpenGL_Window);
pclGlView = new CGlView(pclStatic);
pclGlView->OnCreate();
pclGlView->InitGL();
pclGlView->DrawGLScene();
pclStatic1 = (CStatic *)GetDlgItem(IDC_OpenGL_Window);
pclGlView1 = new CGlView(pclStatic1);
pclGlView1->OnCreate();
pclGlView1->InitGL();
pclGlView1->DrawGLScene();
Will not involve both windows (IDC_STATIC2,IDC_STATIC1)
|
|
|
|
 |
|
 |
I want to make a multi-viewport into a display window but each viewport has its HDC context.
Have anyone could solve it for me?
thx!
|
|
|
|
 |
|
 |
Howto Draw something in an edit box?
hEdit=GetDlgItem(hwnd,IDC_DRAW);
hdc = BeginPaint(hEdit, &ps);
SetPixel(hdc,10,10,0);
EndPaint(hEdit, &ps);
that doesn't work
|
|
|
|
 |
|
 |
can i handle mouse events like lbuttondown or mouse move
within each of the opngl-rendered windows ?????
pls help me
niranjan
|
|
|
|
 |
|
 |
Since the app is the parent owner of the windows, i don't see why not ? Perharps try something like SetWindowLongEx or something like that ?
|
|
|
|
 |
|
 |
Then, when you close the dialog, and then open it again, and hit render, nothing happens.
Also, using Edit boxes probably isn't a great idea, as you can still type in the control while the OpenGL rendering is happening. I easily converted the edits to static text controls, and it works better.
|
|
|
|
 |
|
 |
Slight bug in the code that causes it not to run again the second time is due to this section
while(TheEnd !=1 )
{
...
}
To fix this just put add the following into the OpenGL dialog proc
case WM_INITDIALOG:
TheEnd=0; <---- add this line
return TRUE;
|
|
|
|
 |