Jump to content

  • Log In with Google      Sign In   
  • Create Account


Shintah

Member Since 15 Dec 2009
Offline Last Active Dec 09 2011 08:36 AM

#4882622 2 GLSL questions

Posted by Shintah on 10 November 2011 - 09:36 AM

Not sure how you set things up or which GL version you use but you need to bind the second set of texture coordinates to an attribute in the shader. Then you can pass it from the vertex shader in gl_TexCoord[1] just like you did with gl_TexCoord[0].

When you have your second set you can choose which one to use when you do your texture lookups.


#4882599 2 GLSL questions

Posted by Shintah on 10 November 2011 - 08:55 AM

If you have two colors, x and y, all mix does is take (1-a)*x + a*y. You can combine colors any way you want and don't have to use the mix function. i.e. x+y, x-y, x*y or whatever gives the result you want.

If you have more colors you just have to calculate how much of each color you want and how you want to combine them and write an expression for it.

To get another set of texture coordinates you just have to create a new VBO with the new set of coordinates and bind it while drawing just like you did with the first set. Or pack another set into your vertex structure in the VBO you already have. Depending on which way you do things.

Hope this helps.
Cheers.


#4855797 C++ int beyond 2,147,483,647?

Posted by Shintah on 31 August 2011 - 02:43 AM

If you want arbitrarily big numbers you can use a library like https://mattmccutchen.net/bigint/


#4853594 Trying to get rid of all the deprecated stuff

Posted by Shintah on 25 August 2011 - 06:06 AM

Just took a quick glance at the code but one thing I saw is that you don't enable the vertex attribs with glEnableVertexAttribArray.


PARTNERS