SpiderPig Posted May 30 Share Posted May 30 Hey Josh, using the first coord set I can send any value over to the shader and it works. But it won't work for the 2nd set. This is how I'm setting the data. for (auto v = 0; v < mesh->CountVertices(); v++) { mesh->SetVertexTexCoords(v, 2.0f, 0.0f, 1); } In my custom frag shader I'm doing something like this. if(tex_coords.z == 2.0f){ color = vec4(0,1,0,1); } else{ color = vec4(1,0,0,1); } In my tests 'z' is never equal to 2. I have tried 'w' as well. I've looked over the vertex shaders and the coords are not being modified anywhere in the shaders to cause the 2nd coord set not to work. I tested the x and y components and they do work. This works. for (auto v = 0; v < mesh->CountVertices(); v++) { mesh->SetVertexTexCoords(v, 2.0f, 0.0f, 0);//<- first uv set } Shader that works. if(tex_coords.x == 2.0f){//<- testing x instead of z color = vec4(0,1,0,1); } else{ color = vec4(1,0,0,1); } Not sure how to put together a simple example for this one, but if there's a way you can take a look to see if the the 2nd coord set data is actually being transferred to the GPU maybe? Quote Link to comment Share on other sites More sharing options...
Josh Posted May 30 Share Posted May 30 Can you check a > test instead of an exact equals? Something like this: for (auto v = 0; v < mesh->CountVertices(); v++) { mesh->SetVertexTexCoords(v, 2.0f, 0.0f, 1); } if(tex_coords.z > 1.0f){ color = vec4(0,1,0,1); } else{ color = vec4(1,0,0,1); } 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
SpiderPig Posted May 31 Author Share Posted May 31 This works. if(tex_coords.z > 0.0f){ color = vec4(0,1,0,1); } else{ color = vec4(1,0,0,1); } But this does not. if(tex_coords.z > 1.0f){ color = vec4(0,1,0,1); } else{ color = vec4(1,0,0,1); } 1 Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted May 31 Author Share Posted May 31 if ( in_TexCoords.z > 0.5f ) { color[0] = vec4( 0.0f, 1.0f, 0.0f, 1.0f ); } else { color[0] = vec4( 1.0f, 0.0f, 0.0f, 1.0f ); } It seems that from left to right the 'z' value is going from 0 to 1. I'm going to check other areas in my code. It is possible I'm accidently overwriting this value somewhere... Quote Link to comment Share on other sites More sharing options...
Solution SpiderPig Posted May 31 Author Solution Share Posted May 31 Um.... this isn't a bug. It's my code, the 2nd coord set was being overwritten elsewhere that I had forgotten about. Sorry Josh. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.