Results 1 to 3 of 3

Thread: Zooming Vertexes

  1. #1
    Junior Member Newbie
    Join Date
    Nov 2009
    Posts
    2

    Zooming Vertexes

    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.
    Code :
    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

  2. #2
    Member Contributor
    Join Date
    Jul 2009
    Location
    Buenos Aires
    Posts
    67

    Re: Zooming Vertexes

    What is the intent of setting the projection after issuing vertices?

  3. #3
    Senior Member Regular Contributor
    Join Date
    Aug 2009
    Location
    Poland
    Posts
    111

    Re: Zooming Vertexes

    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.

Similar Threads

  1. How to get vertexes from OpenGL
    By HMD_Dmitry in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 07-07-2012, 07:05 PM
  2. How to sort vertexes?
    By christus in forum OpenGL: General
    Replies: 4
    Last Post: 03-26-2006, 07:32 AM
  3. Different quad with same vertexes...
    By IG in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 01-17-2006, 10:40 AM
  4. Calculating normals with set vertexes?
    By ImpactDNI in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 10-07-2002, 10:15 AM
  5. too many vertexes..
    By in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 04-15-2001, 02:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean