Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: glLineWidth gives GL_INVALID_VALUE for widths > 1?

Hybrid View

  1. #1
    Intern Newbie
    Join Date
    Nov 2010
    Posts
    40

    glLineWidth gives GL_INVALID_VALUE for widths > 1?

    Hello,

    On a mac I am getting GL_INVALID_VALUE when I call glLineWidth with any value over 1. Why would I get that? The documentation seems to indicate that widths greater than 1 are supported.

    Thanks
    Bob

  2. #2
    Intern Newbie
    Join Date
    Nov 2012
    Posts
    33
    Hi Bob,

    You say "on a mac"; do you mean you are programming for Mac OS X or simulating your mobile application on a Mac? Based on your previous questions I'm going to guess the latter.

    Given that you seem to be programming in OpenGL ES 2.0, my best guess is that it's your emulator that doesn't like the line width; glLineWidth's valid values depend on the hardware, and only a width of 1.0f is guaranteed to be supported. Try using this code (from here) to find out what is supported on your device/emulator.

    Code :
    GLint range[2];
    glGetIntegerv(GL_ALIASED_LINE_WIDTH_RANGE, range);
    glGetIntegerv(GL_SMOOTH_LINE_WIDTH_RANGE, range);

    As you might guess from the code, the valid range can be different for anti-aliased vs aliased lines. Generally speaking, aliased lines will have a larger valid range. As far as I know, though, most modern devices can handle at least 2.0f width...
    Last edited by Aestivae; 12-18-2012 at 10:50 AM. Reason: Credit where it's due, I suppose

  3. #3
    Intern Newbie
    Join Date
    Nov 2010
    Posts
    40
    actually, this problem is for Mac OS X. And it appears that the range is actually just 1-1. From reading up, it seems like the latest versions of OpenGL are abandoning line-width support. Is that true? Something about future-compatibility.

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,109
    glLineWidth is in the 4.2 core and restriction "Wide lines - LineWidth values greater than 1.0 will generate an INVALID_VALUE error." is listed as depreciated but I am not sure Mac OS supports 4.2.

Posting Permissions

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