From 1609f7da4cd8f14da999a13d9fb157d5089ff4df Mon Sep 17 00:00:00 2001 From: bla Date: Mon, 1 Oct 2018 18:54:35 -0700 Subject: [PATCH 1/4] bump up pybullet version again --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 4c8091ce2..03490eac9 100644 --- a/setup.py +++ b/setup.py @@ -559,7 +559,7 @@ if 'BT_USE_EGL' in EGL_CXX_FLAGS: setup( name = 'pybullet', - version='2.2.3', + version='2.2.6', description='Official Python Interface for the Bullet Physics SDK specialized for Robotics Simulation and Reinforcement Learning', long_description='pybullet is an easy to use Python module for physics simulation, robotics and deep reinforcement learning based on the Bullet Physics SDK. With pybullet you can load articulated bodies from URDF, SDF and other file formats. pybullet provides forward dynamics simulation, inverse dynamics computation, forward and inverse kinematics and collision detection and ray intersection queries. Aside from physics simulation, pybullet supports to rendering, with a CPU renderer and OpenGL visualization and support for virtual reality headsets.', url='https://github.com/bulletphysics/bullet3', From da37f1d559efb7089dcdc04ae813860fa384b7d7 Mon Sep 17 00:00:00 2001 From: erwincoumans Date: Tue, 2 Oct 2018 07:49:13 -0700 Subject: [PATCH 2/4] add glViewport after call to startRendering (some renderers call glViewport) --- examples/ExampleBrowser/OpenGLGuiHelper.cpp | 1 + .../plugins/eglPlugin/eglRendererVisualShapeConverter.cpp | 7 +++---- examples/pybullet/examples/testrender_egl.py | 8 +++++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/examples/ExampleBrowser/OpenGLGuiHelper.cpp b/examples/ExampleBrowser/OpenGLGuiHelper.cpp index cb1477b6c..7e615a379 100644 --- a/examples/ExampleBrowser/OpenGLGuiHelper.cpp +++ b/examples/ExampleBrowser/OpenGLGuiHelper.cpp @@ -1158,6 +1158,7 @@ void OpenGLGuiHelper::copyCameraImageData(const float viewMatrix[16], const floa { { m_data->m_glApp->m_window->startRendering(); + m_data->m_glApp->setViewport(sourceWidth, sourceHeight); BT_PROFILE("renderScene"); getRenderInterface()->renderSceneInternal(B3_SEGMENTATION_MASK_RENDERMODE); } diff --git a/examples/SharedMemory/plugins/eglPlugin/eglRendererVisualShapeConverter.cpp b/examples/SharedMemory/plugins/eglPlugin/eglRendererVisualShapeConverter.cpp index 973fc1b68..542196ff1 100644 --- a/examples/SharedMemory/plugins/eglPlugin/eglRendererVisualShapeConverter.cpp +++ b/examples/SharedMemory/plugins/eglPlugin/eglRendererVisualShapeConverter.cpp @@ -995,7 +995,7 @@ void EGLRendererVisualShapeConverter::copyCameraImageDataGL( int destinationWidth = *widthPtr; int destinationHeight = *heightPtr; - int sourceWidth = btMin(destinationWidth, (int)(m_data->m_window->getWidth() * m_data->m_window->getRetinaScale())); + int sourceWidth = btMin(destinationWidth, (int)(m_data->m_window->getWidth() * m_data->m_window->getRetinaScale())); int sourceHeight = btMin(destinationHeight, (int)(m_data->m_window->getHeight() * m_data->m_window->getRetinaScale())); int numTotalPixels = (*widthPtr) * (*heightPtr); @@ -1006,10 +1006,9 @@ void EGLRendererVisualShapeConverter::copyCameraImageDataGL( { if (startPixelIndex == 0) { - glViewport(0,0, sourceWidth, sourceHeight); m_data->m_window->endRendering(); m_data->m_window->startRendering(); - + glViewport(0,0, sourceWidth, sourceHeight); B3_PROFILE("m_instancingRenderer render"); m_data->m_instancingRenderer->writeTransforms(); if (m_data->m_hasLightDirection) @@ -1097,7 +1096,7 @@ void EGLRendererVisualShapeConverter::copyCameraImageDataGL( { { m_data->m_window->startRendering(); - + glViewport(0,0, sourceWidth, sourceHeight); BT_PROFILE("renderScene"); m_data->m_instancingRenderer->renderSceneInternal(B3_SEGMENTATION_MASK_RENDERMODE); } diff --git a/examples/pybullet/examples/testrender_egl.py b/examples/pybullet/examples/testrender_egl.py index 0f0b89e03..ee25f64b7 100644 --- a/examples/pybullet/examples/testrender_egl.py +++ b/examples/pybullet/examples/testrender_egl.py @@ -21,8 +21,10 @@ ax = plt.gca() pybullet.connect(pybullet.DIRECT) egl = pkgutil.get_loader('eglRenderer') - -pybullet.loadPlugin(egl.get_filename(), "_eglRendererPlugin") +if (egl): + pybullet.loadPlugin(egl.get_filename(), "_eglRendererPlugin") +else: + pybullet.loadPlugin("eglRendererPlugin") pybullet.loadURDF("plane.urdf",[0,0,-1]) pybullet.loadURDF("r2d2.urdf") @@ -52,7 +54,7 @@ while (1): viewMatrix = pybullet.computeViewMatrixFromYawPitchRoll(camTargetPos, camDistance, yaw, pitch, roll, upAxisIndex) aspect = pixelWidth / pixelHeight; projectionMatrix = pybullet.computeProjectionMatrixFOV(fov, aspect, nearPlane, farPlane); - img_arr = pybullet.getCameraImage(pixelWidth, pixelHeight, viewMatrix,projectionMatrix, shadow=1,lightDirection=[1,1,1],renderer=pybullet.ER_BULLET_HARDWARE_OPENGL) + img_arr = pybullet.getCameraImage(pixelWidth, pixelHeight, viewMatrix,projectionMatrix, shadow=1,flags=pybullet.ER_SEGMENTATION_MASK, lightDirection=[1,1,1],renderer=pybullet.ER_BULLET_HARDWARE_OPENGL) stop = time.time() print ("renderImage %f" % (stop - start)) From ae93c0878dbf51e23d642406f4c1b775f242f517 Mon Sep 17 00:00:00 2001 From: bla Date: Tue, 2 Oct 2018 07:51:09 -0700 Subject: [PATCH 3/4] bump up pybullet version to 2.2.7 (fixing egl/segmask took a few iterations) --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 03490eac9..aa939bfc1 100644 --- a/setup.py +++ b/setup.py @@ -559,7 +559,7 @@ if 'BT_USE_EGL' in EGL_CXX_FLAGS: setup( name = 'pybullet', - version='2.2.6', + version='2.2.7', description='Official Python Interface for the Bullet Physics SDK specialized for Robotics Simulation and Reinforcement Learning', long_description='pybullet is an easy to use Python module for physics simulation, robotics and deep reinforcement learning based on the Bullet Physics SDK. With pybullet you can load articulated bodies from URDF, SDF and other file formats. pybullet provides forward dynamics simulation, inverse dynamics computation, forward and inverse kinematics and collision detection and ray intersection queries. Aside from physics simulation, pybullet supports to rendering, with a CPU renderer and OpenGL visualization and support for virtual reality headsets.', url='https://github.com/bulletphysics/bullet3', From 0f8b8388a62e4baf9a3afed34ece7283dde9b470 Mon Sep 17 00:00:00 2001 From: bla Date: Tue, 2 Oct 2018 08:13:51 -0700 Subject: [PATCH 4/4] eglPlugin, one more fix, remove graphics instances at resetAll --- .../plugins/eglPlugin/eglRendererVisualShapeConverter.cpp | 1 + setup.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/SharedMemory/plugins/eglPlugin/eglRendererVisualShapeConverter.cpp b/examples/SharedMemory/plugins/eglPlugin/eglRendererVisualShapeConverter.cpp index 542196ff1..c1cabc93d 100644 --- a/examples/SharedMemory/plugins/eglPlugin/eglRendererVisualShapeConverter.cpp +++ b/examples/SharedMemory/plugins/eglPlugin/eglRendererVisualShapeConverter.cpp @@ -1265,6 +1265,7 @@ void EGLRendererVisualShapeConverter::resetAll() m_data->m_swRenderInstances.clear(); m_data->m_visualShapes.clear(); m_data->m_graphicsIndexToSegmentationMask.clear(); + m_data->m_instancingRenderer->removeAllInstances(); } void EGLRendererVisualShapeConverter::changeShapeTexture(int objectUniqueId, int jointIndex, int shapeIndex, int textureUniqueId) diff --git a/setup.py b/setup.py index aa939bfc1..9ceafeeb0 100644 --- a/setup.py +++ b/setup.py @@ -559,7 +559,7 @@ if 'BT_USE_EGL' in EGL_CXX_FLAGS: setup( name = 'pybullet', - version='2.2.7', + version='2.2.8', description='Official Python Interface for the Bullet Physics SDK specialized for Robotics Simulation and Reinforcement Learning', long_description='pybullet is an easy to use Python module for physics simulation, robotics and deep reinforcement learning based on the Bullet Physics SDK. With pybullet you can load articulated bodies from URDF, SDF and other file formats. pybullet provides forward dynamics simulation, inverse dynamics computation, forward and inverse kinematics and collision detection and ray intersection queries. Aside from physics simulation, pybullet supports to rendering, with a CPU renderer and OpenGL visualization and support for virtual reality headsets.', url='https://github.com/bulletphysics/bullet3',