[Qt-interest] QGLWidget+glRasterPosi Problem

Oliver.Knoll at comit.ch Oliver.Knoll at comit.ch
Mon Nov 16 14:25:38 CET 2009


Rosália G. Schneider wrote on Monday, November 16, 2009 10:03 AM:

> ...
> fine. I checked my CL_CURRENT_RASTER_POSITION and it is (0,0,0,1),
> wheter I use glRasterPosi(0, 0) or not.

That is correct! The last '1' you are seeing is an additional vector component, such that "the homogeneous vertex (x, y, z, w)T corresponds to the three-dimensional point (x/w, y/w, z/w)T", see "Homogeneous Coordinates", e.g. http://glprogramming.com/red/appendixf.html#name1
  
OpenGL uses (and reports) these homogenous coordinates. If you don't specify all of them (as in glRasterPosi(x, y)) z defaults to 0 and w to 1.

> Anyone had a similar issue, or a similar situation where this problem
> didn't occur? 

I can confirm that using glRasterPosi works, I used it in some toy application, as to draw a 2D background bitmap. That was with Qt 3 though, but I would not see any reason why that would not work with the latest Qt 4.

So I suspect you are seeing the infamous "black cube in a black room with no light while looking into the opposite direction"-phenomenon. So check the usual suspects:

- Do you really (re-)paint in the paintGL() method?
- Do you properly setup the view-matrix in initializeGL() AND...
- Do you properly UPDATE the view-matrix in the resizeGL() method?
- Do you properly initialize/update the model-matrix? Viewport? Etc.

Also refer to

  http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=13 

or (simpler):

  http://www.opengl.org.ru/docs/pg/0801.html

These are all OpenGL related questions, so unless you have a specific (off-topic!) questions I won't go any further here.

Cheers, Oliver
-- 
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22



More information about the Qt-interest-old mailing list