Firstly, I'm pretty new to MiniB3d so I apologise if I'm missing something glaringly obvious but anyhow, I'm trying to create a basic material system using klepto's version of MiniB3d but I'm having issues with the z-ordering on alpha masked textures.
Currently if I load a texture with the Alpha flag, the textures are drawn over each other and I can't seem to sort the problem out.
I attempted to use a simple GLSL shader, which works fine if I use the discard function, but I cannot use the alpha channel for transparency. It works if I load the texture with the alpha flag, but again the ordering gets messed up.
This is my current code, adapted from the shader example:
This is my vert shader:
this is my frag shader:
Anyone have any suggestions? Thanks!
Currently if I load a texture with the Alpha flag, the textures are drawn over each other and I can't seem to sort the problem out.
I attempted to use a simple GLSL shader, which works fine if I use the discard function, but I cannot use the alpha channel for transparency. It works if I load the texture with the alpha flag, but again the ordering gets messed up.
This is my current code, adapted from the shader example:
Local Decal:TTexture = LoadTexture("Texture.tga") tex.BrushTexture(Decal,0) BrushShaderTexture(Tex,Decal , 0) InitShader(Tex) AddShaderObject(Tex,"media/new.vert","media/new.frag") Tex.ProgramAttriBegin() Tex.SetUI1("texture" , 0) Tex.ProgramAttriEnd() PaintEntity(mesh, Tex) ActivateShader(mesh, True)
This is my vert shader:
void main() { gl_Position = ftransform(); gl_TexCoord[0] = gl_MultiTexCoord0; }
this is my frag shader:
uniform sampler2D texture; void main() { vec4 texColor = texture2D(texture, gl_TexCoord[0].st); gl_FragColor = texColor; }
Anyone have any suggestions? Thanks!
