Search code examples
qtopengl-es-2.0maemon900

Qt + OpenGL ES + N900


I am trying to develop a simple (?) application for N900 using Qt, but I don't even know when to start. I want to tap anywhere in the screen, keep that position, render an object through OpenGL ES there and then be able to pick it and modify its appearance. So, my questions:

  1. From what I've read N900 doesn't support touch events. Nevertheless, the touch examples that exist in QtSDK (almost) worked for me. Should I go for QGesture then or maybe with QtMouse for the tapping (or QTouchEvent)?
  2. Supposing I have the tapped position coordinates, I should later transform them from screen coordinates to object coordinates, if I understand correctly, right?
  3. For the 'picking object' part, does OpenGL ES 2.0 support the select buffer? Or otherwise, how could that be implemented (ray tracing) ?

Any hint to get me started would be very appreciated!!!


Solution

    1. QTouchEvent is exactly what is not supported on N900. You should use QMouseEvent, which are delivered to QWidget or QGraphicsSceneMouseEvent, which are delivered to QGraphicsScene.
    2. QMouseEvent contains both globalPos() and pos(), so you normally don't need to do a conversion. But there are QWidget::mapToGlobal() and friends allowing these conversions. QGraphicsView has mapFromScene and mapToScene for the same purpose.