Display an image using OpenGL? - c++

I have a button image and I have a project with OpenGL and I have managed to create a window now I want to add an image of a button onto that window.
Is there an easy way to display a .bmp or .png?

"so is there a easy way to display"
According to the following introduction:
http://www.sfml-dev.org/tutorials/2.3/graphics-draw.php
The people at SFML make it seem as though it is not easy to do that with OpenGL. So, if you want it to be easy, use SFML.
"but I dont understand how to use SFML"
The tutorials are very simple to learn, and if a beginner like me can figure it out, then so can you.
http://www.sfml-dev.org/learn.php

Related

Printing string and variables to glwindow

I have been looking to an answer to this for a while now but I can't really find one.
I'm not using glut so please no glut only answer.
What I am trying to do is send variables and text to the in game screen so I can make an UI with a little feedback for the player, like the amount of money they are carrying at that moment. (So not the debug screen)
I'm using c++ with opengl.
If I need to provide anyone with more information, please ask and I will do my best to provide you with it.
Thank you in advance.
If you can live with GL1.x, use the classic reference on bitmap fonts: http://nehe.gamedev.net/tutorial/bitmap_fonts/17002/
If you need something relevant, modify the sample above to use Vertex Arrays / Vertex Buffer Objects and not the glRasterPos functions.
Advanced way is to use the FreeType to render truetype fonts. Here's a sample.

QT Phonon Audio jumping bars

Im only here to ask one question. Well im working in an application, but I would like to create that jumping bars, that jumps with the music. I dont know if you understand me, here is an image of what i want to do:
I dont know how to create that bars, so I dont know if you can help me.
Thank you very much.
With Phonon, how can I handle the frequencies?

Is there a way to customize what a button looks like in C++?

I have programmed in HTML, Java, CSS, C++, VB, an Python.
I'm looking to make button that looks completely the way I want it to look!
Like in HTML+Java+CSS, I can do that very thing!
I'm using Netbeans IDE. I was about to just use OpenGL to do the GUI programming for my programs, since it is so hard to find information on customized GUIs.
I just want to learn how to make the image and give button functionality to it. I want to be able to make the shape, color, and effects (when clicked, hovered over, etc).
Oh, and I program in Ubuntu Linux!
Any help would be appreciated!
Qt is a good idea, but you won't learn how it works, though it's not really important and far easier like that. Using C++ you will have libraries that respect the encapsulation principle, so you won't know at the first sight how do is work, just how to use it.
If you really want to code a button yourself, you can take a 2D drawing library such as SFML, with which you'll draw your button and handle events on it.
When I wrote a custom button class for my app, we (the C++ developers) were given PNG images from the designer department. They are much better with tools like Photoshop then we developers. We just showed image1.PNG by default, image2.PNG when the mouse was over the button ("hover"), and image3.PNG when the mouse was over the button and pressed. Drawing? Not necessary.
Color is trivial for designers. Shape isn't hard either. PNGs are rectangular, but can be transparent. So rounded edges are just a matter of a few transparent pixels there.

QTopengl c++ simple 2d app

Im trying to make a simple 2D application, and our image processing professor has told us to use opengl. Im working with c++ and QT.
I want to open a simple window that holds a place where I can draw points of different colors. All by code, there is no user interaction. I cant use any other library, can anyone tell me how to do this?
check out :
http://www.digitalfanatics.org/projects/qt_tutorial/chapter14.html
2D Painting Example using QGLWidget.
OpenGL is a library to render. You need at least one or two more (at least to create a window).
Since that is a homework, take a look at this example on how to do your assignment.
Qt comes with numerous examples of using QGLWidget.

I have a wxwidgets that I want to add some cool effects. Using GDI would be impossibly hard. Could I use flash or something else?

I have an application that I want add some cool animations to show state changes. However, wxwidgets would be difficult because I'd have to program these animations in straight gdi. What's the best way to add these effect windows? Should I open a flash window and run a flash sequence or is maybe some other technology? Does .net have something I could code into a dll and run from my wxwidgets binary? I need something that is super easy to draw and set up the animation.
It's hard to say what the best approach would be to achieve "cool effects", but in most cases you would want a double-buffered drawing surface. That's what I've used in similar-sounding situations.
In wxWidgets, you would want wxBufferedDC.
You could prepare animation as a bunch of images (wxImage loaded from PNG, GIF, JPG or whatever files), and then use a timer and paint them on a control. Maybe it sounds like too much, you I believe you could do it in 50-70 lines of code.
Perhaps you just could make a single widget that has a custom paint-event that hand-draws the various widgets inside it? Then you could draw them at the appropriate locations/sizes without having to involve wxwidgets at all, it would just be a bunch of line-draw/rectangle-draw/text-draw commands to update the display for each frame of animation.