Is it possible to draw outside the client window using OpenGL - c++

Just like to add a bit question similar to this link. Is there anyway I could do to draw outside the client window using OpenGL without any native commands to be used? or is this beyond OpenGL previleges?
Other ways I could think of is to draw a sub window and remove the built in borders and button on it, then draw what I wanted there?

Related

Can I clip DirectX viewport into a single win32 control and use it together with other controls?

I was drawing triangles in D3D.
Doing that, I noticed that I always used the whole window for rendering and what if I want to create editor for something or 2D game engine or similar that requires GUI controls? Should I put separated dialog boxes that contain that controls (as shown on this image) or I should just clip this viewport into certain place on window or control such as on this example:
I tried to use static control handle for DXGI_SWAP_CHAIN_DESC::OutputWindow instead of main window handle and program crashed. And this made me very confused.
I didn't provide code because there are identical examples of initializing DirectX.

render a qt overlay window over opengl child window

I am looking for some information about rendering child windows in specific about how OpenGL interop with GDI. The problem that I have is that I have basically is that I have two windows, first, the main windows are created in qt, and inside of qt, a child window is hosted that leverages an OpenGL renderer.
Now what I wanted to do is to host an overlay on top of my OpenGL window, so I use that to overlay the OpenGL window. The problem that I am having is that when I render with OpenGL, the OpenGL generated graphics seem to obscure the graphics area including and effectively undo the graphics composited by qt.
In the image below the blue area is the qt overlay, in that picture I'm using GDI (BeginPaint/EndPaint) so and the windows seem to interact fine. That is, window order seems correct, the client region is correct. The moment I start to render with Opengl the blue area gets replaced with whatever OpenGL renders.
What I did I basically created to create the overlay I created a second frameless, topmost QMainWindow, and once the platform HWND was initialized I reparent it. Basically I change the new windows parent to be the same parent of my OpenGL window.
What I believed this would do is that the every window, gets drawn separately and the desktop composition manager would make the final composition and basically avoiding the infamous airspace problem as documented by Microsoft in their WPF framework.
What I would like to know is what could cause these issues? At this point, I lack understanding why once i render with OpenGL the pixels by qt overlay are obscured, even though windows hierarchy should say make them composited. What could I do to accomplish what I want?
Mixing OpenGL and GDI drawing on a shared drawable (that also includes sibling / childwindows without the CS_OWNDC windowclass style flag) never was supported. That's not something about Qt, but simply how OpenGL and GDI interact.
But the more important issue is: Why the hell aren't you using the OpenGL support built right into Qt in the first place? Ever since Qt-5 – if available – uses OpenGL to draw everything (all the UI elements). Qt-5 makes it trivial to mix Qt stuff and OpenGL drawing.

QOpenGLWindow z-order issues

I am working on updating an application for a client.
They use Qt and currently use a QGLWidget to display a full-screen view of 1 of 4 possible cameras selected by clicking the appropriate radio button. They then use OpenGL to draw on the image being displayed. This works great, but they want to update the UI to include a quad-split view of all 4 cameras.
My first thought on how to accomplish this was to keep the one QGLWidget for the full-screen display, and have 4 small QGLWidgets for the quad-split. From the documentation I found that you can't overlap QGLWidgets or QOpenGLWidgets because they don't handle z-order appropriately, but that this can be accomplished by using QOpenGLWindows and QWidget::createWindowContainer.
So, I coded up an application that uses a QOpenGLWidget (trying to bring them up to date) for the full-screen view, and 4 smaller QOpenGLWindows using QWidget::createWindowContainer, but this isn't working either.
The widgets built from QOpenGLWindows are always on top even if I use lower() to try to get them behind the full screen QOpenGLWidget. I've also tried using hide() on the widgets built from QOpenGLWindows, however, this has had no effect.
Do this at a lower level. Keep the one QGLWidget -- in fact don't touch your Qt objects. Instead, change the lower-level rendering so that it makes 4 calls to glViewport.
After each call to glViewport, update the modelview and projection and matrices according to the camera of interest, then draw the 3D scene.
This is simple and performant, because the driver only needs to deal with a single OpenGL context. You might have some extra work to adjust mouse input, but I think it'll be worthwhile.

How to create a Qt Drop Shadow without using transparencies? (Because the window manager doesn't support it)

I'm building a UI in Qt 5.9 that needs to run on an X11 display. I'm trying to add drop shadows to my dialog windows - but they don't work over X11.
The approach I'm taking is from zeFree's answer in This Question. (Put everything in the window in one widget, set the window translucent, and create a dropshadow effect on the widget).
setAttribute(Qt::WA_TranslucentBackground); //enable Window to be transparent
QGraphicsDropShadowEffect* effect = new QGraphicsDropShadowEffect();
effect->setBlurRadius(5);
ui->widget->setGraphicsEffect(effect);
It works great in my redhat vm:
RedHat Dropshadow
But when I send to the X11 display I, it looks like the transparency isn't supported, and I get the shadow on black instead:
X11 Dropshadow
My question is: Is there a way to make my Dialogs project a drop shadow onto my main window instead of onto their own (transparent) background? My application will be full screen on the X11 display so I don't need to worry about shadow effects outside of the window.
Any answer that gives me a clean way to get a drop shadow effect on this X11 display will be accepted.
If your window manage doesn't support transparency you are out of luck IMO. At least with your current approach.
There is theoretically a way to fake it, provided you can grab the pixel values from the underlying window manager composite that is under your application, then draw those pixels from your application, filling the black void, with the shadow composed over that, and finally your GUI stuff.
There is also the more viable course of giving up on native windowed dialogs and fake the dialog using a regular floating widget. This has the disadvantage that it will only be able to move within the confines of your main window, but this way you will have complete control over the drawing and not fall victim to platform limitations.

Draw OpenGL on the windows desktop without a window

I've seen things like this and I was wondering if this was possible, say I run my application
and it will show the render on whatever is below it.
So basically, rendering on the screen without a window.
Possible or a lie?
Note: Want to do this on windows and in c++.
It is possible to use your application to draw on other application's windows. Once you have found the window you want, you have it's HWND, you can then use it just like it was your own window for the purposes of drawing. But since that window doesn't know you have done this, it will probably mess up whatever you have drawn on it when it tries to redraw itself.
There are some very complicated ways of getting around this, some of them involve using windows "hooks" to intercept drawing messages to that window so you know when it has redrawn so that you can do your redrawing as well.
Another option is to use clipping regions on a window. This can allow you to give your window an unusual shape, and have everything behind it still look correct.
There are also ways to take over drawing of the desktop background window, and you can actually run an application that draws animations and stuff on the desktop background (while the desktop is still usable). At least, this was possible up through XP, not sure if it has changed in Vista/Win7.
Unfortunately, all of these options are too very complex to go in depth without more information on what you are trying to do.
You can use GetDesktopWindow(), to get the HWND of the desktop. But as a previous answer says (SoapBox), be careful, you may mess up the desktop because the OS expects that it owns it.
I wrote an open source project a few years ago to achieve this on the desktop background. It's called Uberdash. If you follow the window hierarchy, the desktop is just a window in a sort of "background" container. Then there is a main container and a front container. The front container is how windows become full screen or "always on top." You may be able to use Aero composition to render a window with alpha in the front container, but you will need to pass events on to the lower windows. It won't be pretty.
Also, there's a technology in some video cards called overlays/underlays. You used to be able to render directly to an overlay. Your GPU would apply it directly, with no interference to main memory. So even if you took a screen capture, your overlay/underlay would not show up in the screen cap. Unfortunately MS banned that technology in Vista...