MPI-IS / mesh

MPI-IS Mesh Processing Library
Other
643 stars 147 forks source link

Check for OpenGL before running meshviewer #79

Open excalamus opened 1 year ago

excalamus commented 1 year ago

Previously, the command would dispatch regardless of the OpenGL status. In cases where OpenGL was unavailable, the process would continue, start the client, and then run into an OpenGL error. End-users would sometimes not be informed of errors.

This change checks for OpenGL prior to dispatch, alerting the user of any errors.

excalamus commented 1 year ago

I noticed there exist several issues related to end-users running meshviewer viewer and not seeing the window. Issues include: #63, #57, #44, #78, and #75.

AntiLibrary5 commented 10 months ago

I noticed there exist several issues related to end-users running meshviewer viewer and not seeing the window. Issues include: #63, #57, #44, #78, and #75.

Your insight here made it work for me. https://github.com/MPI-IS/mesh/issues/63#issuecomment-1356016599

There are a bunch of things you need to get right. But having the nvidia drivers is one of them. Finally using a nvidia/cudagl base image (instead of a base python image) made it work for me.

For ref for others (assuming psbody mesh repo in pwd):

FROM nvidia/cudagl:11.4.0-runtime-ubuntu20.04

# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
ENV __GLVND_DISALLOW_PATCHING 1
# Env vars for the nvidia-container-runtime.
ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES graphics,utility,compute

# Set the working directory
WORKDIR /home

# Install any python packages you need
COPY . .

RUN apt-get update -q && apt-get install -y -qq x11-apps python3-pip python3-dev python3-opencv freeglut3-dev

RUN pip install --upgrade pip && \
    pip install --no-cache-dir -r requirements.txt && \
    pip install PyOpenGL==3.1.1a1 && \
    cd ./mesh && \
    make all && \
    cd .. && \

Build the image as follows:

docker run -it -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --name <NAME> <IMAGE> bash

In the container try running:

xclock
meshviewer open

Hope it helps. Best.