Thank you for the quick response.
I updated the code as you requested:
Code:
threecolor getColor(vec4 texCoord, float texId)
{
vec2 coord1 = texCoord.yz;
vec2 coord2 = texCoord.zx;
vec2 coord3 = texCoord.xy;
threecolor ret;
if(texId == 0) {
ret.col0 = float4(0.0, 0.0, 0.0, 1.0);
ret.col1 = float4(0.0, 0.0, 0.0, 1.0);
ret.col2 = float4(0.0, 0.0, 0.0, 1.0);
} else if(texId == 1) {
ret.col0 = float4(1.0, 0.0, 0.0, 1.0);
ret.col1 = float4(1.0, 0.0, 0.0, 1.0);
ret.col2 = float4(1.0, 0.0, 0.0, 1.0);
} else if(texId == 2) {
ret.col0 = float4(0.0, 1.0, 0.0, 1.0);
ret.col1 = float4(0.0, 1.0, 0.0, 1.0);
ret.col2 = float4(0.0, 1.0, 0.0, 1.0);
} else if(texId == 3) {
ret.col0 = float4(0.0, 0.0, 1.0, 1.0);
ret.col1 = float4(0.0, 0.0, 1.0, 1.0);
ret.col2 = float4(0.0, 0.0, 1.0, 1.0);
} else if(texId == 4) {
ret.col0 = float4(1.0, 0.0, 1.0, 1.0);
ret.col1 = float4(1.0, 0.0, 1.0, 1.0);
ret.col2 = float4(1.0, 0.0, 1.0, 1.0);
} else {
// white
ret.col0.x = 1.0;
ret.col0.y = 1.0;
ret.col0.z = 1.0;
ret.col0.w = 1.0;
ret.col1 = ret.col0;
ret.col2 = ret.col0;
}
return ret;
}
I get the same distortion, but with colors of white and red instead of white and black.
My knowledge about shaders are regrettably close to zero.
Then, I did enable this little hack when generation the voxels, and ended up with a very distorted but colorful cube:
Code:
static uint8_t material = 0;
material++;
material = material % 4;
if(material == 0) material = 1;
MaterialDensityPair88 voxel = volData.getVoxelAt(x,y,z);
uint8_t uDensity = MaterialDensityPair88::getMaxDensity();
voxel.setDensity(uDensity);
voxel.setMaterial(material);
volData.setVoxelAt(x, y, z, voxel);
Since the colors are returned properly, I guess the issue is in the main program. I will ask someone else to run the program, in case it has something to do with my hardware/drivers.