Thread: Obese OGL Lines???

  1. #1
    Registered User
    Join Date
    Aug 2001
    Location
    Melbourne, Australia
    Posts
    92

    Unhappy Obese OGL Lines???

    Heyo all, I'm having a bit of a strange problem. The following segment of my app:

    PHP Code:
      glDisable(GL_BLEND);

      
    glLineWidth(1.0);
      
    glColor3f(0.00.00.0);

      
    glBegin(GL_LINE_LOOP);
      
    point.m_i NODE_CLEARANCE;
      
    point.m_j NODE_CLEARANCE;
      
    WindowToGlCoords(MakeWindowCoords(point)).glVertex3d();
      
    point.m_i doc.width NODE_CLEARANCE;
      
    WindowToGlCoords(MakeWindowCoords(point)).glVertex3d();
      
    point.m_j doc.height NODE_CLEARANCE;
      
    WindowToGlCoords(MakeWindowCoords(point)).glVertex3d();
      
    point.m_i NODE_CLEARANCE;
      
    WindowToGlCoords(MakeWindowCoords(point)).glVertex3d();
      
    glEnd();

      
    glEnable(GL_BLEND);

      
    // note to those reading this code:
      // WindowToGlCoords basically just inverts the y coord
      // MakeWindowCoords converts the units relative to the
      // origin of the active document to relative to the window
      // point is a variable of type Vector (a 3d vector class
      // I made for my app.
      // The two aforementioned functions take and return vectors
      // the glVertex3d member function of the Vector class
      // calls opengl's glVertex3d function with the coords of the vector
      // In breif: the problem does not lie there, as i've tried using
      // static coords with the same results. 
    ...is drawing lines that are *2* pixels in width. If I increase the line width, the outputted line width increases, if it take it down to (for example) 0.001 it still takes up 2 pixels in the ouput, when logically it should take 1 or none, rite?... My viewport is scaled (and tested at this because I'm drawing other things - chiefly little circles) so that one pixel equals one gl unit, but it also acted in this way when I had the window scaled so the gl units went from -1 to 1 from left to right and bottom to top of my window.

    Another problem that might be related (and thus possibly help diagnose the problem???) is that if blending is enabled while I paint a white rectangle:

    PHP Code:
      glColor3f(1.01.01.0);
      
    glBegin(GL_QUADS);
      
    point.m_i NODE_CLEARANCE;
      
    point.m_j NODE_CLEARANCE;
      
    WindowToGlCoords(MakeWindowCoords(point)).glVertex3d();
      
    point.m_i doc.width NODE_CLEARANCE;
      
    WindowToGlCoords(MakeWindowCoords(point)).glVertex3d();
      
    point.m_j doc.height NODE_CLEARANCE;
      
    WindowToGlCoords(MakeWindowCoords(point)).glVertex3d();
      
    point.m_i NODE_CLEARANCE;
      
    WindowToGlCoords(MakeWindowCoords(point)).glVertex3d();
      
    glEnd(); 
    ...then it displays a very very thin diagonal grey line through my window, which is not visible when I turn off blending.

    Anyone got any ideas on whats going on?

    Thanks,
    Jeff
    psychobrat at gmail

  2. #2
    Registered User
    Join Date
    Aug 2001
    Location
    Melbourne, Australia
    Posts
    92
    I guess it might help if I post a zip of my app so you can see what's happening, its probably some really simple stupid mistake I'm making setting up OpenGL or something - Í've never used it before this project.

    I'm at work on my lunch break atm, but i'll post it when I get home.

    Thanks all,
    Jeff
    psychobrat at gmail

  3. #3
    Registered User
    Join Date
    Aug 2001
    Location
    Melbourne, Australia
    Posts
    92
    Ok, I've zipped (well... "rar"ed actually) my project up and uploaded it to http://members.optushome.com.au/jeff..._pre_alpha.rar

    For those kind enough to look at it, the (msvc++6) workspace should open showing my painting function. The function that initialized opengl is in glfuncs.h.

    Thanks all for your time and any help you can provide!

    -jEFF
    psychobrat at gmail

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 11
    Last Post: 10-07-2008, 06:19 PM
  2. Print out first N lines
    By YoYayYo in forum C Programming
    Replies: 1
    Last Post: 02-21-2008, 12:58 AM
  3. Line Counting
    By 00Sven in forum C Programming
    Replies: 26
    Last Post: 04-02-2006, 08:59 PM
  4. Reading lines from a file
    By blackswan in forum C Programming
    Replies: 9
    Last Post: 04-26-2005, 04:29 PM
  5. count only lines of code...
    By flightsimdude in forum C Programming
    Replies: 13
    Last Post: 09-23-2003, 07:08 PM