Comments (31)
My problem was gone by this.
from pyrender.
@mmatl I ran your EGL example, but get this error:
Traceback (most recent call last):
File "lib/python3.6/site-packages/OpenGL/latebind.py", line 41, in __call__
return self._finalCall( *args, **named )
TypeError: 'NoneType' object is not callable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "examples/egl_example.py", line 36, in <module>
color, depth = r.render(scene)
File "pyrender/examples/../pyrender/offscreen.py", line 100, in render
return self._renderer.render(scene, flags)
File "pyrender/examples/../pyrender/renderer.py", line 121, in render
self._update_context(scene, flags)
File "pyrender/examples/../pyrender/renderer.py", line 709, in _update_context
p._add_to_context()
File "pyrender/examples/../pyrender/primitive.py", line 324, in _add_to_context
self._vaid = glGenVertexArrays(1)
File "lib/python3.6/site-packages/OpenGL/latebind.py", line 45, in __call__
return self._finalCall( *args, **named )
File "lib/python3.6/site-packages/OpenGL/wrapper.py", line 657, in wrapperCall
result = wrappedOperation( *cArguments )
File "lib/python3.6/site-packages/OpenGL/platform/baseplatform.py", line 401, in __call__
if self.load():
File "lib/python3.6/site-packages/OpenGL/platform/baseplatform.py", line 390, in load
error_checker = self.error_checker,
File "lib/python3.6/site-packages/OpenGL/platform/baseplatform.py", line 148, in constructFunction
if (not is_core) and not self.checkExtension( extension ):
File "lib/python3.6/site-packages/OpenGL/platform/baseplatform.py", line 270, in checkExtension
result = extensions.ExtensionQuerier.hasExtension( name )
File "lib/python3.6/site-packages/OpenGL/extensions.py", line 98, in hasExtension
result = registered( specifier )
File "lib/python3.6/site-packages/OpenGL/extensions.py", line 105, in __call__
if not specifier.startswith( self.prefix ):
TypeError: startswith first arg must be bytes or a tuple of bytes, not str
Do you know how to solve this problem?
from pyrender.
nvidia/cudagl:10.0-devel-ubuntu16.04
from pyrender.
@bhack Great link, thanks so much! Pyglet already had an EGL backend (I had a sample platform for it here), but it hasn't worked very stably as of yet. I'll be keeping an eye on this thread, and I'll add in support for hardware-accelerated headless rendering with EGL as soon as Pyglet supports it cleanly.
Best,
Matt
from pyrender.
Hi @bhack,
Thanks for the suggestion. After messing around a lot, I realized that I just had an NVIDIA driver issue with EGL on Ubuntu 16.04. I tried my EGL platform on Google CoLab and it works on newer Ubuntu versions (or if you install your drivers from a runfile). Check it out here. Does that work for you?
from pyrender.
Oops so sorry, forgot to share the link! You should be able to access it now.
Here's the code:
# Render offscreen -- make sure to set the PyOpenGL platform
import os
os.environ["PYOPENGL_PLATFORM"] = "egl"
import numpy as np
import trimesh
import pyrender
# Load the FUZE bottle trimesh and put it in a scene
fuze_trimesh = trimesh.load('pyrender/examples/models/fuze.obj')
mesh = pyrender.Mesh.from_trimesh(fuze_trimesh)
scene = pyrender.Scene()
scene.add(mesh)
# Set up the camera -- z-axis away from the scene, x-axis right, y-axis up
camera = pyrender.PerspectiveCamera(yfov=np.pi / 3.0)
s = np.sqrt(2)/2
camera_pose = np.array([
[0.0, -s, s, 0.3],
[1.0, 0.0, 0.0, 0.0],
[0.0, s, s, 0.35],
[0.0, 0.0, 0.0, 1.0],
])
scene.add(camera, pose=camera_pose)
# Set up the light -- a single spot light in the same spot as the camera
light = pyrender.SpotLight(color=np.ones(3), intensity=3.0,
innerConeAngle=np.pi/16.0)
scene.add(light, pose=camera_pose)
# Render the scene
r = pyrender.OffscreenRenderer(640, 480)
color, depth = r.render(scene)
# Show the images
import matplotlib.pyplot as plt
plt.figure()
plt.subplot(1,2,1)
plt.axis('off')
plt.imshow(color)
plt.subplot(1,2,2)
plt.axis('off')
plt.imshow(depth, cmap=plt.cm.gray_r)
plt.show()
from pyrender.
Have you read about https://stackoverflow.com/questions/34439832/how-to-create-an-opengl-3-3-or-4-x-context-through-egl?
from pyrender.
Cause:
OpenGL 3.3 and above, the corresponding GLSL version matches the OpenGL version
But here i see 3.2:
https://github.com/mmatl/pyrender/blob/master/pyrender/platforms.py#L120
And shaders
#version 330 core
from pyrender.
This require email notification. Can you share in the repo or on gist?
I have a machine to test it.
from pyrender.
Yes it is working correctly.
Of course I need to use savefig
in a headless context.
from pyrender.
from pyrender.
I've tested on Ubuntu 16.04
from pyrender.
If you are interested for the readme:
EGL 1.5 on r600, radeonsi, nv50, nvc0 from https://www.mesa3d.org/relnotes/11.0.0.html
So we are talking about 2015 release.
I don't know the updated Intel status.
from pyrender.
Thanks so much! I'll close the issue for now.
from pyrender.
I am trying to use pyrender inside a docker image. I get the following error when I try to just import. If I try to import for the second time it goes through and then fails when creating offscreenrenderer. Any suggestions?
import os
>>> os.environ["PYOPENGL_PLATFORM"] = "egl"
>>> os.environ["PYOPENGL_PLATFORM"] = "egl"
>>> import pyrender
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/pyglet/__init__.py", line 351, in __getattr__
return getattr(self._module, name)
AttributeError: 'NoneType' object has no attribute 'Window'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/pyglet/__init__.py", line 351, in __getattr__
return getattr(self._module, name)
AttributeError: 'NoneType' object has no attribute '_create_shadow_window'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/pyrender/__init__.py", line 12, in <module>
from .viewer import Viewer
File "/usr/local/lib/python3.5/dist-packages/pyrender/viewer.py", line 36, in <module>
class Viewer(pyglet.window.Window):
File "/usr/local/lib/python3.5/dist-packages/pyglet/__init__.py", line 357, in __getattr__
__import__(import_name)
File "/usr/local/lib/python3.5/dist-packages/pyglet/window/__init__.py", line 1872, in <module>
gl._create_shadow_window()
File "/usr/local/lib/python3.5/dist-packages/pyglet/__init__.py", line 357, in __getattr__
__import__(import_name)
File "/usr/local/lib/python3.5/dist-packages/pyglet/gl/__init__.py", line 100, in <module>
from pyglet.gl.lib import GLException
File "/usr/local/lib/python3.5/dist-packages/pyglet/gl/lib.py", line 143, in <module>
from pyglet.gl.lib_glx import link_GL, link_GLU, link_GLX
File "/usr/local/lib/python3.5/dist-packages/pyglet/gl/lib_glx.py", line 50, in <module>
gl_lib = pyglet.lib.load_library('GL')
File "/usr/local/lib/python3.5/dist-packages/pyglet/lib.py", line 168, in load_library
raise ImportError('Library "%s" not found.' % names[0])
ImportError: Library "GL" not found.
>>> os.environ["PYOPENGL_PLATFORM"] = "egl"
>>> import pyrender
>>> pyrender.OffscreenRenderer(400, 400)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/pyrender/offscreen.py", line 32, in __init__
self._create()
File "/usr/local/lib/python3.5/dist-packages/pyrender/offscreen.py", line 129, in _create
self._platform.init_context()
File "/usr/local/lib/python3.5/dist-packages/pyrender/platforms.py", line 137, in init_context
assert eglInitialize(self._egl_display, major, minor)
File "/usr/local/lib/python3.5/dist-packages/OpenGL/platform/baseplatform.py", line 402, in __call__
return self( *args, **named )
File "/usr/local/lib/python3.5/dist-packages/OpenGL/error.py", line 232, in glCheckError
baseOperation = baseOperation,
OpenGL.error.GLError: GLError(
err = 12289,
baseOperation = eglInitialize,
cArguments = (
<OpenGL._opaque.EGLDisplay_pointer object at 0x7f1fe2a4c158>,
c_long(0),
c_long(0),
),
result = 0
)
from pyrender.
@arsalan-mousavian - I am having the same issue. Did you resolve it somehow, or open a new issue? (I am aware this one is closed).
I have seen this post:
https://github.com/NVIDIA/libglvnd/issues/174
but the solution given did not work for me.
from pyrender.
I ended up creating my docker image based of https://hub.docker.com/r/nvidia/cudagl and fixed the issue.
from pyrender.
Thanks for the speedy reply, especially given that the last comment was over two months ago!
Mine is also based on cudagl (have tried 10.0-devel and 10.0-base, to be specific). Could I ask which image you used? And, if possible (I realise time has passed) what apt install packages you used in the run file, in case this is ultimately some sort of missing library issue.
from pyrender.
For the benefit of anyone who reads this at a later date (relevant) - I gave up and switched to a different python package. I couldn't get any of the listed docker images to work for me.
from pyrender.
Haha I have no idea if it works with pyrender
, but I use LLVMpipe software rasterization and XVFB to do simple renders in containers to avoid the pain of CUDA/EGL/etc. I just pushed a minimal example which should render a sphere inside a container.
from pyrender.
I have the same problem as @wangg12 :<
from pyrender.
I ended up creating my docker image based of https://hub.docker.com/r/nvidia/cudagl and fixed the issue.
thak you very much , solve my problem
from pyrender.
For anyone who might run into this issue and find this issue from Googling: make sure you have libegl1
(or libegl-dev
) packages installed.
from pyrender.
I get the same error on ubuntu 18, cuda 10, pyrender 0.1.36 with pyopengl 1.30, any helps?
libEGL warning: DRI2: failed to create dri screen
libEGL warning: Not allowed to force software rendering when API explicitly selects a hardware device.
libEGL warning: DRI2: failed to create dri screen
Traceback (most recent call last):
File "demo.py", line 382, in <module>
main(args)
File "demo.py", line 256, in main
renderer = Renderer(resolution=(orig_width, orig_height), orig_img=True, wireframe=args.wireframe)
File "/home/zhang-u16/VIBE/lib/utils/renderer.py", line 60, in __init__
point_size=1.0
File "/home/zhang-u16/VIBE/vibe-env/lib/python3.7/site-packages/pyrender/offscreen.py", line 31, in __init__
self._create()
File "/home/zhang-u16/VIBE/vibe-env/lib/python3.7/site-packages/pyrender/offscreen.py", line 134, in _create
self._platform.init_context()
File "/home/zhang-u16/VIBE/vibe-env/lib/python3.7/site-packages/pyrender/platforms/egl.py", line 177, in init_context
assert eglInitialize(self._egl_display, major, minor)
File "/home/zhang-u16/VIBE/vibe-env/lib/python3.7/site-packages/OpenGL/platform/baseplatform.py", line 402, in __call__
return self( *args, **named )
File "/home/zhang-u16/VIBE/vibe-env/lib/python3.7/site-packages/OpenGL/error.py", line 232, in glCheckError
baseOperation = baseOperation,
OpenGL.error.GLError: GLError(
err = 12289,
baseOperation = eglInitialize,
cArguments = (
<OpenGL._opaque.EGLDisplay_pointer object at 0x7fefdc14ecb0>,
c_long(0),
c_long(0),
),
result = 0
)
```
`
from pyrender.
I get the same error on ubuntu 18, cuda 10, pyrender 0.1.36 with pyopengl 1.30, any helps?
libEGL warning: DRI2: failed to create dri screen libEGL warning: Not allowed to force software rendering when API explicitly selects a hardware device. libEGL warning: DRI2: failed to create dri screen Traceback (most recent call last): File "demo.py", line 382, in <module> main(args) File "demo.py", line 256, in main renderer = Renderer(resolution=(orig_width, orig_height), orig_img=True, wireframe=args.wireframe) File "/home/zhang-u16/VIBE/lib/utils/renderer.py", line 60, in __init__ point_size=1.0 File "/home/zhang-u16/VIBE/vibe-env/lib/python3.7/site-packages/pyrender/offscreen.py", line 31, in __init__ self._create() File "/home/zhang-u16/VIBE/vibe-env/lib/python3.7/site-packages/pyrender/offscreen.py", line 134, in _create self._platform.init_context() File "/home/zhang-u16/VIBE/vibe-env/lib/python3.7/site-packages/pyrender/platforms/egl.py", line 177, in init_context assert eglInitialize(self._egl_display, major, minor) File "/home/zhang-u16/VIBE/vibe-env/lib/python3.7/site-packages/OpenGL/platform/baseplatform.py", line 402, in __call__ return self( *args, **named ) File "/home/zhang-u16/VIBE/vibe-env/lib/python3.7/site-packages/OpenGL/error.py", line 232, in glCheckError baseOperation = baseOperation, OpenGL.error.GLError: GLError( err = 12289, baseOperation = eglInitialize, cArguments = ( <OpenGL._opaque.EGLDisplay_pointer object at 0x7fefdc14ecb0>, c_long(0), c_long(0), ), result = 0 )
`
I have the same problem. Have you solved it?
from pyrender.
Hi @bhack,
Thanks for the suggestion. After messing around a lot, I realized that I just had an NVIDIA driver issue with EGL on Ubuntu 16.04. I tried my EGL platform on Google CoLab and it works on newer Ubuntu versions (or if you install your drivers from a runfile). Check it out here. Does that work for you?
@mmatl Dear the link not exit do you solved in ubuntu 18.04
from pyrender.
I get the same error on ubuntu 18, cuda 10, pyrender 0.1.36 with pyopengl 1.30, any helps?
libEGL warning: DRI2: failed to create dri screen libEGL warning: Not allowed to force software rendering when API explicitly selects a hardware device. libEGL warning: DRI2: failed to create dri screen Traceback (most recent call last): File "demo.py", line 382, in <module> main(args) File "demo.py", line 256, in main renderer = Renderer(resolution=(orig_width, orig_height), orig_img=True, wireframe=args.wireframe) File "/home/zhang-u16/VIBE/lib/utils/renderer.py", line 60, in __init__ point_size=1.0 File "/home/zhang-u16/VIBE/vibe-env/lib/python3.7/site-packages/pyrender/offscreen.py", line 31, in __init__ self._create() File "/home/zhang-u16/VIBE/vibe-env/lib/python3.7/site-packages/pyrender/offscreen.py", line 134, in _create self._platform.init_context() File "/home/zhang-u16/VIBE/vibe-env/lib/python3.7/site-packages/pyrender/platforms/egl.py", line 177, in init_context assert eglInitialize(self._egl_display, major, minor) File "/home/zhang-u16/VIBE/vibe-env/lib/python3.7/site-packages/OpenGL/platform/baseplatform.py", line 402, in __call__ return self( *args, **named ) File "/home/zhang-u16/VIBE/vibe-env/lib/python3.7/site-packages/OpenGL/error.py", line 232, in glCheckError baseOperation = baseOperation, OpenGL.error.GLError: GLError( err = 12289, baseOperation = eglInitialize, cArguments = ( <OpenGL._opaque.EGLDisplay_pointer object at 0x7fefdc14ecb0>, c_long(0), c_long(0), ), result = 0 )
`
I have the same problem. Have you solved it?
same issue
from pyrender.
Hello guys I met a similar issue with 'OpenGL.error.GLError: GLError( err = 12289', I was doing the offscreen rendering based on Pyrender. Now I solved this problem by calling render.delete(), so every time it will rebuild the rendering again and this issue disappeared. Hope it helps.
from pyrender.
Hello guys I met a similar issue with 'OpenGL.error.GLError: GLError( err = 12289', I was doing the offscreen rendering based on Pyrender. Now I solved this problem by calling render.delete(), so every time it will rebuild the rendering again and this issue disappeared. Hope it helps.
where I add this code? could you please give us a example?
from pyrender.
Hi @lingtengqiu , I used the Pyrender example code from here https://pyrender.readthedocs.io/en/latest/examples/quickstart.html , and I added the render.delete() in the end of the script.
import numpy as np
import trimesh
import pyrender
import matplotlib.pyplot as plt
fuze_trimesh = trimesh.load('examples/models/fuze.obj')
mesh = pyrender.Mesh.from_trimesh(fuze_trimesh)
scene = pyrender.Scene()
scene.add(mesh)
camera = pyrender.PerspectiveCamera(yfov=np.pi / 3.0, aspectRatio=1.0)
s = np.sqrt(2)/2
camera_pose = np.array([
... [0.0, -s, s, 0.3],
... [1.0, 0.0, 0.0, 0.0],
... [0.0, s, s, 0.35],
... [0.0, 0.0, 0.0, 1.0],
... ])
scene.add(camera, pose=camera_pose)
light = pyrender.SpotLight(color=np.ones(3), intensity=3.0,
... innerConeAngle=np.pi/16.0,
... outerConeAngle=np.pi/6.0)
scene.add(light, pose=camera_pose)
r = pyrender.OffscreenRenderer(400, 400)
color, depth = r.render(scene)
r.delete()
Hope it helps
from pyrender.
I ended up creating my docker image based of https://hub.docker.com/r/nvidia/cudagl and fixed the issue.
I confirm that this solved my problem. I used 11.3.0-devel
from pyrender.
Related Issues (20)
- Inverted triangles?
- How to retrieve intrinsic camera parameters from PerspectiveCamera
- Textures rendering slanted
- Sphere Rendered with Non-reflective Material Not Appearing Black
- offscreen error
- 'Viewer' object has no attribute 'render'. Did you mean: '_render'?
- Interpolation artifacts in segmentation masks.
- Unable to get color on running the bottle example code HOT 1
- Wrong depth rendering in WSL-ubuntu environment
- Path3D type error when loading trimesh scene
- GLB is not rendered correctly HOT 1
- How to properly merge the Scenes from multiple trimeshes?
- Request for Release of Tag 0.1.46 with auto_start Option
- Cannot render SpecularGlossinessMaterial HOT 1
- jupyter notebook support?
- Attempt to call an undefined function glGenVertexArrays, check for bool(glGenVertexArrays) before calling HOT 3
- OpenGL.error.NullFunctionError: Attempt to call an undefined function glGenVertexArrays, check for bool(glGenVertexArrays) before calling
- Change camera pose to identity matrix (np.eye(4)) and move object to get same result HOT 1
- Using pyrender on CPU HOT 1
- "TypeError: 'NoneType' object is not callable" when calling Renderer.render_text() HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyrender.