PDA

View Full Version : glLineWith problem



nashouston
07-19-2011, 02:10 AM
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

dukey
07-19-2011, 03:22 AM
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.

Alfonse Reinheart
07-19-2011, 03:34 AM
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.

dukey
07-19-2011, 03:53 AM
why would they depreciate that ? It's been a core feature of opengl since time began.

_arts_
07-19-2011, 04:04 AM
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...).

tksuoran
07-20-2011, 02:32 AM
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.

Alfonse Reinheart
07-20-2011, 02:44 AM
Or you could just stop using the "forward compatibility" bit and just use wide lines. This isn't a hard problem to solve here.

nashouston
07-20-2011, 05:09 AM
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.

Alfonse Reinheart
07-20-2011, 09:27 AM
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.

V-man
07-20-2011, 09:54 AM
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".

tksuoran
07-20-2011, 10:03 AM
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.

mhagain
07-20-2011, 11:20 AM
why would they depreciate that ? It's been a core feature of opengl since time began.

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.

dukey
07-28-2011, 09:30 AM
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?