In 1.7.0 I cannot get texture filtering on RTT textures, whereas in 1.6.2 it worked just as with static textures (texture.setMinfilter(…)). Here is the test code (no external images needed):
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from pandac.PandaModules import *
from direct.showbase.DirectObject import *
config = {
"load-display": "pandagl",
"win-size": "400 200",
"framebuffer-multisample": "1",
"multisamples": "4",
}
for var, val in config.items():
ConfigVariableString(var).setValue(val)
import direct.directbase.DirectStart
# Create a rectangular tile in XZ plane.
def make_tile (sx, sz):
vformat = GeomVertexFormat.getV3n3t2()
vdata = GeomVertexData("data", vformat, Geom.UHStatic)
vwvertex = GeomVertexWriter(vdata, "vertex")
vwnormal = GeomVertexWriter(vdata, "normal")
vwuvmap = GeomVertexWriter(vdata, "texcoord")
vwvertex.addData3f(-0.5 * sx, 0.0, -0.5 * sz)
vwnormal.addData3f(0.0, 1.0, 0.0)
vwuvmap.addData2f(0.0, 0.0)
vwvertex.addData3f(0.5 * sx, 0.0, -0.5 * sz)
vwnormal.addData3f(0.0, 1.0, 0.0)
vwuvmap.addData2f(1.0, 0.0)
vwvertex.addData3f(0.5 * sx, 0.0, 0.5 * sz)
vwnormal.addData3f(0.0, 1.0, 0.0)
vwuvmap.addData2f(1.0, 1.0)
vwvertex.addData3f(-0.5 * sx, 0.0, 0.5 * sz)
vwnormal.addData3f(0.0, 1.0, 0.0)
vwuvmap.addData2f(0.0, 1.0)
tris = GeomTriangles(Geom.UHStatic)
tris.addVertices(0, 1, 2)
tris.closePrimitive()
tris.addVertices(0, 2, 3)
tris.closePrimitive()
geom = Geom(vdata)
geom.addPrimitive(tris)
geomnode = GeomNode("tile")
geomnode.addGeom(geom)
ndpath = NodePath(geomnode)
return ndpath
# Static texture.
tex1 = loader.loadTexture("maps/panda-model.jpg")
tex1.setMinfilter(Texture.FTLinearMipmapLinear)
# Same texture as above, but pulled through RTT.
buf2 = base.win.makeTextureBuffer("buf2", 1024, 1024)
cam2 = base.makeCamera2d(buf2)
sc2 = NodePath("sc2")
sc2.setDepthTest(False)
sc2.setDepthWrite(False)
cam2.node().setScene(sc2)
stile = make_tile(2.0, 2.0)
stile.reparentTo(sc2)
stex = loader.loadTexture("maps/panda-model.jpg")
stile.setTexture(stex)
tex2 = buf2.getTexture()
tex2.setMinfilter(Texture.FTLinearMipmapLinear)
# A tile with static texture.
tile1 = make_tile(1.0, 1.0)
tile1.reparentTo(render)
tile1.setPos(-0.8, 3.0, 0.0)
tile1.setTexture(tex1)
# A tile with RTT texture.
tile2 = make_tile(1.0, 1.0)
tile2.reparentTo(render)
tile2.setPos(+0.8, 3.0, 0.0)
tile2.setTexture(tex2)
# Rotate the two tiles for clearer aliasing effects.
def main_loop (task):
dt = globalClock.getDt()
rspeed = 20.0
tile1.setR(tile1.getR() + rspeed * dt)
tile2.setR(tile2.getR() + rspeed * dt)
return task.cont
base.setBackgroundColor(0.0, 0.0, 0.0, 0.0)
render.setAntialias(AntialiasAttrib.MAuto)
taskMgr.add(main_loop, "main-loop")
run()
and here is a snapshot of what I see (the left tile has a static texture, and the right tile that same texture but pulled through RTT):
img835.imageshack.us/i/panda3drt … ngprob.png
Is this a bug in 1.7.0, or there is a new switch to flip?