What are some good GUI controls for directx c++? - c++

I need GUI controls that is simple to initialize.

I think you can use the standard WinApi controls on top of DirectX window, at least with OpenGL you can. WS_CHILD on control, WS_CLIPCHILDREN on DirectX Window. Or just use regular window and initialize DirectX scene in sub-window.
Was this what you were looking for?

From MSDN:
"The DirectX Utility Library (DXUT) is a framework used by most of the Direct3D tutorials and samples and is built on top of the Direct3D 9 and Direct3D 10 API."
and...
"DXUT also include a set of textured GUI controls, including an IME-enabled edit box, extra classes such as simple camera types, and a high-resolution timer class. DXUT is designed to be modular, so the application can use all of the DXUT features or just the parts desired."
DXUT has plenty of good UI controls to get you started. All of the code is open for modification as well, so you can copy what you need. The controls are also very easy to initialize. For example, once you have the framework set up, you simply call "AddButton()" and pass in a few parameters.
For a professional project though, I would recommend either writing your own controls or looking at some of the popular frameworks, like Crazy Eddie's GUI System.

Related

Creating a simple window with simple controls in c++ and OpenGL

How do i just create a window with just some controls like menus , check button , radio button , scroll bar ..just with c++ and OpenGL?
It depends.
1) You can't use any external libraries.
In this case you would need to create whole framework for creating controls, handling events, hit tests, state changes... Shortly speaking, you would need to write a GUI library like Qt or wxWidgets, but with all controls drawing implemented in OpenGL.
2) You can use 3rd party libs.
Well, simply read the spec and use them. Examples:
GiGi
GLUI
Also, you may want to read this: OpenGL Forum
However, if you don't have to use OpenGL-based solution, I would suggest you use wxWidgets. I've been using it for years. It's my favourite cross-platform GUI library with solid support, quite big community and reliable, up-to-date online/offline documentation.

OpenGL/GLUT view contained in WinAPI window

What I'm trying to achieve is something like this - that is, an OpenGL view contained in a standard window, alongside some buttons, menus, etc.
However, I'm trying to use non-managed C++ and WinAPI to accomplish that (project requirements), and, if possible, (free)GLUT.
However, it seems to me that the only thing possible using GLUT is to create a separate window. Am I right, or is there actually a way to pass a window handle to GLUT for rendering? Or am I completely off the track?
Yeah, as far as I am aware GLUT only lets you do full-blown windows and will not let you paint into an arbitrary rectangle. There are a number of tutorials on setting up a render context in Windows using nothing but the Win32 and WGL APIs. Once you get your context setup, you can effectively do everything the same way you would with GLUT, but use the appropriate WGL function for swapping buffers.
Here's a high-level overview of what would be involved, though it's really text-heavy and related to MFC it outlines the whole process. You should be able to lookup the appropriate WGL API reference to implement this.
There's really no point in using GLUT if you've already decided to use the Win32 API to be honest, it is going to try to hide everything from you including the message pump that you'll need to handle dialog initialization and button events. If your requirements weren't limited to Win32 API, I would suggest something a little more portable like Qt for a framework that's dialog-friendly and supports OpenGL.

Curiosity: Background C++ windows. Difference between SFML/SDL type and Qt (GUI) type

I was wondering what is the difference between the windows that will render images on the screen (such as SDL, SFML or OpenGL) and the classic GUI window (with the gray background by default) where you can implement buttons like in Qt for C++ or AWT/Swing in Java?
What is going on in the background code? Are they the same type? Is there a rendering layer over the graphics window allowing to display such images?
Well first of all they are different APIs. SDL and SFML are libraries directed at making games and quite possibly other applications. OpenGL is a graphics API, it is not a full suite of libraries.
Note also that SFML pretty much uses OpenGL to render to the window. The actual window its self is created via platform specific functions. The Win32 API is used for windows and the X11 Window System is generally used on Linux.
The "classic GUI window" is pretty much the platform specific APIs. The differences in background code is really just defined by the purpose of the API. Note that in the end of the line Qt/SFML/SDL all go down to the platform specific API. OpenGL even requires you to interface with the platform specific API. SFML/SDL/QT essentially do the lower level work for you.
I hope I gave what you are looking for as this question really has a wide range of answers.

How to create custom skin like WinAmp

I guess this question has been ask before, but I have not found sufficient answer to even start poking around. Most answer refers to catching WM_PAINT method directly and do custom rendering, or use a onwer draw object. However, I did not see a centralized place that has the info. to start researching. Hence, the question.
My goal is to create a very simple GUI program with custom look into it. I prefer the way winamp does their custom look that is customizable through "skins". However, I am not interested in using some cross-platform library like GTK+, QT or wxWidget.
I have some experience in system programming, but not much for GUI. I spent most of my time developing console applications, and I just started doing some QT development. If you can point me in the right direction, I'd be very appreciated.
PS: I am interested in both windows and linux environment.
Everybody,
Sorry for the late reply. I had a chance to have a quick talk with the original developer for winamp, and this is the quick answers I have:
Using skins: Artists create skins, developer will render the skins
To the OS (Windows), winamp is just one pretty box, nothing else. There is a container windows, and that's about it
All controls (button, label, list, etc) are implemented by winamp team themselves. All messages and stuffs are passed as relative position to the container window. WinAmp and the GUI engine has to decide if a button is clicked or if the label next to it is the target, etc.
Rendering artists skins created in XML
I do not have the details on if they use any libraries to do all that, but I am suspecting they do hook a window call directly, and do custom rendering themselves.
GUI skin usually using plug-in mechanism
I guess this is exactly what you are looking for:
https://www.linux.com/learn/tutorials/428800:weekend-project-creating-qt-interfaces-with-gimp?utm_medium=twitter&utm_source=twitterfeed
I also interested in creating custom look of window and widgets.
Speaking about widgets it's not hard, just need to create subclass (if you are using C++) or some widget and implement some methods like draw, handle etc. But this solution is good only if you use some high-level library like GTK, QT, etc. If you want to implement all controls by your own, you may get any graphics library, which can create window and do any graphics inside. For example, SDL2 + Cairo. SDL2 for creating window, Cairo for vector rendering controls/widgets. Both of this libraries are for win and linux. Another option is take opengl/vulkan + some lib for rendering window. It could be SDL2, SFML, GLFW.
If you really interested how it works on low level, then search Windows API for Windows and XLib or XCB for Linux/X.Org.
Speaking about window, I still investigate it. However I have one thought: you may create an empty window and then draw whatever you want. Then you need to add handlers for resizing window on the borders. But I am not sure if it's good solution, and if it won't freezes.

window handlers for opengl

I've been programming opengl using glut as my window handler, lately i've been thinking if there are any advantages to switching to an alternate window handler such as wxWidgets or qt.
Are there any major differences at all or is it just a matter of taste? Since glut provides some additional functions for opengl-programming beyond the window handling features, would there be a point in combining an additional toolkit with glut?
I can only speak from experiential of using QT:
Once you have the basic structure set up then it is a simple case of doing what you have always done: for example, the project I am working on at the moment has an open gl widget embedded in the window.
This widget has functions such as initializeGL, resize...paintGL etc. Advantages include the ability to pass variables to an from the other windows / widgets etc. QT also has additional functions for handelling mouse clicks and stuff (great for 2d stuff, 32d stuff requires some more complex maths)
You need to move from glut as soon as you want more complex controls and dialogs etc.
QT has an excellent openGL widget there is also an interesting article in the newsletter about drawing controls ontop of GL to give cool WPF style effects.
wxWidgets also comes with an opengl example but I don't have much experience of it.
Well - glut is okay to get a prototype going.
It depends on the OS, but later on you may want to prevent the screen-saver from starting, you may want to disable the task switch (only the bad guys do this though), You may want to react to power down events. You may find out that glut can't deal with dead-keys on one or another operation system, or, or, or... There are thousand reasons why you may want to get rid of it.
It's a framework designed to make the start easy and do 90% of the usual stuff you need, but it can never do 100%. You can always hack yourself into glut or lift the init-code, but one day you will find out that it's easier to redesign the init-code from scratch and adjust it to your task.
Opening a window and initializing OpenGL is not rocket-science . Use glut as long as it works for you, but as soon as it makes problems get rid of it. It'll take you just a hand full of hours, so you won't loose much.
For a toy project glut is the way to go though.
SDL, while not just a window handler, will make it easier to use OpenGL than raw Win32 code. However, my experience with Qt, GTK and wxWidgets has not been too bad... certainly not that much better than Win32, its probably a matter of taste in those cases.
I'd recommend avoiding widgets and wrappers like GLUT if you want a fine level of control over the window and resources, but if you are just looking for speed of development then these tools are ideal.