Qt and OpenGL Primitives in mobile resolution
I'm new to OpenGL in Qt..
and I've been trying to draw points in screen corners... I'm using Nokia 900 simulator
by default the co-ordinate range in openGL is
X: -1 to 1
Y: -1 to 1
But here in mobile resolution it changes and couldn't predict the change ratio....
how to solve this...?
I've set the ViewPort width and height to 360 and 640.
Please post some compilable code that reproduces your problem.
This is the OpenGL code..
GamePlay::GamePlay(QWidget *parent) :
setFormat(QGLFormat(QGL::DoubleBuffer | QGL::DepthBuffer));
rotationX = -21.0;
rotationY = -57.0;
rotationZ = 0.0;
faceColors = Qt::red;
faceColors = Qt::green;
faceColors = Qt::blue;
faceColors = Qt::yellow;
void GamePlay::resizeGL(int width,int height)
GLfloat x = GLfloat(width) / height;
glFrustum(-x, x, -1, 1, 2.0, 15); glMatrixMode(GL_MODELVIEW);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glTranslatef(0.0, 0, -10);
glPointSize(4.0); glBegin(GL_POINTS); glVertex3f(0,0,0); glEnd();
The draw function should draw a point of size 4 at the center of the screen.... right?
I does draw a point but not in the Center of the screen(orgin).
Please try setting projection matrix with gluPerspective.
No... I have tried that too... same effect...
Is this because of the simulator banner added by the QT in the output in simulator?
What were the parameters for gluPerspective?