glLineWith problem

Hi everybody,
I work on a 3D software modelisation and using opengl for renderer.
All our code are based on Opengl 3.3 Core profile and running on Win7 64 bits / NVIDIA GTX 580.
My problem is :

Before this :
glDrawElements(GL_LINE_LOOP, …)

When this is present:
glLineWith(3.0f),

GL_INVALID_VALUE is generated and line width don’t change.
The Specification said :

Values less than or equal to 0.0 generate
the error INVALID_VALUE.

This is the only way GL_INVALID_VALUE is generated from glLineWith and you can see easily that 3.0 > 0.0.

Maybe I miss something…please tell me…

Any help will be more than welcome.

Best Regards,
Nas

opengl 3 only supports line widths of 1
god only knows why, maybe they thought since driver manufacturers have been having lines thicker than one since the early 90’s it must suddenly now be too hard to implement now hardware has got so fast.

opengl 3 only supports line widths of 1

Wrong. Line widths other than 1.0 are deprecated but not removed from core. The deprecated functionality can be removed by creating a forward-compatible context, but that’s about it.

why would they depreciate that ? It’s been a core feature of opengl since time began.

Many core features have been deprecated, even those from GL 1.0. Think about immediate mode (glBegin…).

A while ago I experimented with a wide line shader which is compatible with Core OpenGL 3.3: http://neure.ath.cx/wideline.html

Edit - Looks like I do not mention this anywhere on those pages: It works best with multisample and alpha to coverage, to smooth away any annoying extra corners.

Or you could just stop using the “forward compatibility” bit and just use wide lines. This isn’t a hard problem to solve here.

Thanks all for your reply

Or you could just stop using the “forward compatibility” bit and just use wide lines. This isn’t a hard problem to solve here.

I don’t manage directly opengl context but with QGLWidget and QGLContext (QT).
But I think it’s possible with specific platform settings.

At another side I don’t want to use any deprecated feature.
But I don’t understand why setting wide lines are deprecated; this make no sense for me because opengl will lack for flexibility.

I don’t manage directly opengl context but with QGLWidget and QGLContext (QT).

Then I’d suggest using a tool that doesn’t shove the forward compatibility bit into core context creation. They’re not the same thing, and there’s no reason for QGLContext to do that.

At another side I don’t want to use any deprecated feature.

Why? What does it matter? It’s still part of core, and it’s been deprecated for 5 OpenGL versions without being removed. I think it’s a pretty safe bet that it’s not going anywhere.

The issue with lines is that GPUs support thin lines (1 pixel only). Direct3D supports exactly that because that is what the hw is capable of. Thick lines are probably just emulated by GL. Direct3D handles that with the D3DX function (D3DXOpenGLLines or something like that).

Pro cards supported true lines like the Quadro cards.

I don’t know what the case is with today.

But basically, OpenGL is a graphics API while Direct3D is a hardware abstraction layer for the “common user’s graphics card”.

Also remember that you are not supposed to ship applications with forward compatible enabled. It’s only meant for testing during development. You can only lose if you leave forward compatible on in final product.

Line widths other than 1 are not guaranteed to be hardware accelerated, and if it ain’t hardware accelerated it doesn’t matter how long it’s been in the API, it will drop you back to some kind of software emulation.

well that is the theory anyway, but when have have you ever come across a card that hasn’t supported in hardware line widths of more than 1?