libtcod / python-tcod

A high-performance Python port of libtcod. Includes the libtcodpy module for backwards compatibility with older projects.
BSD 2-Clause "Simplified" License
410 stars 36 forks source link

Unknown OpenGL error while allocation texture? #102

Closed keytonw closed 1 year ago

keytonw commented 3 years ago

Running on macOS Mojave (10.14.6) with tcod 11.18.2 at the end of the roguelike tutorial stage 3:

http://rogueliketutorials.com/tutorials/tcod/v2/part-3/

The code is running fine and I see what I expect to. However, I am receiving the following warning on the command line:

2020-12-07 14:39:37.930 Python[18975:17349373] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to (null)
/Users/keyton/Dropbox/fundev/venvs/tcod/lib/python3.9/site-packages/tcod/context.py:517: RuntimeWarning: libtcod 1.16.0-alpha.15 libtcod/src/libtcod/renderer_gl.c:110
Unkown OpenGL error while allocating texture.
  return new(

That's it. Nothing more. Everything works just fine. Just get that as an error.

HexDecimal commented 3 years ago

RuntimeWarning: libtcod 1.16.0-alpha.15 libtcod/src/libtcod/renderer_gl.c:110 Unkown OpenGL error while allocating texture.

It looks like libtcod's OpenGL render failed to allocate its texture atlas and for once it actually did the right thing by falling back to a more compatible renderer instead of crashing outright. If that's correct then it's safe to suppress warnings from tcod.context.new.

This seems to be another case of MacOS's weird OpenGL support. I doubt I'll be able to reproduce this error myself, but I can at least add more detail to the error reporting.

ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to (null)

This seems to be more MacOS specific and might have to do with how the application is configured or Python itself. You'll probably have to tell me what this means.

keytonw commented 3 years ago

Thanks for the quick response, Kyle! Appreciate it. Meant to send this comment right then but it got away from me. I'm running into that last part in a couple different programs so, I agree, that one's on me. :-) Will see if I can't track it down. Will comment back here if relevant at all.

tmelot2 commented 3 years ago

Thanks for the quick response, Kyle! Appreciate it. Meant to send this comment right then but it got away from me. I'm running into that last part in a couple different programs so, I agree, that one's on me. :-) Will see if I can't track it down. Will comment back here if relevant at all.

Did you ever figure this out? I'm trying to run the roguelike tutorial on my mid 2014 Macbook Pro on Catalina, same issue. Doesn't crash the app, but would like to fix it on my end if possible.

HexDecimal commented 3 years ago

It's difficult to debug the code from the Python port. If this was run as a C/C++ program you might be able to use a debugger to better look at it.

The relevant libtcod code is here: https://github.com/libtcod/libtcod/blob/f263e292afe35e8d7647f78df99155dbf72e1bc2/src/libtcod/renderer_gl.c#L71-L124

The error reporting has changed slightly. I'd like to know the error message reported by the latest version if you can post it.

HexDecimal commented 3 years ago

Someone recently posted the error message, so now I at least know the error is GL_INVALID_ENUM. I'm not sure if this error is from glTexImage2D or from before it.

HexDecimal commented 1 year ago

The OpenGL renderers have been dropped now the that SDL2 renderer performs well enough. If even the SDL2 renderer causes issues then see the workarounds used in #88.