Code Monkey home page Code Monkey logo

Comments (14)

kitao avatar kitao commented on May 5, 2024 1

Maybe I fixed this bug in 0.7.6.
Can anyone try it out?

Specifically, I changed the rendering position of each element by 0.5 pixel in OpenGL shader.
As a result of it, the edge region should also be treated as pixels regardless of environment. Probably.

from pyxel.

Stenodyon avatar Stenodyon commented on May 5, 2024

I'm having the same problem.

Sample program showcasing the bug:

import pyxel

class App:
    def __init__(self):
        pyxel.init(160, 128)
        pyxel.run(self.update, self.draw)

    def update(self):
        pass

    def draw(self):
        pyxel.cls(0)
        pyxel.rectb(20, 20, 100, 100, 7)

App()

pyxel bug
Same effect with rect, blt or cls, the last pixel column is not drawn.

Linux Debian 9, python 3.5.3

from pyxel.

carlsmith avatar carlsmith commented on May 5, 2024

The code @Stenodyon posted is working perfectly for me.

  • pyxel 0.7.2
  • python 3.7.0
  • macOS 10.13.6

from pyxel.

golebiewsky avatar golebiewsky commented on May 5, 2024

The code posted by @Stenodyon works for me on:

  • pyxel 0.7.0
  • Python 3.7.0
  • Windows 10 (1803)

But here:

import pyxel

class App:
    def __init__(self):
        pyxel.init(160, 128)
        pyxel.run(self.update, self.draw)

    def update(self):
        pass

    def draw(self):
        pyxel.cls(0)
        pyxel.rectb(0, 127, 20, 116, 7)
        pyxel.rectb(0, 127, 20, 120, 3)

App()

It shows only first rectangle and I have no idea why, maybe it is related.
image

from pyxel.

 avatar commented on May 5, 2024

Hello,

My setup is the following:

  • Pyxel 0.7.3
  • Python 3.6.6
  • Arch Linux

The examples 03_draw_api.py and 04_sound_api.py shows the same bug as @ponponboy.

04_sound_api.py segfaults right after being launched.

The two test codes by @Stenodyon and @golebiewsky show incorrect behaviour.

Since @carlsmith and @golebiewsky report no incorrect behaviour for the built-in example while using Python 3.7.0, I'll wait for Arch Linux to update Python from 3.6.6 to 3.7.0 before drawing any conclusion.

Screenshots

03_draw_api.py

03

04_sound_api.py

04

Test code from @Stenodyon

test

Test code from @golebiewsky

test2

from pyxel.

carlsmith avatar carlsmith commented on May 5, 2024

I tried @golebiewsky's code, and it works fine for me (same specs as my last post).

from pyxel.

kev-inn avatar kev-inn commented on May 5, 2024

I got an pixel-error dependant on the screen size set in pyxel.init()

import pyxel

class MyGame:
    def __init__(self):
        pyxel.init(100,100)
        self.x = 0
        pyxel.run(self.update, self.draw)

    def update(self):
        self.x = (self.x + 1) % pyxel.width

    def draw(self):
        pyxel.cls(0)
        pyxel.rect(self.x,0,self.x+7,7,9)

MyGame()

this code leads to this result:
100x100

but if I change the pyxel.init() to

pyxel.init(100,101)

the result is fine:
100x101

  • Win10,
  • Python 3.6.2
  • pyxel 0.7.4

from pyxel.

kitao avatar kitao commented on May 5, 2024

Pyxel uses the point sprites of OpenGL to improve the rendering performance.
And rendering area for each drawn object is specified as the size of point sprites.

So I think this bug is caused by the difference of OpenGL implementation.

from pyxel.

kitao avatar kitao commented on May 5, 2024

I will write a bit more.

Pyxel draws each element as point sprite of OpenGL. And to improve rendering performance, rendering area of each element is specified as the size of point sprite.
For examples, if the type of an element is pix, the size will be set as 1. In the case of rect, if the size of it is 40x30, the size will be set as 40 because allowed point sprite shape in OpenGL is only square.

So regarding this bug, it seems that some environment (depends on graphics driver?) decrease the point sprite size by 1. So pix and the longer edge of rect are not drawn.

For now, I don't have smart idea to fix this. Does anyone have good idea?

from pyxel.

kitao avatar kitao commented on May 5, 2024

Can anyone who faces this bug try to change the shaders.py l.54 from gl_PointSize = 1.0; to gl_PointSize = 1.1; and run the example #3 (draw api sample)?

I would like to know the pix api works or not by this change.

from pyxel.

Stenodyon avatar Stenodyon commented on May 5, 2024

0.7.6 fixed the bug for me, thanks!

from pyxel.

kitao avatar kitao commented on May 5, 2024

Thank you for checking it!

from pyxel.

 avatar commented on May 5, 2024

I confirm that, on my setup, release 0.7.6 fixed the bug.

from pyxel.

99p avatar 99p commented on May 5, 2024

looks perfect!
thanks kitao! ;D

from pyxel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.