Rename tinyRenderer -> eglRenderer in the eglRendererPlugin.
Allow to run the eglRendererPlugin to run on Windows (not in EGL mode but Win32OpenGLWindow mode)
Here is a script I tested on Windows:
~~~~~~~~~~~~
mport pybullet as p
import time
p.connect(p.DIRECT)
plugin = p.loadPlugin("e:/develop/bullet3/bin/pybullet_eglRendererPlugin_vs2010_x64_debug.dll","_eglRendererPlugin")
print("plugin=",plugin)
p.setGravity(0,0,-10)
p.loadURDF("plane.urdf",[0,0,-1])
p.loadURDF("r2d2.urdf")
pixelWidth = 320
pixelHeight = 220
while (1):
p.stepSimulation()
viewMatrix = [1.0, 0.0, -0.0, 0.0, -0.0, 0.1736481785774231, -0.9848078489303589, 0.0, 0.0, 0.9848078489303589, 0.1736481785774231, 0.0, -0.0, -5.960464477539063e-08, -4.0, 1.0]
projectionMatrix = [1.0825318098068237, 0.0, 0.0, 0.0, 0.0, 1.732050895690918, 0.0, 0.0, 0.0, 0.0, -1.0002000331878662, -1.0, 0.0, 0.0, -0.020002000033855438, 0.0]
#img_arr = p.getCameraImage(pixelWidth, pixelHeight, viewMatrix,projectionMatrix, shadow=1,lightDirection=[1,1,1])#,renderer=pybullet.ER_BULLET_HARDWARE_OPENGL)
img_arr = p.getCameraImage(pixelWidth, pixelHeight, shadow=1,lightDirection=[1,1,1])#,renderer=pybullet.ER_BULLET_HARDWARE_OPENGL)
#print("img_arr=",img_arr)
time.sleep(1)
~~~~~~~~~~~~~
65 lines
2.7 KiB
C
65 lines
2.7 KiB
C
#ifndef EGL_RENDERER_VISUAL_SHAPE_CONVERTER_H
|
|
#define EGL_RENDERER_VISUAL_SHAPE_CONVERTER_H
|
|
|
|
#include "../../../Importers/ImportURDFDemo/UrdfRenderingInterface.h"
|
|
|
|
struct EGLRendererVisualShapeConverter : public UrdfRenderingInterface
|
|
{
|
|
|
|
struct EGLRendererVisualShapeConverterInternalData* m_data;
|
|
|
|
EGLRendererVisualShapeConverter();
|
|
|
|
virtual ~EGLRendererVisualShapeConverter();
|
|
|
|
virtual void convertVisualShapes(int linkIndex, const char* pathPrefix, const btTransform& localInertiaFrame, const UrdfLink* linkPtr, const UrdfModel* model, int shapeUid, int objectIndex);
|
|
|
|
virtual int getNumVisualShapes(int bodyUniqueId);
|
|
|
|
virtual int getVisualShapesData(int bodyUniqueId, int shapeIndex, struct b3VisualShapeData* shapeData);
|
|
|
|
virtual void changeRGBAColor(int bodyUniqueId, int linkIndex, int shapeIndex, const double rgbaColor[4]);
|
|
|
|
virtual void changeShapeTexture(int objectUniqueId, int linkIndex, int shapeIndex, int textureUniqueId);
|
|
|
|
virtual void removeVisualShape(int shapeUid);
|
|
|
|
virtual void setUpAxis(int axis);
|
|
|
|
virtual void resetCamera(float camDist, float yaw, float pitch, float camPosX,float camPosY, float camPosZ);
|
|
|
|
virtual void clearBuffers(struct TGAColor& clearColor);
|
|
|
|
virtual void resetAll();
|
|
|
|
virtual void getWidthAndHeight(int& width, int& height);
|
|
virtual void setWidthAndHeight(int width, int height);
|
|
virtual void setLightDirection(float x, float y, float z);
|
|
virtual void setLightColor(float x, float y, float z);
|
|
virtual void setLightDistance(float dist);
|
|
virtual void setLightAmbientCoeff(float ambientCoeff);
|
|
virtual void setLightDiffuseCoeff(float diffuseCoeff);
|
|
virtual void setLightSpecularCoeff(float specularCoeff);
|
|
virtual void setShadow(bool hasShadow);
|
|
virtual void setFlags(int flags);
|
|
|
|
virtual void copyCameraImageData(unsigned char* pixelsRGBA, int rgbaBufferSizeInPixels, float* depthBuffer, int depthBufferSizeInPixels,int* segmentationMaskBuffer, int segmentationMaskSizeInPixels, int startPixelIndex, int* widthPtr, int* heightPtr, int* numPixelsCopied);
|
|
void copyCameraImageDataGL(unsigned char* pixelsRGBA, int rgbaBufferSizeInPixels, float* depthBuffer, int depthBufferSizeInPixels,int* segmentationMaskBuffer, int segmentationMaskSizeInPixels, int startPixelIndex, int* widthPtr, int* heightPtr, int* numPixelsCopied);
|
|
|
|
virtual void render();
|
|
virtual void render(const float viewMat[16], const float projMat[16]);
|
|
|
|
virtual int loadTextureFile(const char* filename);
|
|
virtual int registerTexture(unsigned char* texels, int width, int height);
|
|
|
|
|
|
|
|
virtual void syncTransform(int shapeUid, const class btTransform& worldTransform, const class btVector3& localScaling);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif //EGL_RENDERER_VISUAL_SHAPE_CONVERTER_H
|