Jump to content

  • Log In with Google      Sign In   
  • Create Account


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

Posts I've Made

In Topic: GLSL and lighting

11 November 2011 - 08:45 AM

You have to calculate lighting in the shaders as well.

In Topic: 2 GLSL questions

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.

In Topic: 2 GLSL questions

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.

In Topic: C++ int beyond 2,147,483,647?

31 August 2011 - 02:43 AM

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

In Topic: Trying to get rid of all the deprecated stuff

25 August 2011 - 08:22 AM

The GLSL spec just says:

Both gl_FragColor and gl_FragData are deprecated; the preferred usage is to explicitly declare these outputs in the fragment
shader using the out storage qualifier.

so I guess it's just magic. :P

Not sure what happens if you declare multiple outputs without using them. In the cases where you actually want more then one color output you have to specify this with glDrawBuffers and/or with layout qualifiers in the GLSL shader. Not entirely sure about all the details so check the GL documentation or glsl spec for more details.