Can I change glui panel background colour? - c++

I am using glui to add a control panel to my OpenGl code. This is a visualisation interface for a large scale simulation platform written in C++.
I was wondering if it is possible to make changes to the background colours of the panels?
If this is not possible, can anyone comment on how slower my display will become if I switch to using pyQt with OpenGL? And would it be possible to access information on my C++ classes and display them with a pyQt approach? (I am happy to make this a second thread if you think it is better that way.)

For background color change of glui-based panel, its not clear what you are asking but I don't see why it would not support such a basic op. Update: I would try using glClearColor like on that link.
For speed it really depends on what and how you're going to use opengl: see pyopengl: Could it replace c++? for a good discussion.
For using your c++ from python this is usually relatively easy by using SWIG (swig.org). You tell SWIG what parts of your c++ api you want to access from python and SWIG generates the code to make your c++ available as a python module.

Related

Simple library to display 2D images in C++ on Linux

I would like to have a tool to debug 2D planar meshes. I would like to be able to display them and debug to be able to debug certain things.
Is there a widget (for any toolkit on Linux - QT, GTK+Cairo, ...) which would display the images, scroll them and zoom it. Is there any widget which would handle it (without need to implement zooming, scrolling etc. by hand)?
Side requirements:
Needs to work on CentOS 6
I need it for C++. Unfortunately changing the build system in my situation is harder then it sounds.
The Qt Graphics View is certainly a useful tool, it gives you scrolling, zooming, rotating easily. You probably want to learn the basics of Qt before. (and Qt is in C++).
Here's an off the wall suggestion.
This would be fairly easy to implement in a web browser. Web browser engines already have the base functionality for resizing and scrolling over images. You may need a little JavaScript to bind it together, of course.
So why not use WebKit? There are bindings for many of the leading toolkits (e.g. QWebView for Qt), so you could take your pick of which one you're most comfortable with.
Yes, it's overkill. But it's code you don't have to write, and time is money.

Qt library for 2D/3D game development

As a hobby, I've been working on remaking an old video game, and I want to avoid reinventing the wheel where possible. The game is heavily GUI-based, but the GUI needs to be customized in terms of look-and-feel, and also needs to work with 3D OpenGL rendering for a few game screens.
To give you an idea, here's a screenshot from the initial prototype:
There's a lot of animation used, and 3D also, but the GUI widgets behave much the same as in a standard desktop application.
Thus far, I've been using my own GUI library (it's not robust or complete, and I've been running into some problems).
I've been considering migrating to Qt given it's reputation and impressive features, and some of the nice screenshots on the Qt website. But I've never used Qt before, so I don't really have an idea of what it's capable of, or what kind of time investment would be required to learn it. (Note I've used FLTK).
My question is: would it be possible / practical to use Qt in this situation?
UPDATE: After mocking up some game screens in Qt, I've decided not to use it. While it supports many of the features I need out-of-the-box (particularly through Style Sheets), I need to support custom bitmap-based pre-rendered fonts (I can't convert/replace them). And I can't subclass QFont, or reimplement it without it breaking in future Qt releases. That said, I was extremely impressed with Qt (both in its ease of use, and good documentation). I will be borrowing some of its features for my own engine. Thank you to all who provided input.
It's hard to know everything your game needs to do based on a screenshot; however, I will echo the sentiments of other posters here and provide a couple of avenues for you to look at.
One, is that you might want to consider QtQuick over the GraphicsView Framework, but this REALLY depends on what you need to do. I just want to throw it out there as an alternative so you don't miss it. This tutorial uses QtQuick to put together a really slick looking connect four style game. This may be more simplistic than what you want to go for, but then again, maybe it isn't, it depends on what you need to do.
Second, before writing custom paint events for all of your buttons, I would consider using Qt Style Sheets and style your widgets in a CSS like syntax. This will allow you to change the look and feel of your GUI in a very flexible way really quickly. Based on your screenshot, I think you can get what you want out of style sheets much faster than subclassing and rolling your own setup. But once again, it's hard to know based on one screenshot. Here's an example of a dark and orange GUI that was implemented using only Qt Style Sheets. The border-radius property of QPushButton's style sheet would give you the rounded buttons (ref).
The simple answer has been given above but to throw some more thoughts in: yes it's possible, you probably won't need to fight against Qt too much. For the most part the recommended advice for going to heavily customised widgets like that is subclass and implemented the paint event yourself.
You can then use a load of basic drawing primitives to get the basic shapes for the elements and expand from there. There's actually a couple of questions on here with really good resources about how to do it.

What type of a tool should I use to make a simple simulator in C or C++

I'm a Rails/web developer with little experience with C++, so I'm not totally sure what direction to head in: I'm looking to build a simple simulator that I can use to test an algorithm I'm building that converts standard images to radial coordinates, and all I really need to be able to do is to plot points (which will represent LEDs) on a blank window and continuously refresh them (the LEDs blink). I don't want to build a gui; command line is fine, as I'll be the only person using the tool.
I'm not sure whether this is even possible or not... I did some Java programming years ago and I remember being able to pretty easily open a window and render images in it. Is there a C++ equivalent?
Thanks in advance!
What you are describing is a perfect fit for a GUI application, rather than command line, as far as I understand.
But if you want something really simple, and not spend some time learning a GUI development framework (MFC, Qt, WxWidgets, etc), you should check the following resources:
character based basic console graphics
some more advanced console graphics with blinking, box drawing, etc.
using full GDI graphics on console
It's not that easy in C++, because there is no standard way in doing this. It's not part of the language. There are a lot of frameworks though, some lightweight and some bloating. It also depends your platform. Anyhow, I think I would use OpenGL and do that calculation thing in a shader. That way you don't have to recompile and rerun all the C++ code. You can even do it in way that updates the GPU shader whenever you save your shader file giving you immediate results.

Can gnuplot draw interactive graph items?

I always assumed gnuplot just produced static jpeg (or whatever) images. Recently I downloaded and compiled this package which demonstrated that gnuplot also (at a minimum) is capable of zooming and rotating images.
My question (1) is whether it can also interactively draw lines (sorry if that is not the correct terminology) and such. For instance, if I have generated a sales or stock graph, is gnuplot capable of using the mouse to draw a trend line or similiar? (2) If it is capable of this, is it then possible to save the altered graph? (3) Can gnuplot graphs be easily incorporated into a QT GUI application?
Thanks much for any answers and references or examples.
Gnuplot 4.6 includes Qt support. There is example code in the distribution package that show how to embed the output into a simple Qt application.
It is capable of doing some of the things you described (although it may take some creativity/reliance on external programs, etc...). See the help for mouse and more importantly bind, help mouse variables, etc. And finally, embedding in a QT application is probably the most difficult ... (although I am not completely familiar with the QT framework). I'm not entirely sure that one is possible.
Sorry to get to your question so late, but I though I would answer in case someone else wants to do something similar.

Displaying an OpenGL area within GTK#

I am developing a Mono/GTK# application. I need to have a "visualizer" that will display an opengl drawn area within the GTK# form. The two projects I have found myself don't seem to be maintained anymore,
http://sourceforge.net/projects/gtkglext/
and
http://sourceforge.net/projects/glwidget/
Do you know of any other projects that allow an OpenGL area within GTKSharp?
Alternatively, is there a better way to have an application use both opengl and GTKSharp?
I've never tried to use the GTK# integration, but OpenTK is by far the best OpenGL C# bindings I have ever used in C#. I highly recommend you look into it, and give the GTK# widget a shot.
I agree with Robert. I've been using OpenTK for a while and haven't had any major snags with it. Because of this, I would recommend glwidget.