Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Mujoco Py
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Hollenstein
Mujoco Py
Commits
649d964d
Commit
649d964d
authored
5 years ago
by
A Ray
Committed by
Million Integrals
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
add option to suppress printing when creating context (#377)
parent
41a5fc26
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
mujoco_py/mjrendercontext.pyx
+4
-4
4 additions, 4 deletions
mujoco_py/mjrendercontext.pyx
mujoco_py/opengl_context.pyx
+7
-5
7 additions, 5 deletions
mujoco_py/opengl_context.pyx
with
11 additions
and
9 deletions
mujoco_py/mjrendercontext.pyx
+
4
−
4
View file @
649d964d
...
...
@@ -40,9 +40,9 @@ cdef class MjRenderContext(object):
mjv_defaultOption
(
&
self
.
_vopt
)
mjr_defaultContext
(
&
self
.
_con
)
def
__init__
(
self
,
MjSim
sim
,
bint
offscreen
=
True
,
int
device_id
=-
1
,
opengl_backend
=
None
):
def
__init__
(
self
,
MjSim
sim
,
bint
offscreen
=
True
,
int
device_id
=-
1
,
opengl_backend
=
None
,
quiet
=
False
):
self
.
sim
=
sim
self
.
_setup_opengl_context
(
offscreen
,
device_id
,
opengl_backend
)
self
.
_setup_opengl_context
(
offscreen
,
device_id
,
opengl_backend
,
quiet
=
quiet
)
self
.
offscreen
=
offscreen
# Ensure the model data has been updated so that there
...
...
@@ -92,13 +92,13 @@ cdef class MjRenderContext(object):
raise
RuntimeError
(
'
Window rendering not supported
'
)
self
.
con
=
WrapMjrContext
(
&
self
.
_con
)
def
_setup_opengl_context
(
self
,
offscreen
,
device_id
,
opengl_backend
):
def
_setup_opengl_context
(
self
,
offscreen
,
device_id
,
opengl_backend
,
quiet
=
False
):
if
opengl_backend
is
None
and
(
not
offscreen
or
sys
.
platform
==
'
darwin
'
):
# default to glfw for onscreen viewing or mac (both offscreen/onscreen)
opengl_backend
=
'
glfw
'
if
opengl_backend
==
'
glfw
'
:
self
.
opengl_context
=
GlfwContext
(
offscreen
=
offscreen
)
self
.
opengl_context
=
GlfwContext
(
offscreen
=
offscreen
,
quiet
=
quiet
)
else
:
if
device_id
<
0
:
if
"
GPUS
"
in
os
.
environ
:
...
...
This diff is collapsed.
Click to expand it.
mujoco_py/opengl_context.pyx
+
7
−
5
View file @
649d964d
...
...
@@ -40,12 +40,12 @@ class GlfwContext(OpenGLContext):
_INIT_HEIGHT
=
1000
_GLFW_IS_INITIALIZED
=
False
def
__init__
(
self
,
offscreen
=
False
):
def
__init__
(
self
,
offscreen
=
False
,
quiet
=
False
):
GlfwContext
.
_init_glfw
()
self
.
_width
=
self
.
_INIT_WIDTH
self
.
_height
=
self
.
_INIT_HEIGHT
self
.
window
=
self
.
_create_window
(
offscreen
)
self
.
window
=
self
.
_create_window
(
offscreen
,
quiet
=
quiet
)
self
.
_set_window_size
(
self
.
_width
,
self
.
_height
)
@staticmethod
...
...
@@ -73,14 +73,16 @@ class GlfwContext(OpenGLContext):
self
.
_width
=
width
self
.
_height
=
height
def
_create_window
(
self
,
offscreen
):
def
_create_window
(
self
,
offscreen
,
quiet
=
False
):
if
offscreen
:
print
(
"
Creating offscreen glfw
"
)
if
not
quiet
:
print
(
"
Creating offscreen glfw
"
)
glfw
.
window_hint
(
glfw
.
VISIBLE
,
0
)
glfw
.
window_hint
(
glfw
.
DOUBLEBUFFER
,
0
)
init_width
,
init_height
=
self
.
_INIT_WIDTH
,
self
.
_INIT_HEIGHT
else
:
print
(
"
Creating window glfw
"
)
if
not
quiet
:
print
(
"
Creating window glfw
"
)
glfw
.
window_hint
(
glfw
.
SAMPLES
,
4
)
glfw
.
window_hint
(
glfw
.
VISIBLE
,
1
)
glfw
.
window_hint
(
glfw
.
DOUBLEBUFFER
,
1
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment