Giter VIP home page Giter VIP logo

Comments (31)

wangg12 avatar wangg12 commented on June 9, 2024 6

My problem was gone by this.

from pyrender.

wangg12 avatar wangg12 commented on June 9, 2024 5

@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.

arsalan-mousavian avatar arsalan-mousavian commented on June 9, 2024 3

nvidia/cudagl:10.0-devel-ubuntu16.04

from pyrender.

mmatl avatar mmatl commented on June 9, 2024 1

@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.

mmatl avatar mmatl commented on June 9, 2024 1

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.

mmatl avatar mmatl commented on June 9, 2024 1

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()

image

from pyrender.

bhack avatar bhack commented on June 9, 2024

Have you read about https://stackoverflow.com/questions/34439832/how-to-create-an-opengl-3-3-or-4-x-context-through-egl?

from pyrender.

bhack avatar bhack commented on June 9, 2024

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.

bhack avatar bhack commented on June 9, 2024

This require email notification. Can you share in the repo or on gist?
I have a machine to test it.

from pyrender.

bhack avatar bhack commented on June 9, 2024

Yes it is working correctly.
Of course I need to use savefig in a headless context.

from pyrender.

mmatl avatar mmatl commented on June 9, 2024

from pyrender.

bhack avatar bhack commented on June 9, 2024

I've tested on Ubuntu 16.04

from pyrender.

bhack avatar bhack commented on June 9, 2024

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.

mmatl avatar mmatl commented on June 9, 2024

Thanks so much! I'll close the issue for now.

from pyrender.

arsalan-mousavian avatar arsalan-mousavian commented on June 9, 2024

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.

Ushk avatar Ushk commented on June 9, 2024

@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.

arsalan-mousavian avatar arsalan-mousavian commented on June 9, 2024

I ended up creating my docker image based of https://hub.docker.com/r/nvidia/cudagl and fixed the issue.

from pyrender.

Ushk avatar Ushk commented on June 9, 2024

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.

Ushk avatar Ushk commented on June 9, 2024

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.

mikedh avatar mikedh commented on June 9, 2024

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.

oarriaga avatar oarriaga commented on June 9, 2024

I have the same problem as @wangg12 :<

from pyrender.

LaiQE avatar LaiQE commented on June 9, 2024

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.

wookayin avatar wookayin commented on June 9, 2024

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.

wine3603 avatar wine3603 commented on June 9, 2024

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.

bestgodok avatar bestgodok commented on June 9, 2024

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.

azuryl avatar azuryl commented on June 9, 2024

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.

azuryl avatar azuryl commented on June 9, 2024

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.

JZhao12 avatar JZhao12 commented on June 9, 2024

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.

lingtengqiu avatar lingtengqiu commented on June 9, 2024

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.

JZhao12 avatar JZhao12 commented on June 9, 2024

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.

reconlabs-sergio avatar reconlabs-sergio commented on June 9, 2024

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)

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.