I’ve been encountering some weird bugs that only occur in the 1.6.0 cvs trunk and not in 1.5.4. They have been annoying me for weeks now and I so far failed to solve them myself.
First bug: texture stages are limited to 4, even with shaders
(1) My card only supports 4 texture stages (GeForce 8600M). However, I can use more than 4 stages when I use a shader. Not anymore, the fifth texture is black in 1.6.0, while it does show up fine in 1.5.4:
(the shader is made to just display the fifth texture)
from pandac.PandaModules import *
import direct.directbase.DirectStart
cm = CardMaker("blah")
cm.setFrame(-1, 1, -1, 1)
b = render2d.attachNewNode(cm.generate())
#TEXUNIT0
b.setTexture(loader.loadTexture("maps/panda-model.jpg"))
ts = TextureStage("blah")
ts.setSort(10)
#TEXUNIT1
b.setTexture(ts, loader.loadTexture("maps/panda_hat.rgb"))
ts = TextureStage("ahah")
ts.setSort(20)
#TEXUNIT2
b.setTexture(ts, loader.loadTexture("maps/panda_head.rgb"))
ts = TextureStage("werwer")
ts.setSort(30)
#TEXUNIT3
b.setTexture(ts, loader.loadTexture("maps/panda_viser.rgb"))
ts = TextureStage("blamama")
ts.setSort(40)
#TEXUNIT4
b.setTexture(ts, loader.loadTexture("maps/envir-treetrunk.jpg"))
b.setShader(Shader.make("""//Cg
void vshader(out float4 l_position : POSITION,float4 vtx_position : POSITION,
uniform float4x4 mat_modelproj,
float2 vtx_texcoord0 : TEXCOORD0,
out float2 l_texcoord0 : TEXCOORD0) {
l_position=mul(mat_modelproj, vtx_position);
l_texcoord0=vtx_texcoord0;
}
void fshader(out float4 o_color : COLOR,
uniform sampler2D tex_4 : TEXUNIT4,
float2 l_texcoord0 : TEXCOORD0) {
o_color = f4tex2D(tex_4, l_texcoord0);
}"""))
run()
Second bug: buffer card texture is scaled wrongly
(2+3) Try running samples/Cartoon-Shader/Tut-Cartoon-Advanced.py in 1.6.0 – there are two problems. (2) the onscreen card is scaled and (3) the vertex colors have disappeared.
If I turn off automatic texture scaling (with textures-power-2 none) it works fine. In 1.5.4 it worked fine, too, even without ‘textures-power-2 none’.
It’s not just the Cartoon Shader sample, but everything that uses buffers (or the FilterManager)
Version 1.5.4, default configuration
Version 1.6.0, default configuration
Version 1.6.0, with ‘textures-power-2 none’