Skip to content

Commit

Permalink
[viewer] Disable physics-based shader is no dedicated GPU. (#448)
Browse files Browse the repository at this point in the history
Co-authored-by: Alexis Duburcq <alexis.duburcq@wandercraft.eu>
  • Loading branch information
duburcqa and Alexis Duburcq authored Nov 16, 2021
1 parent abbf037 commit d105d20
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions python/jiminy_py/src/jiminy_py/viewer/panda3d/panda3d_visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,18 +301,23 @@ def __init__(self, config) -> None:
self.render.set_antialias(
AntialiasAttrib.M_auto | AntialiasAttrib.M_faster)

# Configure the shader
shader_options = {
'MAX_LIGHTS': 2,
'USE_NORMAL_MAP': '',
'ENABLE_SHADOWS': '',
'USE_OCCLUSION_MAP': ''
}
pbr_vert = simplepbr._load_shader_str('simplepbr.vert', shader_options)
pbr_frag = simplepbr._load_shader_str('simplepbr.frag', shader_options)
pbrshader = Shader.make(
Shader.SL_GLSL, vertex=pbr_vert, fragment=pbr_frag)
self.render.set_attrib(ShaderAttrib.make(pbrshader))
# Configure the physics-based shader if dedicated NVIDIA GPU is used
if self.win.gsg.driver_vendor.startswith('NVIDIA'):
shader_options = {
'MAX_LIGHTS': 2,
'USE_NORMAL_MAP': '',
'ENABLE_SHADOWS': '',
'USE_OCCLUSION_MAP': ''
}
pbr_vert = simplepbr._load_shader_str(
'simplepbr.vert', shader_options)
pbr_frag = simplepbr._load_shader_str(
'simplepbr.frag', shader_options)
pbrshader = Shader.make(
Shader.SL_GLSL, vertex=pbr_vert, fragment=pbr_frag)
self.render.set_attrib(ShaderAttrib.make(pbrshader))
else:
self.render.set_shader_auto()

# Define default camera pos
self._camera_defaults = CAMERA_POS_DEFAULT
Expand Down

0 comments on commit d105d20

Please sign in to comment.