Results 1 to 2 of 2

Thread: vector multiplication

  1. #1
    Junior Member
    Join Date
    Sep 2007

    vector multiplication


    I saw in some places the following code snippet in the Fragment shader.
    "uniform sampler2D s_tex0;
    varying vec2 v_texCoord;
    varying vec4 v_primaryColor;
    void main()
    gl_FragColor = texture2D(s_tex0, v_texCoord) * v_primaryColor;

    In the main() function, since the build-in function texture2D returns a vec4, is that legal for two vec4s to do a multiplication like that? What's the result of vec4_foo * vec4_bar? A cross multiplication?

    Thanks a lot.


  2. #2
    Junior Member
    Join Date
    Sep 2007

    Re: vector multiplication

    I think I found the answer. In the spec 5.9, it is said " Multiply (*) applied to two vectors yields a component-wise multiply". Thanks for reading.

Similar Threads

  1. Replies: 0
    Last Post: 01-31-2012, 09:29 AM
  2. Replies: 1
    Last Post: 10-01-2009, 05:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean