简体   繁体   English

Pythin kivy 如何关闭纹理抗锯齿

[英]Pythin kivy how to turn off texture antialiasing

I have a texture with an average size of 120 by 80 that changes every frame.我有一个平均大小为 120 x 80 的纹理,每帧都会发生变化。 It is created from an array of numbers using它是从一个数字数组中创建的

    def draw(self, t):
        self.buf = t
        self.texture_array = array('B', self.buf)
        self.size = Window.size
        self.padding_x = Window.size[0] * 0.25
        self.padding_y = Window.size[1] * 0.25
        self.pix_size_x = Window.size[0] * 0.75
        self.pix_size_y = Window.size[1] * 0.75
        self.tex.blit_buffer(self.texture_array, colorfmt='rgb', bufferfmt='ubyte')
        with self.canvas:
            Rectangle(texture = self.tex, pos = (self.padding_x, self.padding_y), size = (self.pix_size_x, self.pix_size_y))

It should look like pixel art, but the texture smoothing spoils the whole picture.它应该看起来像像素艺术,但纹理平滑破坏了整个画面。 Is it possible to somehow disable anti-aliasing or do another way to render the array?是否可以以某种方式禁用抗锯齿或以其他方式渲染数组?

The texture has mag_filter and min_filter properties, set these both to "nearest" .纹理具有mag_filtermin_filter属性,将它们都设置为"nearest"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM