Closed Remering closed 4 years ago
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
Are you running it with run_window_config(Config)
?
Also, does one of the examples even work for you in the examples
directory?
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)
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.
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.
Are you running it with
run_window_config(Config)
? Also, does one of the examples even work for you in theexamples
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.
Upgrade to moderngl-window 2.0.2 and I'm 99% sure your issues will be resolved!
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!
I'm cloning this project because my mirror doesn't contain the latest version.
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.
Ok, the latest release has fixed the issue. Happy hacking!!
Backend: glfw Context OpenGL version: 450 core Operation system: Windows 10 Python interpreter: Python 3.8.0 [MSC v.1916 64 bit (AMD64)] on win32
I want to call
glPolygonMode
viaPyOpenGL
, but aGLError
is raised.Code:
Error log:
It seems that the lack of a
OpenGL
context. I put a breakpoint atmoderngl_window/context/glfw/__init__.py: line 61
after that line is executed, I could call native OpenGL functions via
PyOpenGL
But I'm confused why I can't do the same thing inrender
function, is there a solution? Thanks a lot.