QGraphicsView / QT Discussion


Yannick

Member
Joined
Sep 4, 2008
Messages
345
Age
39
Location
West-Vlaanderen, Belgium
why QGraphicsView? I am really good in Qt, so I find it really interesting, what you are planning ;)


It's the most powerfull OpenGl powered 2D engine that exists!


Choose one of the simpler indexing and collision algorithms and the performance is phenomenal.


Or disable the collision detection and use something else, like Box2D


Don't forget the signals/slots and runtime type information for your gameobjects.


Qt 4.7 has QML, that wil be perfect to load level data: builtin databinding for gameobjects and a javascript engine te script game events :D


EDIT Qt 4.8 should bring a 2.5D engine with QML/3D


I really can't be bothered to type out all the boring C++ needed to go the SDL route


I tried that on my PSP, it sucked.


(i sold the thing because i needed money for my pandora that i would have by christmas :angry: (lol))
 
Last edited by a moderator:
but it looks like something might happen based on Qt4 QGraphicsView and the pandora

Because of the Pandora, I played around with Qt a bit as well. Looks good as well, although one of the drawbacks is (I think) you cannot develop on the Pandora (you can do for, but not on). That's why I went for SDL and also for its performance, at least that that is what I read on the forums.


I have never heard of QGraphicsView, if some of you haven't either, you should check this short article: http://fredyduarte.net/blog/?p=7 If I see the code, it all looks very simple, compared to C++ with SLD :)


Right now I don't know what to choose (again), started with PyGame, going to SDL and now I see QGraphicsView. There are so many ways to get there, so many options, so any advice is welcome :)
 
I am shure, QTCreator will compile just fine for the pandora.


How usable it is on 800x480 that's the real question.


1024x600 (netboook) is already verry tight, and makes the debugging view hard to work with.


On 800x480 you prolly going to have to do with only the edit window because the design window will be unuasable i think


besides you don't *need* to code *on* the pandora, develop in linux (xubuntu uses the same desktop as the pandora), force all your windows to size 800x480, and there you have full compatibelity with your panodra in QT


pyGame is verry good as well, and you get every advantage of a scriting language (mainly, no compile times)


i just don't feel like learning a non C-derived language
 
I'm worried about QGraphicsView's use of floating-point math, though, so for the thing I'm working on, I went with a custom QWidget and 'scene graph' that works in fixed-point and paints in integer pixels.


If it still turns out to be slow on the Pandora, I can probably just replace the widget with custom OpenGL ES code.
 
Last edited by a moderator:
Well, you don't need Qt creator to code Qt. Just use your preferred editor :)

Right. When I started, Qt creator wasn't around, so I had to find other editors. Gedit and NP++ ftw's. But I mostly use geany now <_<
 
I'm worried about QGraphicsView's use of floating-point math, though, so for the thing I'm working on, I went with a custom QWidget and 'scene graph' that works in fixed-point and paints in integer pixels.


If it still turns out to be slow on the Pandora, I can probably just replace the widget with custom OpenGL ES code.

All the Qt demo's run fine on my nokia 5230, that's just a cheap arm11 based S60v5 phone (except slow micro sd loading)


A fresh boot of that phone reports 38MB free memory, 434Mhz cpu, god knows what kind of video chip.


there's some cool N900 based QT stuff on gitorious.org, so i have high hopes for the pandora
 
I was kinda pushed into using Qt thanks to a uni assignment, done on a shared server on campus over SSH. We managed just fine using vim and qmake :p
 
<blasphemy>


IF i could run MS visual studio with a commercial refactoring plug-in on Linux i would!


</blasphemy>


I like QT Creator, It does what it should, doesn't get in the way, isn't overly complicated.


I intend to build natively on the pandora with Qmake/bash-script but typing out code needs a system with more screen real estate => my trusty xubuntu laptop !
 
I somewhat learned the basics of Qt; do you think QGraphicsView is suitable for a 2D game ? Easy to use ?


if yes : do you have tutorials ?
 
I somewhat learned the basics of Qt; do you think QGraphicsView is suitable for a 2D game ? Easy to use ?


if yes : do you have tutorials ?

Make shure you know the Colliding mice example by heart


Super mini tutorial:


Every gameobject should be a subclass of QGraphicsItem (or QGraphicsObject if you need signals/slots)


A Level would be a subclass of QGraphicsScene


interaction (mouseclicks, keyboard) are handled in a subclass of QGraphicsView


That would be a real good start for a game


EDITED for clarity
 
