-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GL::Context: unsupported OpenGL version (0, 0) output while building base-wxwidgets #26
Comments
Hi, thanks for the report! Interesting, looks like things changed significantly since I last checked on Arch. I got stuck already at CMake not being able to find diff --git a/src/MyApplication.cpp b/src/MyApplication.cpp
index 21d1672..05756d3 100644
--- a/src/MyApplication.cpp
+++ b/src/MyApplication.cpp
@@ -61,6 +61,7 @@ MainFrame::MainFrame(int argc, char** argv): wxFrame{nullptr, wxID_ANY, "Magnum
#endif
_wxGlContext = new wxGLContext{_wxGlCanvas};
+ Show();
_wxGlCanvas->SetCurrent(*_wxGlContext);
_glContext.create();
The However, I have zero idea what I'm doing here (not a wxWidgets user at all), so I didn't commit the above. Can you confirm that |
@mosra Thanks for the fix. Calling CMake couldn't find wxWidgets for me too. I fixed it by creating a symlink /usr/bin/wx-config pointing to /usr/bin/wx-config-gtk3 instead of your CMakeLists solution. I am an absolute beginner in wxWidgets and I chose it because it is said to provide native look. I will develop a cross platform app for Windows and Linux. I have used .Net WPF before. I didn't like Qt because it seemed too tied to the Qt Creator. Do you use any GUI framework? I appreciate it if you have any suggestion. |
By looking at the
I was happily using Qt without QtCreator for several years in the Qt4 days, and didn't really miss any of its features for Qt development. Though I have to admit it "jumped the shark" after that, and version 5 (and now 6) seems rather bloated. (OTOH I'm a happy KDE user and wouldn't trade it for a GTK-based environment ever, the difference in overall polish and flexibility is just too huge between the two.) Qt is bloated, GTK lacks critical features like fractional DPI scaling, .NET is, well, C#... I don't have a suggestion, sorry, it's all various levels of bad nowadays :( Depending on what you'll be doing, using ImGui might be just fine and flexible enough (and Magnum has integration for it). That one is very feature-rich although I don't personally like the default look, and the only major downside is that it's not suited for "idle" apps because it requires constant redraw in order to function properly. |
Sorry for the late answer! I don't check GitHub as often as I used to. 😅
Yes, it can. In fact, in my wxWidgets/Magnum project, I do all of the context setup in the constructor for the window. Here's what I have in that project: _wxGlContext.emplace(_glCanvas, nullptr, &context_attributes);
#ifdef __WXGTK__
Show();
#endif
_wxGlContext->SetCurrent(*_glCanvas);
#ifdef __WXGTK__
Hide();
#endif Since I only target Windows and Linux, I use If there are any further questions, I'll try to answer them ASAP. |
Oh, so you're saying it's backend-dependent? Interesting. Are there any "good practice" docs explaining this in more detail? Like if it's a GTK quirk or something one should expect in general. |
In a way, yeah. On Windows, wxWidgets will assert in the same way as on GTK when calling
The "good practice" on all platforms would be to only set a context as current when the canvas is shown, as the docs for While the docs also say to not call it in the constructor of the window, it worked fine during my testing of the bootstrap project. And in my main project, I do the initialisation of the context in another class that inherits from the window's class, so the window itself is technically ready by that point. It's... a bit of a mess, I admit. |
By searching the error message, I got this: Context::current(): no current context · Issue #167 · mosra/magnum As the internal context is created by the
How can we create a mesh and shader object if the |
I solved this issue by a hack that I just create a function to initialize the
It is dirty, because I have to use the method mentioned here: Now, the next step is I just try to see if I can add the mouse event handling, so I can tweak the camera (to rotate, scale the scene) |
@asmwarrior delayed context creation is a rather common workflow, the solution is using the GL::Mesh _mesh{NoCreate};
Shaders::VertexColor2D _shader{NoCreate}; and then, once you have the context created, populating them with proper live instances: _glContext.create();
// Now it's safe to call into GL
_mesh = GL::Mesh{};
_shader = Shaders::VertexColor2D{}; I realized the documentation for this workflow was rather nonexistent (sorry about that), so I mentioned this in the OpenGL wrapper overview and a few other places (mosra/magnum@2bd933d). |
Hi, @mosra , many thanks! |
I am getting
GL::Context: unsupported OpenGL version (0, 0)
output when I run MyApplication that is created by building the base-wxwidgets branch of magnum-bootstrap. My distro is Arch Linux.Btw I moved
_wxGlCanvas->SetCurrent(_wxGlContext)
method toMainFrame::OnPaint
because otherwise I get a failed assert. Assert error isglx11.cpp assert xid failed in setcurrent window must be shown
.The text was updated successfully, but these errors were encountered: