Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am trying to find out what's the best way to display a custom design GUI for a windows application? (I wouldn't mind cross-platform compatibility but windows is enough for now ;) )
I tried using DirectX but the problem with DX is, that you are forced to either use textured quads or render shapes other than quads or triangles with a lot of vertices... I'd prefer NOT to use bitmaps due to the limited resolution. Also a problem with DirectX is, that it doesnt run on systems without a compatible graphics card...
I don't want to use any librarys like Qt or such... I want to do it by myself, I just don't know where to start... Basicly what I'd like to have as a result is something like the GUI of NI's Traktor... (picture below) I have noticed that Traktor runs basicly everywhere (so I think it does not rely on GPU). Any suggestions?
You could do all your drawing in WM_PAINT
Use BeginPaint
Create your object
SelectObject
Draw your stuff or what ever
Then DeleteObject
You can even make a colour Transparent
If you want to draw your GUI in a different shap
Use SetLayeredWindowAttributes set the colour that you want transparent
Also look up Custom Draw
There are alot of examples out there
If you want to stick with windows, you can use GDI.
I'd prefer NOT to use bitmaps due to the limited resolution.
You can always create bitmaps dynamically. There are lots of open source libraries to help with the drawing, or you can use GDI for this again.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I'm currently developing an OpenGL application and I want to use Qt for the other stuff. I want to use OpenGL like I use it with GLFW and without Qt functions. Just normal OpenGL. I cant find any site which uses Qt like id like to. So I only want to use Qt for the Windows and creating context and so on, but use OpenGL for the rest.
Thanks for your time.
There is an old-school QOpenGLWidget that will create an OpenGL context. That will give a window with an area to draw on.
Other option is the Scene Graph - OpenGL Under QML - pretty much the same, but it also allows to have QML user interface (buttons, edits, etc.) above your OpenGL rendering.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am trying to create a GUI for a tower of Hanoi application using Qt. I Already wrote the C++ code using recursion but I am a total beginner when it comes to working with Qt and creating GUI's and have just started familiarizing myself with it by creating a simple calculator GUI but don't have a clear idea how to tackle the Tower of Hanoi GUI especially on how to create the disks and pegs graphically.
Any tips or pointers on where to start would be welcome. Thank you.
I suggest to take a look at QGraphicsScene. It will take a while to get familiar, but it is the proper Qt tool for handling these kind of things.
Basically, QGraphicsScene is an abstract representation of, well, a graphics scene. It is a virtual canvas object to which you can add graphics items (QAbstractGraphicsItems) with various shapes and positions. It can then be rendered in a specialized view class called QGraphicsView.
A good starting point is the '40000 chips' example in Qt Creator.
I can recommend 2 options:
One would be using an OpenGL canvas inside your window and have objects loaded into your 2D scene. And when you need to move or rotate the objects, you would just need to know about translate and rotate functionalities.
You wouldn't need to do this with modern OpenGL, as it might be overwhelming at the starts. But OpenGL with fixed pipeline (legacy version) would be quite easy to learn. However, I should mention that QT and OpenGL can be a little trouble to use together for a beginner due to QT.
The other would be the QPainter to load and draw 2D images (of components of towers). It wouldn't be as realistic as an OpenGL equavelent, but it would get the job done as well.
You can find the functions available via QPainter in the following link. It has almost everything you would need and to move a part, just render using the initial position values added to the offset.
http://doc.qt.io/qt-5/qpainter.html
I also recommend watching a few videos on Youtube about translation in computer graphics, to understand the logic behind this common functionality about moving things in a scene in amounts dependent on other conditions.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am using opengl in a Xlib window.How do I draw text on this window (not in 3d)?
You can use the usual X font drawing functions. In a single buffered window OpenGL is just another drawing primitive. In a double buffered Window after the glXSwapBuffers you need to XSync but then can draw over the OpenGL drawing using X font primitives (you can also use Xft).
However note that in the case of a double buffered OpenGL window you can not freely mix X text with OpenGL.
Update:
Also if you have the GLX_ARB_texture_from_pixmap extension available (which main use is the implementation of compositors, but you can use it for other things as well): You can draw your text into a server side X11 pixmap using the regular X11 drawing primitives (+ X11 extensions like XRender and Xft), and then bind that very pixmap to a OpenGL texture unit as image source.
Of course using any of the X11 specialized functions locks your program to X11.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
Like the title says, I'm looking for a library that's platform-agnostic and lightweight, for the purpose of displaying buttons, slider bars, check boxes, etc. in OpenGL. Ideally, something that is not directly coupled with OpenGL is best (ie. so that I may replace the rendering with DirectX if need be).
My 'ideal' library would have an event system that supports callbacks or something similar. This is a nice-to-have, but not absolutely required.
I looked into Qt and wxWidgets and both seem very heavy. CEGUI looks like a mess of code. Most other libraries I seen are GLUT based.
There's Dear IMGUI
https://github.com/ocornut/imgui
It's completely graphics API agnostic. It just builds vertices. Its up to you to render them.
There's also nuklear inspired by Dear ImGUI.
You might want to have a look at a game engine such as Irrlicht which provides OpenGL, DirectX and Software renderers and supports a 2D GUI System with Buttons, Lists, Edit boxes. See the feature page to learn more about its capabilities and the user interface sample to try this specific UI feature.
Irrlicht is open source and works on many platforms. From the feature page it supports:
Windows 98, ME, NT 4, 2000, XP, XP64, Vista, CE
Linux
OSX
Sun Solaris/SPARC
All platforms using SDL
Neither wxWidgets nor Qt draw in OpenGL; they don't use OpenGL rendering commands to draw. They allow you to create OpenGL windows, but the regular GUI controls (buttons, lists, etc) are not drawing through OpenGL. They're drawn through the native drawing mechanism of your platform of choice.
You are generally not going to find very many standalone GUI libraries that actually do their rendering in OpenGL. The only one I know of is CeGUI, which fits all of your requirements but you dismissed as being "a mess of code." Everything else is generally going to be "heavyweight", because it's part of a game engine.
Now, if you're not looking for something that actually draws using OpenGL commands, but is simply something that you can use alongside an OpenGL window, then things open up somewhat. However, your dismissal of wxWidgets as being "very heavy" is disconcerting, because GUI libraries aren't really going to get much lighter weight than that. A good GUI system requires a lot of stuff.
The smallest cross-platform GUI library that supports making an OpenGL window is probably FLTK. And even that's pretty big.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I am looking for a GUI toolkit that is easy to use and cross-platform. Another major requirement of the GUI is that it should support zoom and pan. For example, I should be able to zoom in on a picture and enlarge buttons.
Something like this:
http://eaglemode.sourceforge.net/video.html
But it should have Windows support also (which to the best of my knowledge Eagle Mode doesn't have).
From what I understand, QT is a good UI and it can draw right on top of the OGL window. I think it resets the matrix before drawing the buttons. If I can prevent that reset, the GUI can be zoomed along with the rest of the items. Is there a simple hack to do just that?
Thanks,
This is doable in Qt 4.4 and above using the Qt Graphics View Framework. It makes it very easy to make these types of interfaces, since Widgets can now be placed on the scene (QGraphicsScene) using QGraphicsWidget and QGraphicsLayout.
The framework supports zooming, panning, rotating, etc - with animation.
Take a look at Piccolo2D, which has Java and .NET bindings.
It is the successor of Pad++, which was well ahead of its time: