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.
Related
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
I am building a c++ maze project for school and want to create a 2d graphics window in c++ that will let me render something like this http://www.dreamincode.net/forums/uploads/monthly_07_2011/post-114496-13104660729008.png.
Can anyone suggest a 2d graphics library to use? I have looked into openGL but am worried that the geometry necessary is too complicated for what I need. Of course I may be overlooking some things.
I am working in Xcode on OS X and if the library is not multiplatform that is okay. Can anyone suggest me something?
The Qt framework is a cross-platform solution for building applications.
There is a basic drawing example that shows how to use basic graphic primitives:
The core of the technique consists in reimplementing a widget's paintEvent() method to control how it is displayed (painted) on the screen. The QPainter class provides many drawing methods to suit your needs.
Since cross-platform is not a problem, just use Quartz or SpriteKit. Quartz is general 2D drawing, SpriteKit is specifically for games. All the docs you can access directly in Xcode through the documentation window, and Apple provides a bunch of sample code too.
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.
Has any of you guys ever tried writing a 2d game in C++ using Qt's QGraphicsScene/QGraphicsView classes for the purpose of rendering and collision detection?
Do they perform well if there are many moving/animated objects on the scene? Are there any caveats? In general, can you point me to any games written using Qt's graphics facilities?
Thanks in advance.
I tried to use them for rendering. They don't perform very well, besides Qt itself is not very adapt for a game: they're a pretty heavy library doing lots of stuff. Their event handling is not lightweight.
If it's a simple game you should be ok; that API is really easy to use and can be set to use OpenGL or software rendering with just a flag. But if you want to write a real game you should opt for something else, something thought for games.
I don't think using qt is an optimal solution any way it can be done even without the graphicsviewframework like this tutorial about creating a breakout game:
http://www.zetcode.com/gui/qt4/breakoutgame/
Anyway my suggestion is to use another library may be sfml or SDL or may be you can try the new polycode engine
http://www.polycode.org
It looks very promising.
I have a problem about a simple mpi program.This program have some 3D points and these points are moving during the program. I created an simple code by implemented c++ and then I tried to add an simple gui. I used gnuplot library and I have a problem. When I call the gui function the gui is created and it is disappeared at the same time. I mean, point object have x,y,z coordinate and I have an array that includes point objects. I want to create them as gui. Can you help me about this problem?
Thanks for any help..
what about Qt? You could use the Qt Graphics View Framework to simulate the 3D-environment - it even supports coordinate transformation (ok, it was originally designed for 2d scope). It supports OpenGL and maybe you are able to simulate the 3D points by drawing dots and setting their positions using simple cosinus and tangens mathematics.
Don't get afraid of the many functions and classes Qt offers - it's very easy and fast to learn - just check out the simple tutorials and after that you right can start your gui!
...and if you are used to Qt, you'll never want to miss it :)
Could it be that the plot is up correctly but that then your program ends? Ie everything's correct, the window goes up, but the next thing that happens is that the program is done, and the window gets destroyed? Try putting in a couple lines that wait for a keypress right after you throw up the window. Then, the window will stay until you press a key (and then the program will end).