Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

glLineWidth works incorrectly #278

Closed
Archer-zty opened this issue Nov 2, 2017 · 4 comments
Closed

glLineWidth works incorrectly #278

Archer-zty opened this issue Nov 2, 2017 · 4 comments

Comments

@Archer-zty
Copy link

@Archer-zty Archer-zty commented Nov 2, 2017

Thanks for the project. I have met a problem.
When I test glLineWidth(9.f) on raw glad+glfw, line width is shown as follows:
1
But the rotating rectangle only occupies 1 piexl in example1.cpp whatever the parameter is.
Any idea?
2

line 600 in example1.cpp, I change the code like this

/* Draw 2 triangles starting at index 0 */
+glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+glLineWidth(9.f);
mShader.drawIndexed(GL_TRIANGLES, 0, 2);
+glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
@svenevs

This comment has been minimized.

Copy link
Collaborator

@svenevs svenevs commented Nov 18, 2017

I don't have a computer whose driver actually supports glLineWidth greater than 1, but as a sanity check -- does glLineWidth even apply to drawing triangles? I truly don't know, I've long since abandoned glLineWidth as it's generally poorly supported / cannot be relied on for consistent results.

If it does apply (as opposed to changing the shader to actually be lines and then mShader.drawIndexed(GL_LINES, 0, /* however many you made */);), it may be that the underlying NanoVG libraries' OpenGL state modification is interfering? Perhaps something gets disabled that you need to re-enable or vice versa?

@wjakob

This comment has been minimized.

Copy link
Owner

@wjakob wjakob commented Nov 18, 2017

Changing line width is actually a legacy feature. AFAIK OpenGL drivers are are allowed to ignore this value, and some of the machines I work with will do so.

@svenevs

This comment has been minimized.

Copy link
Collaborator

@svenevs svenevs commented Dec 2, 2017

When I test glLineWidth(9.f) on raw glad+glfw, line width is shown as follows:

@Archer-zty how exactly did you initialize the context? NanoGUI requests an OpenGL 3.3 forward compatible core profile.

Changing line width is actually a legacy feature

So if you want to go with NanoGUI but keep your linewidth stuff, I believe you cannot request forward compatible or core (meaning use the empty screen constructor, example 3 shows self-managed GLFW). You may also need to request an older profile altogether?

That said, I vaguely recall NanoVG (underlying widget library) not working if you remove those.

@Archer-zty

This comment has been minimized.

Copy link
Author

@Archer-zty Archer-zty commented Jan 16, 2018

@svenevs Thank you for response. I initialize the context with OpenGL 3.3 and even 4.5 but neither works in NanoGUI(However, figure 1 works).

I think I should abandon this function like @wjakob said "Changing line width is actually a legacy feature".

@Archer-zty Archer-zty closed this Oct 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.