WebGL 2: Uniforms (Part 1)

Поделиться
HTML-код
  • Опубликовано: 13 янв 2025

Комментарии • 17

  • @habibosaye
    @habibosaye Год назад

    Learning WebGL1 and this playlist has cleared up so much. It’s almost as if the tutorials out there assume you know the tiny bits. Thank you!

  • @andrejhronco
    @andrejhronco 3 года назад +7

    Excellent series! well thought-out and explained examples.

    • @osakaandrew
      @osakaandrew  3 года назад

      Thank you for your kind comments.

  • @ryanchen1793
    @ryanchen1793 Год назад

    great tutorial on webgl, will you go on to cover webgpu?

  • @whiterook6
    @whiterook6 2 года назад +2

    Do I need to set a uniform's value every time I make a draw call with a program, or only when it changes? If I'm running this on a loop, do I call it before every frame, or every time I use the program, or only when the value changes? Or will the value stay in memory so I can set it once and then never call gl.uniform1f() again for that particular uniform?

    • @osakaandrew
      @osakaandrew  2 года назад +1

      Good question. The uniform values remain in the GPU's memory. They will be cleared only if you *relink* a program (ie if you change your shader source code, recompile and link it). So you only need to set them whenever they change. If you are ever unsure, you can check the value of your uniforms with `gl.getUniform(program, uniformLocation)`

    • @whiterook6
      @whiterook6 2 года назад +2

      @@osakaandrew Thanks! I'm going through your series right now, coincidentally. WebGL2 Fundamentals skips a bunch of things with its demos and tutorials.

  • @smitpatil6576
    @smitpatil6576 Год назад +1

    why point is rectangle and not circle ?

  • @ethernet764
    @ethernet764 Год назад

    The title of this video is "Uniforms (Part 1)". Is there a Part 2? I can't seem to find it, it's also not in the description.

  • @sidekick3rida
    @sidekick3rida 2 года назад

    is `fragColor` a keyword or can it be something like `frag_color`?

    • @ethernet764
      @ethernet764 Год назад

      It's just a variable name, it can be anything.
      out vec4 frag_color;

  • @xu2593
    @xu2593 Год назад +1

    sooo tasty thanks!

  • @Avisit2Mars
    @Avisit2Mars 2 года назад +4

    Can I please buy you coffee?

    • @osakaandrew
      @osakaandrew  2 года назад +8

      Thank you so much for your incredibly kind offer! I'm happy just knowing that people find this series helpful. Please continue to watch and enjoy!

  • @evpozdniakov
    @evpozdniakov Месяц назад +1

    TY very much for you series 👍. You were saying that uniforms are not a great choice ruclips.net/user/clipUgkxu6pz49qvOhXgzR9GH5lE2ER6hoaT7TgO?si=GNbA2fhOu6hRlJ2o
    Can you please explain why? Thanks

    • @osakaandrew
      @osakaandrew  Месяц назад

      You can only change a uniform value before a draw call. So, using uniforms, if you had 100 cubes, and each was one of 10 colors, you'd have to do 10 draw calls, one for each color. But if every vertex had its own colour (or its own colour index maybe into a uniform array of colour values), you would only have to do one draw call.

    • @evpozdniakov
      @evpozdniakov Месяц назад

      ​@@osakaandrew TY. I assume it’s more efficient to draw 100 cubes in a single draw call than to make 10 separate draw calls, each drawing 10 cubes.