   Qt scene and viewport
  Hi guys  I am writting a tank 2d game using Qt, I don't know if you heard of qt or not.I am use the Graphics View Framework, which contains three parts.view scene and scene itemsIntro:Graphics View provides a surface for managing and interacting with a large number of custom-made 2D graphical items, and a view widget for visualizing the items, with support for zooming and rotation.The scene has the following responsibilities:Providing a fast interface for managing a large number of itemsPropagating events to each itemManaging item state, such as selection and focus handlingProviding untransformed rendering functionality; mainly for printingQGraphicsItem supports the following features:Mouse press, move, release and double click events, as well as mouse hover events, wheel events, and context menu events.Keyboard input focus, and key eventsDrag and dropGrouping, both through parent-child relationships, and with QGraphicsItemGroupCollision detectionQGraphicsView provides the view widget, which visualizes the contents of a scene. You can attach several views to the same scene, to provide several viewports into the same data set. The view widget is a scroll area, and provides scroll bars for navigating through large scenes.so simplify it, scene has items, viewport can view part of scene. scene can be unlimited size. Problem, this system is not very fastMy question is that is any equivalent structure in windows world? or different method?   
  What makes you believe that the QGraphicsView is not fast enough for your purposes? Just make sure you use a QGLWidget as viewport to get hardware accelerated graphics rendering. We are also using this QGraphicsView but not only for 2D but 3D graphics and it is as fast as your graphics card can get.To answer the actual question: No there is no such widget in the plain WinAPI nor any other OS API. And that's the beauty of Qt that it already encapsulates such complex widgets for you cross platform ;)   ;  i see u are qt fans.it is slow man,  and it is well known problem.   ;  Well, maybe you shall analyze where you loose your performance once you have a prototype up and running. I can only say that we can output millions of triangles in two items on a graphics view plus an additional heavy weight overlay of 2D elements at interactive framerates. And it is all done through QGraphicsView with embedded QGraphicsProxyWidgets which even embed their own QGraphicsView instance with their own QGLWidget as viewport.So, no. QGraphicsView is not slow when doing 3D and 2D graphics. If you would post some more information what you have done and where it is slow I might be able to help out with more tips how to speed it up.   ;  graphicsView.setBackgroundBrush(QBrush(backGroundC olor));graphicsView.setCacheMode(QGraphicsView::CacheBack ground);graphicsView.setRenderHint(QPainter::Antialiasing) ;graphicsView.setViewportUpdateMode(QGraphicsView:: SmartViewportUpdate);//QGraphicsView::FullViewportUpdate);////BoundingRectViewportUpdate);graphicsView.setDragMode(QGraphicsView::NoDrag);scene.setItemIndexMethod(QGraphicsScene::NoIndex);this is my current settingsthis game is simple, tank move controlled by keyboard. there are some rectangles to be shoot at.the tank is the picture.there are four pictures for up down left and right, they are preloaded."tankUp = new QImage(":/CannonBattle/Resources/tank up.jpg");tankDown= new QImage(":/CannonBattle/Resources/tank down.jpg");tankRight =new QImage(":/CannonBattle/Resources/tank right.jpg");tankLeft = new QImage(":/CannonBattle/Resources/tank left.jpg");"so i did not use any rotation and transformations.all the paint and collision check happened in one timer.the way i make the tank move is to setpos(), then call centeron();is transformation fast than setpos? now i set   QObject::startTimer(30);  tankSpeed=10;it is very blurry, when tank moves, I think maybe its the tankspeed, 10 pixels very 30 millisecond, but if i make it tankSpeed=5, tank is move too slow, if i increase the timer to 10, someone said it wastes cup and no helpi don't know what to do !!!!I just want tank move smoothly. cry;  i have changed tankUp = new QPixmap(":/CannonBattle/Resources/tank up.jpg");  tankDown= new QPixmap(":/CannonBattle/Resources/tank down.jpg");  tankRight =new QPixmap(":/CannonBattle/Resources/tank right.jpg");  tankLeft = new QPixmap(":/CannonBattle/Resources/tank left.jpg");as someone said qimage doesn't make any sense.   ;  - use a QGLWidget as viewport if possible- try out the various cache modes of your items this could lead to significant performance increases- do a detailed timing and locate what makes your app slowA blurred image could have different reasons but I think your problem might be how you move your tank based on timers.   ;Quote:Original post by Waterwalker- use a QGLWidget as viewport if possible.I used painter to paint items, i am still be able to use QGLWidget without change how the items get paint?Quote:- try out the various cache modes of your items this could lead to significant performance increasesi have try lots:tankExplose->setBackGroundColor(backGroundColor);QGraphicsView::SmartViewportUpdate);//QGraphicsView::FullViewportUpdate);////BoundingRectViewportUpdate);Quote:- - do a detailed timing and locate what makes your app slow- what do you mean by this?;  Somewhere in your code you set a viewport for your QGraphicsScene. If you do not do that it might generate a default QWidget for you which is not what you should use when doing graphics. Do it like so upon initialization time:// gv is a pointer to your QGraphicsView with a valid scene attached to itgv->scene ()->setViewport (new QGLWidget());With cache mode I was actually referring to the QGraphicsWidget cache modes. Read the QGraphicsWidget doc about this caching by clicking here. Try out different caches to see if this speeds up your rendering which could very well be.Quote:Original post by dongzheQuote:Original post by Waterwalker- do a detailed timing and locate what makes your app slow- what do you mean by this?I want to say that, if you have the feeling your application is slow, you should do a detailed performance analysis of your app. Use a time and measure the top level calls in your drawBackground implementation or whereever you do your rendering with the graphics view. If it is slow find out what exactly is slow. Then we can start talking about what goes wrong. But just because you feel the app is slow you cannot just blame Qt and its QGraphicsView and immediately start looking for another lib to replace it ;);  thanks// gv is a pointer to your QGraphicsView with a valid scene attached to itgv->scene ()->setViewport (new QGLWidget());in graphicscene, there no setViewport function.so i set up like this:QGLFormat fmt;  fmt.defaultFormat();  fmt.setSampleBuffers(true);  graphicsView.setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));my application exit with code 1 , it will exit immediately, i can't not even see the UI