PDA

View Full Version : Zooming Vertexes



Veric
11-13-2009, 05:16 PM
Hi,
I don't know why this doesn't make a bigger vertexes - leaving them in size 1. I musn't use glPointSize(). I would like to achieve a zooming view of this 2 vertexes.

int main(int argc,char**argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_RGBA | GLUT_SINGLE);
glutInitWindowSize(800,600);
glutCreateWindow("2 POINTS");
glutDisplayFunc(display);
glutMainLoop();
}
void display()
{
glMatrixMode(GL_MODELVIEW);
glClearColor(0.0f,0.0f,0.0f,0.0f);
glClear(GL_COLOR_BUFFER_BIT);

glColor3f(0.0f,1.0f,0.0f);
glBegin(GL_POINTS);
glVertex2f(10,20);
glVertex2f(12,20);
glEnd();

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glViewport (0, 0, 800,600 );
gluOrtho2D(9, 13, 19, 21);
glFinish();
}
I would appreciate any help.

Thanks

AdrianPi
11-13-2009, 08:18 PM
What is the intent of setting the projection after issuing vertices?

kowal
11-14-2009, 04:47 PM
Hi,

Setup projection and modelview matrices in separate function,
(call glutReshapeFunc to 'connect' it to glut).

Adjusting size of points is not possible without glPointSize() or shader which sets point size.
You can use perspective projection and draw small disks or spheres instead of points.

/*Edit:*/ Ouch, I didn't get the point of setting this weird Orthographic projection in your 'display' func.
Zooming in this way doesn't work with points and lines. Either draw them to FBO and stretch texture (poor quality), or draw polygons as I suggested earlier.