Last edited by a moderator:
I was kinda pushed into using Qt thanks to a uni assignment, done on a shared server on campus over SSH. We managed just fine using vim and qmake :p
I like vim and qmake! But qmake doesn't seem to be on the Pandora. Do you know where to get it?
 
I somewhat learned the basics of Qt; do you think QGraphicsView is suitable for a 2D game ? Easy to use ?


if yes : do you have tutorials ?

Make shure you know the Colliding mice example by heart


Super mini tutorial:


Every gameobject should be a subclass of QGraphicsItem (or QGraphicsObject if you need signals/slots)


A Level would be a subclass of QGraphicsScene


interaction (mouseclicks, keyboard) are handled in a subclass of QGraphicsView


That would be a real good start for a game


EDITED for clarity
How do I compile the colliding mice thingy? I can't find the cheese image.


EDIT: Nevermind, I drew one myself.
 
Last edited by a moderator:
WHat is all this Open GL and QT?


I gather they're libraries but I'm already trying to learn SDL....would I benefit by going straight to QT or Open GL?
 
Qt is an application framework. It started out as a GUI toolkit, but has since expanded into a framework that suites many different needs. It provides nice utility classes for most needs and of course the GUI department is top notch, if that's what your application needs. Lately more work has been put into its GraphicsView framework (formerly canvas, IIRC), which makes it simpler to draw custom graphics. GraphicsView, like everything else in Qt pick from several different rendering backends, like software raster or OpenGL. The rendering backend can also be used directly, and not just through Qt's PaintDevice interface, which makes it possible to write direct OpenGL applications using Qt for setting up the context and providing utility classes for easier use. I've only started to learn OpenGL myself, and I use Qt as the base (I must note that I also know how to do these things without Qt, which I consider essential because tying yourself to one framework is never good). If you'd like to take a look, I'm documenting my learning process by making a copy of my code here every time I make progress. I'm not very far so far though. Note that I still use SDL for timing, as I found out doing wars: commando that Qt timers are not always that accurate on all platforms (windows has around 20ms accuracy).


OpenGL on the other hand is an interface to the GPU. It's the most basic form of doing hardware accelerated graphics besides going straight past the driver to the metal (which you pretty much can't do as the driver is closed). Basically you can, for example, upload an image, upload vertices of a rectangle (or quad, as it's called in the lingo), and ask for the GPU to draw your image to that rectangle. Or you could upload a 3D model (in its most basic form, a collection of vertices, texture coordinates, normal vectors... etc) and have the GPU draw that for you from a specific point of view.


Usually a good cross-platform choice with HW acceleration is SDL+OpenGL. I just love Qt so I use it for everything :D
 
Last edited by a moderator:
Qt is an application framework. It started out as a GUI toolkit, but has since expanded into a framework that suites many different needs. It provides nice utility classes for most needs and of course the GUI department is top notch, if that's what your application needs. Lately more work has been put into its GraphicsView framework (formerly canvas, IIRC), which makes it simpler to draw custom graphics. GraphicsView, like everything else in Qt pick from several different rendering backends, like software raster or OpenGL. The rendering backend can also be used directly, and not just through Qt's PaintDevice interface, which makes it possible to write direct OpenGL applications using Qt for setting up the context and providing utility classes for easier use. I've only started to learn OpenGL myself, and I use Qt as the base (I must note that I also know how to do these things without Qt, which I consider essential because tying yourself to one framework is never good). If you'd like to take a look, I'm documenting my learning process by making a copy of my code here every time I make progress. I'm not very far so far though. Note that I still use SDL for timing, as I found out doing wars: commando that Qt timers are not always that accurate on all platforms (windows has around 20ms accuracy).


OpenGL on the other hand is an interface to the GPU. It's the most basic form of doing hardware accelerated graphics besides going straight past the driver to the metal (which you pretty much can't do as the driver is closed). Basically you can, for example, upload an image, upload vertices of a rectangle (or quad, as it's called in the lingo), and ask for the GPU to draw your image to that rectangle. Or you could upload a 3D model (in its most basic form, a collection of vertices, texture coordinates, normal vectors... etc) and have the GPU draw that for you from a specific point of view.


Usually a good cross-platform choice with HW acceleration is SDL+OpenGL. I just love Qt so I use it for everything :D
That's a good summary of QT. I personally use SDL + OpenGL on my projects but it has lots of problems, not least that all of your GUI code has to be custom.


My problem at the moment is that I'm using far too many libraries on my projects (SDL, boost, GLEW, Guichan) which I'd ideally like to replace with one thing. I think QT does most of things I need so I'll give it a go at some point.


Is there support for vertex and fragment shaders in QT?
 
Back
Top