I'm currently working on a project for my 3rd year at University using OpenGL with GLEW, GLFW and AntTweakBar. On my own machine (i5-2500k, GTX 570) it runs fine. However, when I've tried it on a number of other systems (all of which have ATI graphics) I can only either get the actual rendering to show, or the AntTweakBars.
To make it a bit clearer, on my own machine I initialize AntTweakBar using the line:
TwInit(TW_OPENGL, NULL);
Which works fine. Now, on the other computers I've tried it on at the University, if I keep this line the same, the AntTweakBars fail to appear but my own renderings do appear. However if I change that line to:
TwInit(TW_OPENGL_CORE, NULL);
The tweak bars appear, but my own rendering disappears. I may be jumping to the conclusion of it being related to the ATI graphics but I don't have access to another nvidia based machine to test on.
So, has anybody experienced anything similar to this or have any ideas as to what the problem might be?
Related
My situation
I want to build a cross platform application, with a gui, that displays a 3d view of some simple cubes, that the user can interact with. Qt seemed like a good tool for the job and I think I have the gui part sufficiently down for the most part. For the 3d part OpenGl or the qt/3d implementation seemed like the right tool, but it does not work. When I try to run the examples from Qt, that use a 3d view, they are unstable, they crash, show a black window and on the offchance, that I find one, that does work there is aggressive flickering and my entire system becomes unresponsive when I only try to resize it. I don't know what is wrong, I don't think I can do a better job, than the official examples and I don't think, that trying to debug the examples is the way to go. (If someone has an idea how to fix this tell me, but I don't even have an error message)
My question:
Is there a simple framework, that would allow me to display simple 3d shapes and include that in a Qt application. I don't need shadows, or reflections or transparency or anything more fancy, than ambient light. Just some solid coloured boxes I can rotate and click on. I think it would even be fine, if it ran on CPU rather than GPU. It would be nice, if I could keep using C++, but if it only exists in another language, what gives. I don't really want to build a framework from scratch. How could I include such a foreign framework in Qt?
I am using ubuntu 20.04 with intel graphics, but as I said, I want the resulting application to work on as many platforms as possible.
I am working on an application that uses Qt3D with then OpenGL renderer. Deploying the app to a handful of users, I found some severe issues with Intel Integrated Graphics, ranging from crash to rendering bugs like flickering. This unfortunately doesn't comes from Qt or OpenGL itself but more from how Intel implements their OpenGL drivers.
The crash bug seems to impact older intel chips, very few references of that apart some random minecraft FAQ on reddit: https://www.reddit.com/r/Minecraft/comments/48ktct/19_faqs/
But what is claimed there seem to align with what my users are experiencing.
The flickering bug has only been reported recently and I unfortunately don't have the right hardware to replicate it yet...
I know it's like random, not sourced information but I thought that personnal experience might help.
I used osgQt many years ago. It looks active still. I know the military likes them.
https://github.com/openscenegraph/osgQt
I have a weird problem with GLFW on my MacBook Screen. I am creating a 1400 by 900 pixel window on my nearly 4k screen (3456 x 2234), so it should be really tiny. Instead what happens is that the window is 4 times the size (double in length and height) and my rendered content is only being displayed in the upper left of the screen.
I know that apple does some sketchy mapping stuff because of their wird aspect ratio display, but I searched for quite a while and no one has had the same problem.
What's even weirder is that if I create that window on an external monitor and drag it onto to laptop display, it works just fine. It only messes up when created on the laptop display itself.
I am using GLFW 3.3 and Vulkan 1.2.198 on macOS Monterey 12.1
Any help is appreciated.
EDIT: After trying nearly everything possible in my code and getting the same bug when using the minimal example from the GLFW getting started example, I came to the conclusion that this isn't code related as pointed out in the comments.
This appears to be an issue with how Mac displays report their resolution. Note that this is not a silver bullet but, when faced with the same issue, this worked for me.
The short of it is that the values that you're using to calculate your viewport are incorrect due to how the Mac display scales. The solution that I've found is to ask GLFW what you should set.
To get these values, just use the following function call. I am not sure what the glViewport equivalent is in vulkan, but this should theoretically work, and worked for me in OpenGL for the same problem.
int initial_framebuffer_width, initial_framebuffer_height;
glfwGetFramebufferSize(g_glfw_window, &initial_framebuffer_width,
&initial_framebuffer_height);
// Set your viewport here with the width and height.
If this didn't work, a good debugging step is to draw the window, then attempt to resize just a tiny bit, then print out the width and height values that GLFW gives in the framebuffer callback. You should notice that they might be much larger than what you set them to, this is how you know it's the scaling issue, and the above code should give you what you're looking for.
Starting recently, all QT applications have problems with window sizing and offset, f.i. the window origin (0,0) seems to be moved left and up, so that the menu disappears.
This is how it should look:
And this is how it looks with the problem:
Any idea what setting might have gone haywire ?
I suspect this has happened after an update of Intel HD Graphics Drivers. Anyway, since I have NVIDIA graphics aswell I tried to force the use of it instead of the default Intel HD Graphics, and voila!, it works perfectly. I had the same problem within Qt Creator, and this solved that as well.
It should be noted that I changed the default choice to NVIDIA, and now all applications using Qt work fine.
I am writing an application which will allow the user to scrub through an open video. Developing on Windows 7/8 with Qt 5.3, I have been using QMediaPlayer and QVideoWidget following the qvideowidget example project. The result has been pretty good, except that the QVideoWidget seems only to update during idle time. Still, it's a good start and it's usable.
However, when I build on Mac OS 10.10 (again with Qt 5.3), scrubbing behaves as though there were only one frame per second in the video. As I drag the "position" slider, the video jumps from one frame to the frame one second later, then one second after that, even though I am calling QMediaPlayer::setPosition several times with positions between those two frames.
The problem can be reproduced using the videowidget example that ships with Qt 5.3 here: Qt\Examples\Qt-5.3\multimediawidgets\videowidget. When the slider is dragged on a Windows machine, the QVideoWidget moves between frames that are spaced fairly close together. When the slider is dragged on a Mac (at least on mine), the QVideoWidget jumps between frames spaced about one second apart. No matter how long I wait for an "in between" frame to render, it won't happen unless I hit the "play" button.
I've tried calling QMediaPlayer::play() and QMediaPlayer::pause() one after the other to force an update, but this doesn't seem to work--QMediaPlayer works asynchronously, so the update doesn't have time to take effect.
If I check the value of QMediaPlayer::position, I find that it actually doesn't change between these jumps. It appears that when I call QMediaPlayer::setPosition, it is actually rounding the position to one second increments on a Mac and finer increments on a Windows machine.
Ideally, I would like to jump to a particular position in the video and render that frame immediately on the QVideoWidget. Is there any way to force QMediaPlayer to set the position accurately and update the associated QVideoWidget? Is there a better way to implement smooth scrubbing in a video?
Thanks for your help!
In case anyone else has a similar problem...
My best guess is that the issue stems from limitations in the codec used by QMediaPlayer, since this seems to be the main difference between the two platforms. Rather than deal with the codec issues directly, I looked around for other options.
MLT (http://www.mltframework.org/) seemed promising, but it is a major pain to compile and the primary author seems to have settled on offering SDK support to commercial users only.
libVLC (https://wiki.videolan.org/LibVLC/) looks a lot better. In particular, I’ve been using vlc-qt (https://github.com/ntadej/vlc-qt). The latter has an interface that will look quite familiar to users of QMediaPlayer and QVideoWidget. It was an easy replacement in my own application, and the result was much smoother video scrubbing on both Windows and Mac.
Hope this helps someone else!
I've been challenged with a C++ 3D application project that will use 3 displays, each one rendering from a different camera.
Recently I learned about Ogre3D but it's not clear if it supports output of different cameras to different displays/GPUs.
Does anyone have any experience with a similar Setup and Ogre or another engine?
At least on most systems (e.g., Windows, MacOS) the windowing system creates a virtual desktop, with different monitors mapped to different parts of the desktop. If you want to, you can (for example) create one big window that will cover all three displays. If you set that window up to use OpenGL, almost anything that uses OpenGL (almost certainly including Ogre3D) will work just fine, though in some cases producing that much output resolution can tax the graphics card to the point that it's a bit slower than usual.
If you want to deal with a separate window on each display, things might be a bit more complex. OpenGL itself doesn't (even attempt to) define how to handle display in multiple windows -- that's up to a platform-specific set of functions. On Windows, for example, you have a rendering context for each window, and have to use WGLMakeCurrent to pick which rendering context you draw to at any given time.
If memory serves, the Windows port of Ogre3D supports multiple rendering contexts, so this shouldn't be a problem either. I'd expect it can work with multiple windows on other systems as well, but I haven't used it on any other systems, so I can't say with any certainty.
My immediate guess, however, is that the triple monitor support will be almost inconsequential in your overall development effort. Of course, it does mean that you (can tell your boss) need a triple monitor setup for development and testing, which certainly isn't a bad thing! :-)
Edit: OpenGL itself doesn't specify anything about full-screen windows vs. normal windows. If memory serves, at least on Windows to get a full screen application, you use ChangeDisplaySettings with CDS_FULLSCREEEN. After that, it treats essentially the entire virtual desktop as a single window. I don't recall having done that with multiple monitors though, so I can't say much with any great certainty.
There are several things to be said about multihead support in the case of OGRE3D. In my experience, a working solution is to use the source version of Ogre 1.6.1 and apply this patch.
Using this patch, users have managed to render an Ogre application on a 6 monitors configuration.
Personnaly, I've successfully applied this patch, and used it with the StereoManager plugin to hook up Ogre applications with a 3D projector. I only used the Direct3D9 backend. The StereoManager plugin comes with a modified demo (Fresnel_Demo), which can help you to set up your first multihead application.
I should also add that the multihead patch is now part of the Ogre core, as of version 1.7. Ogre1.7 was recently released as a RC1, so this might be the quickest and easiest way to have it working.