Results 1 to 3 of 3

Thread: 2d opengl line not the same size after mirroring

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2009
    Posts
    3

    2d opengl line not the same size after mirroring

    hallo together,

    i am a bit new to opengl. i am working with opengl via the openframeworks toolkit. i have a question about drawing a line and then mirroring it and draw it again. my problem is that this line dont looks the same when i draw it mirrored. the best would be if you look to the atached pic below (it is a 500% zoomed screenshot of my 1 pixel line):



    here are some code snippets which i tried:
    Code :
    void testApp::draw(){
     
        ofPushMatrix();
        ofTranslate(1024/2+60,768/2);
     
        glBegin(GL_LINES);
            glVertex2f(30,0);
            glVertex2f(35.0,5.0);
        glEnd();
        glBegin(GL_LINES);
            glVertex2f(35.0,5.0);
            glVertex2f(35.0,19.0);
        glEnd();
        glBegin(GL_LINES);
            glVertex2f(35.0,19.0);
            glVertex2f(34.0,20.0);
        glEnd();
        glBegin(GL_LINES);
            glVertex2f(20,0);
            glVertex2f(15.0,5.0);
        glEnd();
        glBegin(GL_LINES);
            glVertex2f(15.0,5.0);
            glVertex2f(15.0,19.0);
        glEnd();
        glBegin(GL_LINES);
            glVertex2f(15.0,19.0);
            glVertex2f(16.0,20.0);
        glEnd();
        ofPopMatrix();
     
        ofPushMatrix();
        ofTranslate(1024/2+30,768/2);
     
        glBegin(GL_LINE_STRIP);
            glVertex2f(30,0);
            glVertex2f(35.0,5.0);
            glVertex2f(35.0,19.0);
            glVertex2f(34.0,20.0);
        glEnd();
        glBegin(GL_LINE_STRIP);
            glVertex2f(20,0);
            glVertex2f(15.0,5.0);
            glVertex2f(15.0,19.0);
            glVertex2f(16.0,20.0);
        glEnd();
        ofPopMatrix();
     
        ofPushMatrix();
        ofTranslate(1024/2,768/2);
     
        for(int j=0;j<2;j++){
            glBegin(GL_LINE_STRIP);
            glVertex2f(0,0);
            glVertex2f(5.0,5.0);
            glVertex2f(5.0,19.0);
            glVertex2f(4.0,20.0);
            glEnd();
     
            ofRotateZ(180);
            ofRotateX(180);
            ofTranslate(10,0);
        }
     
        ofPopMatrix();
     
        ofPushMatrix();
        ofTranslate(1024/2+30,768/2);
     
        for(int j=0;j<2;j++){
            glBegin(GL_LINE_STRIP);
            glVertex2f(0,0);
            glVertex2f(5.0,5.0);
            glVertex2f(5.0,19.0);
            glVertex2f(4.0,20.0);
            glEnd();
     
            glScalef(-1, 1, 1);
            ofTranslate(10,0);
        }
        ofPopMatrix();
    }

    all the snippets failed.
    so i think you see what my problem is.
    my question now is: is it be posibble to draw the line that it exactly looks the same like the first one? or is this not possible cause of antialiasing and other issues?

  2. #2
    Junior Member Newbie
    Join Date
    Dec 2009
    Posts
    3

    Re: 2d opengl line not the same size after mirroring

    hallo people,

    hope you all had a nice christmas.
    i had some time during the xmas days so i tried again to fix my problem but without success. are there any german speaking people around here so that i can write down my problem in german language maybe then i can better describe my problem.
    i searched around on many different pages but the only solutions which come near my problem was that it maybe has something todo with the size of the opengl window and a distortion trough the window size. changing my opengl window has also no success. anny ideas what is going wrong. anyone also working with 1px thin lines?

  3. #3
    Junior Member Newbie
    Join Date
    Dec 2009
    Posts
    3

    Re: 2d opengl line not the same size after mirroring

    hey guys, i got it,

    found it here:
    http://www.gamedev.net/community/for...opic_id=556634

    a line is not a line, it is a rect. so i positioned it not on 0 but rather on 0.5 and the problem is away.

Similar Threads

  1. draw line, line-size ... opengl 3.3 ?
    By CarstenT in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 03-28-2014, 08:19 AM
  2. Mirroring the framebuffer
    By brinck in forum OpenGL: Advanced Coding
    Replies: 11
    Last Post: 06-12-2007, 06:00 AM
  3. Mirroring an image
    By mk in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 12-31-2004, 10:00 AM
  4. mirroring surfaces
    By JanHH in forum OpenGL: Advanced Coding
    Replies: 16
    Last Post: 06-16-2004, 08:33 AM
  5. Change line size
    By amstel in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 03-18-2002, 11:49 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