TexturePeeker.filterRect: Assertion Error

I’m attempting to use a TexturePeeker to sample a texture, and specifically am using the “filterRect” method in order to cover a range of pixels. As far as I’m aware, the texture being sampled should be valid, as it’s being used elsewhere without trouble.

However, I keep bumping into the following assertion error:

AssertionError: min_y >= 0 && min_y <= _y_size && max_y >= 0 && max_y <= _y_size at line 572 of panda/src/gobj/texturePeeker.cxx

The documentation for “filterRect” indicates that it should wrap the UVs provided to it, so I’m surprised to be hitting what appears to be an issue with the operation overflowing the texture-bounds.

Nevertheless, I’ve tried limiting the extents of the UV-parameters via calls to “min” and “max”–to no avail. Even when limited to values between 0.2 and 0.8 (presuming that I did so correctly), I still encounter that same assertion error.

So, what might be going wrong here…?

Do you have a minimal sample for reproduction?

This produces the issue immediately on my system:


from panda3d.core import loadPrcFile, loadPrcFileData

from direct.showbase.ShowBase import ShowBase

from panda3d.core import Vec4

from panda3d import __version__ as pandaVersion
print (pandaVersion)

import sys
print (sys.version)

class Game(ShowBase):
    def __init__(self):


        tex = loader.loadTexture("circle.png")
        peeker = tex.peek()

        u = 0
        v = 0.5
        print (u, v)
        colour = Vec4()
        peeker.filterRect(colour, u - 0.05, v - 0.05, u + 0.05, v + 0.05)
        print (colour.x)

app = Game()

Input texture:

The same result can be had by setting the value of “u” to 0.96 or higher, it seems.

So, it looks like it doesn’t like values below 0 or above 1. That is either an API documentation bug or a bug in Panda. Please file an issue for this on the official issue tracker.

1 Like