Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 29

Thread: Nice looking lines [OpenGL]

  1. #11

    Nice looking lines [OpenGL]

    Like this site said:
    http://www.allegro.cc/forums/thread/592220
    It looks like this http://i35.tinypic.com/1zcfleb.png

    And a quad with texture (also shown in next screenshot only scaled up from 4x4 used in test). This line does also scale well and remain smooth, as it is loaded with GL_LINEAR filter.
    Looks like http://i38.tinypic.com/fjoler.png

  2. #12

    Nice looking lines [OpenGL]

    thanks
    From brazil (:

    Pascal pownz!

  3. #13

    Nice looking lines [OpenGL]

    i'm having some problems here,

    zoomed texture, the original is 4x4px



    and how it looks when i draw stretched


    filters used:
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    From brazil (:

    Pascal pownz!

  4. #14

    Nice looking lines [OpenGL]

    And where is your Problem?

    It does what it says - it filters GL_LINEAR. Means in this case a
    smooth line from black to white to black.

    If you want a hard cut you should use GL_NEAREST.

  5. #15

    Nice looking lines [OpenGL]

    Quote Originally Posted by waran
    And where is your Problem?

    It does what it says - it filters GL_LINEAR. Means in this case a
    smooth line from black to white to black.

    If you want a hard cut you should use GL_NEAREST.
    look the results of user137, and he used GL_LINEAR



    GL_NEAREST really solved the problem
    From brazil (:

    Pascal pownz!

  6. #16

    Nice looking lines [OpenGL]

    Try clamp_to_edge or clamp as wrap mode
    Peregrinus, expectavi pedes meos in cymbalis
    Nullus norvegicorum sole urinat

  7. #17

    Nice looking lines [OpenGL]

    If you use GL_NEAREST you lose all the details from the texture itself and effects you can achieve with it.

    It's in your texture coordinates. I didn't use full area of the texture but a slice through the middle, that way the end points don't go as smooth. To make end points smooth requires quads also to the end points.

    This would be the exact same to use a 1 dimensional texture 4x1 0,255,255,0 but my engine isn't supporting them yet.

    This is the exact code used, not very optimal but works...:
    [pascal]glLoadIdentity;
    glTranslatef(0,0,-5);
    glSetTex(dotTex);
    glTranslatef(-2,-1,0);
    glRotatef(angle(-2,-1,2,1),0,0,1);
    d:=hypot(4,2);
    glScalef(d,d,1);
    d:=0.01;
    glBegin(GL_QUADS);
    glColor3f(1,0.5,0.2);
    glTexCoord2f(0.0,0.5); glVertex2f(0, d);
    glTexCoord2f(1.0,0.5); glVertex2f(0, -d);
    glTexCoord2f(1.0,0.5); glVertex2f(1, -d);
    glTexCoord2f(0.0,0.5); glVertex2f(1, d);
    glEnd;[/pascal]

    When i render that with d:=0.1 i get these (added together with msPaint):

  8. #18

    Nice looking lines [OpenGL]

    i'm trying something more simple (not rotated), but i could not get that "gradient effect" on the sides of the line

    [pascal] glBegin(GL_QUADS);
    glTexCoord2f(0.0, 0.5); glVertex2f(100, 4);
    glTexCoord2f(1.0, 0.5); glVertex2f(300, 4);
    glTexCoord2f(1.0, 0.5); glVertex2f(300, 14);
    glTexCoord2f(0.0, 0.5); glVertex2f(100, 14);
    glEnd();[/pascal]
    From brazil (:

    Pascal pownz!

  9. #19

    Nice looking lines [OpenGL]

    Maybe this?
    [pascal] glBegin(GL_QUADS);
    glTexCoord2f(0.0, 0.5); glVertex2f(100, 14);
    glTexCoord2f(1.0, 0.5); glVertex2f(100, 4);
    glTexCoord2f(1.0, 0.5); glVertex2f(300, 4);
    glTexCoord2f(0.0, 0.5); glVertex2f(300, 14);
    glEnd();[/pascal]

  10. #20

    Nice looking lines [OpenGL]

    Quote Originally Posted by User137
    Maybe this?
    [pascal] glBegin(GL_QUADS);
    glTexCoord2f(0.0, 0.5); glVertex2f(100, 14);
    glTexCoord2f(1.0, 0.5); glVertex2f(100, 4);
    glTexCoord2f(1.0, 0.5); glVertex2f(300, 4);
    glTexCoord2f(0.0, 0.5); glVertex2f(300, 14);
    glEnd();[/pascal]
    same :\

    zoomed texture, the original is 4x4px


    mag and min filters set to GL_LINEAR
    From brazil (:

    Pascal pownz!

Page 2 of 3 FirstFirst 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •