62
Byomeer
6y

Just wanted to share my latest WebGL experience...

Comments
  • 24
    Gl line width is deprecated, you should use a proper quad mesh.
    Then just stretch it out for the length/width of the line

    Edit: I should also mention quads are not supported so you need to make the quad out of 2 triangles. 😜
  • 7
    @hexc you fkn wot?
  • 8
    This seems to fit perfectly in overall web development and standards. You have to love consistency.
  • 4
    It's old deprecated functionality and for good reason, there's no reason why a modern graphics card would need hardware to draw a thick line when polygon processing is fast enough that you can just use two tris instead.
    Actually, a lot of the more 2D parts of the OpenGL standard are going out of scope, reflecting trends in the graphics hardware industry. When you use OpenGL you're also using a lot of historical baggage, this is one big reason why Vulkan was made.
  • 0
    @hexc @RememberMe Actually i use lines to draw bounding box wire frames so a width of 1px is okay for now... but still.

    I don't think there's a need to erase this handy feature, especially if you have to upload much more vertex data in order to render a quad. For debugging purposes, i want the smallest possible bandwidth - 3 times the data per drawn line is not really a good option.

    Besides that it's a great example for downward compatibility (setting limits to 1 instead of just erasing the function) and a beautifully crafted sentence by some MDN member to describe the deprecation =D
  • 1
    Need more width?
    for(uint16_t i=0;i<WIDTH;i++)
    drawHorizontalLine(x, y+i, length);

    //Same for vertical lines

    (For those who didn't caught it: It's a joke)
  • 1
    @LuxARTS Perfect! Then i force my userbase to buy nVidia's new RTX cards and utilize the higher ray drawing performance by casting 2D rays... That's how raytracing works, isn't it? =D
  • 1
    Because 3D drawing is not the same as 2D. Need more thick line? draw polygons.
  • 0
    @Pogromist welp, that's boolshit. The lines are in the 3D space, too. In the end it's all just passed to the rasterizer, which is obviously a 2D thing. Even triangles are simply mapped into a 2D space and rasterized. They used to have this feature and decided to limit it to 1px thickness. Maybe because nobody used it or to make room for other features - I don't know.
  • 0
    @irene some pixels on a screen, actually =D

    I could also describe a 1px thick line as a rectangle btw. So why offer line drawing in the first place?
Add Comment