Giter VIP home page Giter VIP logo

Comments (11)

Remering avatar Remering commented on May 31, 2024 1

Ok, the latest release has fixed the issue. Happy hacking!!

from moderngl-window.

einarf avatar einarf commented on May 31, 2024

This is probably just a lingering glError that happened during initialization. Consume that error with pyopengl or self.ctx.error in your __init__.

I should probably ensure in the window itself there are no errors lingering.

EDIT: Never mind. I'm already doing this

err = self._ctx.error
if err != "GL_NO_ERROR":
logger.info("Consumed the following error during context creation: %s", err)

from moderngl-window.

einarf avatar einarf commented on May 31, 2024

Are you running it with run_window_config(Config) ?
Also, does one of the examples even work for you in the examples directory?

from moderngl-window.

einarf avatar einarf commented on May 31, 2024

This works for me. It does indeed look like a glerror was lingering from somewhere..

import moderngl_window
from OpenGL.GL import *


class BasicWindowConfig(moderngl_window.WindowConfig):
    """Minimal WindowConfig example"""
    gl_version = (3, 3)
    title = "Basic Window Config"

    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        # Consume lingering glerror from somewhere
        self.ctx.error

    def render(self, time, frametime):
        glClearColor(1.0, 0.0, 0.0, 0.0)
        glClear(GL_COLOR_BUFFER_BIT)


if __name__ == '__main__':
    moderngl_window.run_window_config(BasicWindowConfig)

from moderngl-window.

einarf avatar einarf commented on May 31, 2024

Yep. It's a lingering glError from querying the context info. Everything should work if you just consume the glerror. Meanwhile I'll fix this bug.

The err = 1280 you are getting is just a GL_INVALID_ENUM lingering from earlier. If you did not have a context you would see a completely different error.

from moderngl-window.

einarf avatar einarf commented on May 31, 2024

Released a new version: 2.0.2 that should fix this.

Upgrade with pip install -U moderngl-window

Also added a basic pyopengl example: https://github.com/moderngl/moderngl-window/blob/master/examples/with_pyopengl.py

Please let me know if this resolves your issue.

from moderngl-window.

Remering avatar Remering commented on May 31, 2024

Are you running it with run_window_config(Config) ?
Also, does one of the examples even work for you in the examples directory?

I am running it with run_window_config(Config), I have added that.
Some of the examples do work, but others haven't been tested.

from moderngl-window.

einarf avatar einarf commented on May 31, 2024

Upgrade to moderngl-window 2.0.2 and I'm 99% sure your issues will be resolved!

from moderngl-window.

Remering avatar Remering commented on May 31, 2024

This works for me. It does indeed look like a glerror was lingering from somewhere..

import moderngl_window
from OpenGL.GL import *


class BasicWindowConfig(moderngl_window.WindowConfig):
    """Minimal WindowConfig example"""
    gl_version = (3, 3)
    title = "Basic Window Config"

    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        # Consume lingering glerror from somewhere
        self.ctx.error

    def render(self, time, frametime):
        glClearColor(1.0, 0.0, 0.0, 0.0)
        glClear(GL_COLOR_BUFFER_BIT)


if __name__ == '__main__':
    moderngl_window.run_window_config(BasicWindowConfig)

After I add self.ctx.error at the top __init__ function, everything goes pretty fine. Many thanks to you!

from moderngl-window.

Remering avatar Remering commented on May 31, 2024

I'm cloning this project because my mirror doesn't contain the latest version.

from moderngl-window.

einarf avatar einarf commented on May 31, 2024

ah ok. git pull then 😄

Good luck with your projects @Remering and do not hesitate to open new issues if you stumble over something weird.

from moderngl-window.

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.