Jump to content

  • Log In with Google      Sign In   
  • Create Account


wellcosh

Member Since 16 Mar 2011
Offline Last Active Oct 29 2013 04:14 PM
-----

Posts I've Made

In Topic: 2 GLSL questions

10 November 2011 - 04:49 PM

I think it works now, it was necessary to call both glActiveTexture and glClientActiveTexture.

In Topic: 2 GLSL questions

10 November 2011 - 12:24 PM

http://www.opengl.or...i/Vertex_Arrays

glEnableClientState(GL_VERTEX_ARRAY);
  glVertexPointer(3, GL_FLOAT, sizeof(MyVertex), &vertex[0].x); 
 glEnableClientState(GL_NORMAL_ARRAY);
  glNormalPointer(GL_FLOAT, sizeof(MyVertex), &vertex[0].nx); 
 glClientActiveTexture(GL_TEXTURE0);  
glEnableClientState(GL_TEXTURE_COORD_ARRAY);  
glTexCoordPointer(2, GL_FLOAT, sizeof(MyVertex), &vertex[0].s0); 
 glClientActiveTexture(GL_TEXTURE1); 
 glEnableClientState(GL_TEXTURE_COORD_ARRAY); 
 glTexCoordPointer(2, GL_FLOAT, sizeof(MyVertex), &vertex[0].s1); 
 glClientActiveTexture(GL_TEXTURE2);
  glEnableClientState(GL_TEXTURE_COORD_ARRAY); 
 glTexCoordPointer(2, GL_FLOAT, sizeof(MyVertex), &vertex[0].s2);


You didn't even read the question, did you?



In Topic: 2 GLSL questions

10 November 2011 - 10:36 AM

... but you need to bind the second set of texture coordinates to an attribute in the shader.


How??



In Topic: 2 GLSL questions

10 November 2011 - 09:08 AM

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.

No no, I already have two sets in VBO. I just need to use both sets in shader.

I have one large mesh and there are two textures in each point. To know how much of each texture use, I have one big "mask" texture and I set one texture to alpha value of mask and other one to (1-alpha) value, like this

gl_FragColor = mix(texture2D(texmat0,gl_TexCoord[0].xy), texture2D(texmat1,gl_TexCoord[0].xy), 1-texture2D(mskalpha,gl_TexCoord[0].xy).a);

But, mask texture should have different texture coordinates then material textures, but now it shares one set.


In Topic: GLSL - merging two textures

04 November 2011 - 08:17 AM

It works! Endless thanks.

PARTNERS