Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preview is blank (black) with no errors #4359

Open
iansan5653 opened this issue Sep 20, 2022 · 16 comments
Open

Preview is blank (black) with no errors #4359

iansan5653 opened this issue Sep 20, 2022 · 16 comments

Comments

@iansan5653
Copy link

iansan5653 commented Sep 20, 2022

Hello! I'm not sure if this is a bug or if it's me doing something obviously wrong (hopefully it's my fault and it's easy to fix 😄).

I'm working on trying to get OpenSCAD running in a Codespace. If you're unfamiliar, Codespaces are essentially just lightweight virtual machines with built-in VSCode integration. I know this isn't an environment that you officially support, but I'm not completely sure if this problem is specific to Codespaces or not. I'm hoping it's just some missing graphics library that I need to install.

The Problem

OpenSCAD is running in the virtual environment and almost everything looks great, but the rendered preview pane is always a solid black rectangle:

Screenshot of OpenSCAD. A file is open, but the preview section of the window is solid black.

Nothing appears in the error log and the console looks completely normal:

OpenSCAD 2021.01
https://www.openscad.org/

Copyright (C) 2009-2021 The OpenSCAD Developers
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Loaded design '/workspaces/openscad-template/box.scad'.
Compiling design (CSG Tree generation)...
Compiling design (CSG Products generation)...
Geometries in cache: 1
Geometry cache size in bytes: 728
CGAL Polyhedrons in cache: 0
CGAL cache size in bytes: 0
Compiling design (CSG Products normalization)...
Normalized tree has 1 elements!
Compile and preview finished.
Total rendering time: 0:00:00.018

Here's my library & build info, collapsed for brevity:

Library and Build Information
OpenSCAD Version: 2021.01
System information: Linux 5.4.0-1090-azure #95~18.04.1-Ubuntu SMP Sun Aug 14 20:09:27 UTC 2022 x86_64 Debian GNU/Linux 11 (bullseye) 4 CPUs 7.77 GB RAM
User Agent: OpenSCAD/2021.01 (Linux x86_64; Debian GNU/Linux 11 (bullseye))
Compiler: GCC "10.2.1 20210110" 64bit
MinGW build: No
Debug build: No
Boost version: 1_74
Eigen version: 3.3.9
CGAL version, kernels: 5.2, Cartesian<Gmpq>, Extended_cartesian<Gmpq>, Epeck
OpenCSG version: OpenCSG 1.4.2
Qt version: 5.15.2
QScintilla version: 2.11.6
InputDrivers: 
GLib version: 2.66.4
lodepng version: 20180910
libzip version: 1.7.3
fontconfig version: 2.13.1
freetype version: 2.10.4
harfbuzz version: 2.7.4
cairo version: 1.16.0
lib3mf version: 1.8.1
Application Path: /usr/bin
Documents Path: /home/vscode/.local/share
User Documents Path: /home/vscode
Resource Path: /usr/share/openscad
User Library Path: 
User Config Path: /home/vscode/.config/OpenSCAD
Backup Path: 
OPENSCADPATH: <not set>
OpenSCAD library path:

/usr/share/openscad/libraries

OPENSCAD_FONT_PATH: <not set>
OpenSCAD font path:
/usr/share/fonts
/usr/local/share/fonts
/home/vscode/.local/share/fonts
/home/vscode/.fonts
/usr/share/fonts/X11
/usr/share/fonts/truetype
/usr/share/fonts/X11/encodings
/usr/share/fonts/X11/misc
/usr/share/fonts/X11/util
/usr/share/fonts/truetype/cascadia
/usr/share/fonts/truetype/dejavu
/usr/share/fonts/truetype/droid
/usr/share/fonts/truetype/noto
/usr/share/fonts/truetype/wqy
/usr/share/fonts/X11/encodings/large
/usr/share/fonts/truetype/cascadia/static
GLEW version: 2.1.0
OpenGL Version: 3.1 Mesa 20.3.5
GL Renderer: llvmpipe (LLVM 11.0.1, 256 bits)
GL Vendor: Mesa/X.org
RGBA(5650), depth(0), stencil(0)
GL_ARB_framebuffer_object: yes
GL_EXT_framebuffer_object: yes
GL_EXT_packed_depth_stencil: yes

Qt graphics widget: QOpenGLWidget
QSurfaceFormat: RGBA(5650), depth(0), stencil(0)

GL Extensions:
GL_AMD_conservative_depth
GL_AMD_draw_buffers_blend
GL_AMD_multi_draw_indirect
GL_AMD_query_buffer_object
GL_AMD_seamless_cubemap_per_texture
GL_AMD_shader_stencil_export
GL_AMD_shader_trinary_minmax
GL_AMD_texture_texture4
GL_ANGLE_texture_compression_dxt3
GL_ANGLE_texture_compression_dxt5
GL_APPLE_packed_pixels
GL_ARB_ES2_compatibility
GL_ARB_ES3_compatibility
GL_ARB_arrays_of_arrays
GL_ARB_base_instance
GL_ARB_blend_func_extended
GL_ARB_buffer_storage
GL_ARB_clear_buffer_object
GL_ARB_clear_texture
GL_ARB_clip_control
GL_ARB_color_buffer_float
GL_ARB_compatibility
GL_ARB_compressed_texture_pixel_storage
GL_ARB_compute_shader
GL_ARB_conditional_render_inverted
GL_ARB_conservative_depth
GL_ARB_copy_buffer
GL_ARB_copy_image
GL_ARB_cull_distance
GL_ARB_debug_output
GL_ARB_depth_buffer_float
GL_ARB_depth_clamp
GL_ARB_depth_texture
GL_ARB_derivative_control
GL_ARB_direct_state_access
GL_ARB_draw_buffers
GL_ARB_draw_buffers_blend
GL_ARB_draw_elements_base_vertex
GL_ARB_draw_indirect
GL_ARB_draw_instanced
GL_ARB_enhanced_layouts
GL_ARB_explicit_attrib_location
GL_ARB_explicit_uniform_location
GL_ARB_fragment_coord_conventions
GL_ARB_fragment_layer_viewport
GL_ARB_fragment_program
GL_ARB_fragment_program_shadow
GL_ARB_fragment_shader
GL_ARB_framebuffer_no_attachments
GL_ARB_framebuffer_object
GL_ARB_framebuffer_sRGB
GL_ARB_get_program_binary
GL_ARB_get_texture_sub_image
GL_ARB_half_float_pixel
GL_ARB_half_float_vertex
GL_ARB_indirect_parameters
GL_ARB_instanced_arrays
GL_ARB_internalformat_query
GL_ARB_internalformat_query2
GL_ARB_invalidate_subdata
GL_ARB_map_buffer_alignment
GL_ARB_map_buffer_range
GL_ARB_multi_bind
GL_ARB_multi_draw_indirect
GL_ARB_multisample
GL_ARB_multitexture
GL_ARB_occlusion_query
GL_ARB_occlusion_query2
GL_ARB_parallel_shader_compile
GL_ARB_pipeline_statistics_query
GL_ARB_pixel_buffer_object
GL_ARB_point_parameters
GL_ARB_point_sprite
GL_ARB_polygon_offset_clamp
GL_ARB_post_depth_coverage
GL_ARB_program_interface_query
GL_ARB_provoking_vertex
GL_ARB_query_buffer_object
GL_ARB_robust_buffer_access_behavior
GL_ARB_robustness
GL_ARB_sample_shading
GL_ARB_sampler_objects
GL_ARB_seamless_cube_map
GL_ARB_seamless_cubemap_per_texture
GL_ARB_separate_shader_objects
GL_ARB_shader_atomic_counter_ops
GL_ARB_shader_atomic_counters
GL_ARB_shader_bit_encoding
GL_ARB_shader_draw_parameters
GL_ARB_shader_group_vote
GL_ARB_shader_image_load_store
GL_ARB_shader_image_size
GL_ARB_shader_objects
GL_ARB_shader_stencil_export
GL_ARB_shader_storage_buffer_object
GL_ARB_shader_subroutine
GL_ARB_shader_texture_image_samples
GL_ARB_shader_texture_lod
GL_ARB_shading_language_100
GL_ARB_shading_language_420pack
GL_ARB_shading_language_include
GL_ARB_shading_language_packing
GL_ARB_shadow
GL_ARB_stencil_texturing
GL_ARB_sync
GL_ARB_texture_barrier
GL_ARB_texture_border_clamp
GL_ARB_texture_buffer_object
GL_ARB_texture_buffer_object_rgb32
GL_ARB_texture_buffer_range
GL_ARB_texture_compression
GL_ARB_texture_compression_bptc
GL_ARB_texture_compression_rgtc
GL_ARB_texture_cube_map
GL_ARB_texture_cube_map_array
GL_ARB_texture_env_add
GL_ARB_texture_env_combine
GL_ARB_texture_env_crossbar
GL_ARB_texture_env_dot3
GL_ARB_texture_float
GL_ARB_texture_gather
GL_ARB_texture_mirror_clamp_to_edge
GL_ARB_texture_mirrored_repeat
GL_ARB_texture_multisample
GL_ARB_texture_non_power_of_two
GL_ARB_texture_query_levels
GL_ARB_texture_query_lod
GL_ARB_texture_rectangle
GL_ARB_texture_rg
GL_ARB_texture_rgb10_a2ui
GL_ARB_texture_stencil8
GL_ARB_texture_storage
GL_ARB_texture_storage_multisample
GL_ARB_texture_swizzle
GL_ARB_texture_view
GL_ARB_timer_query
GL_ARB_transform_feedback2
GL_ARB_transform_feedback3
GL_ARB_transform_feedback_instanced
GL_ARB_transform_feedback_overflow_query
GL_ARB_transpose_matrix
GL_ARB_uniform_buffer_object
GL_ARB_vertex_array_bgra
GL_ARB_vertex_array_object
GL_ARB_vertex_attrib_binding
GL_ARB_vertex_buffer_object
GL_ARB_vertex_program
GL_ARB_vertex_shader
GL_ARB_vertex_type_10f_11f_11f_rev
GL_ARB_vertex_type_2_10_10_10_rev
GL_ARB_viewport_array
GL_ARB_window_pos
GL_ATI_blend_equation_separate
GL_ATI_draw_buffers
GL_ATI_fragment_shader
GL_ATI_separate_stencil
GL_ATI_texture_compression_3dc
GL_ATI_texture_env_combine3
GL_ATI_texture_float
GL_ATI_texture_mirror_once
GL_EXT_EGL_image_storage
GL_EXT_EGL_sync
GL_EXT_abgr
GL_EXT_bgra
GL_EXT_blend_color
GL_EXT_blend_equation_separate
GL_EXT_blend_func_separate
GL_EXT_blend_minmax
GL_EXT_blend_subtract
GL_EXT_compiled_vertex_array
GL_EXT_copy_texture
GL_EXT_direct_state_access
GL_EXT_draw_buffers2
GL_EXT_draw_instanced
GL_EXT_draw_range_elements
GL_EXT_fog_coord
GL_EXT_framebuffer_blit
GL_EXT_framebuffer_multisample
GL_EXT_framebuffer_multisample_blit_scaled
GL_EXT_framebuffer_object
GL_EXT_framebuffer_sRGB
GL_EXT_gpu_program_parameters
GL_EXT_gpu_shader4
GL_EXT_multi_draw_arrays
GL_EXT_packed_depth_stencil
GL_EXT_packed_float
GL_EXT_packed_pixels
GL_EXT_pixel_buffer_object
GL_EXT_point_parameters
GL_EXT_polygon_offset_clamp
GL_EXT_provoking_vertex
GL_EXT_rescale_normal
GL_EXT_secondary_color
GL_EXT_separate_specular_color
GL_EXT_shader_framebuffer_fetch_non_coherent
GL_EXT_shader_integer_mix
GL_EXT_shadow_funcs
GL_EXT_stencil_two_side
GL_EXT_stencil_wrap
GL_EXT_subtexture
GL_EXT_texture
GL_EXT_texture3D
GL_EXT_texture_array
GL_EXT_texture_buffer_object
GL_EXT_texture_compression_dxt1
GL_EXT_texture_compression_latc
GL_EXT_texture_compression_rgtc
GL_EXT_texture_compression_s3tc
GL_EXT_texture_cube_map
GL_EXT_texture_edge_clamp
GL_EXT_texture_env_add
GL_EXT_texture_env_combine
GL_EXT_texture_env_dot3
GL_EXT_texture_integer
GL_EXT_texture_lod_bias
GL_EXT_texture_mirror_clamp
GL_EXT_texture_object
GL_EXT_texture_rectangle
GL_EXT_texture_sRGB
GL_EXT_texture_sRGB_R8
GL_EXT_texture_sRGB_decode
GL_EXT_texture_shadow_lod
GL_EXT_texture_shared_exponent
GL_EXT_texture_snorm
GL_EXT_texture_swizzle
GL_EXT_timer_query
GL_EXT_transform_feedback
GL_EXT_vertex_array
GL_EXT_vertex_array_bgra
GL_IBM_multimode_draw_arrays
GL_IBM_rasterpos_clip
GL_IBM_texture_mirrored_repeat
GL_INGR_blend_func_separate
GL_KHR_blend_equation_advanced
GL_KHR_context_flush_control
GL_KHR_debug
GL_KHR_no_error
GL_KHR_parallel_shader_compile
GL_KHR_robust_buffer_access_behavior
GL_KHR_robustness
GL_KHR_texture_compression_astc_ldr
GL_KHR_texture_compression_astc_sliced_3d
GL_MESA_pack_invert
GL_MESA_shader_integer_functions
GL_MESA_texture_signed_rgba
GL_MESA_window_pos
GL_MESA_ycbcr_texture
GL_NV_blend_square
GL_NV_conditional_render
GL_NV_copy_depth_to_color
GL_NV_copy_image
GL_NV_depth_clamp
GL_NV_fog_distance
GL_NV_half_float
GL_NV_light_max_exponent
GL_NV_packed_depth_stencil
GL_NV_primitive_restart
GL_NV_texgen_reflection
GL_NV_texture_barrier
GL_NV_texture_env_combine4
GL_NV_texture_rectangle
GL_OES_EGL_image
GL_OES_read_format
GL_S3_s3tc
GL_SGIS_generate_mipmap
GL_SGIS_texture_border_clamp
GL_SGIS_texture_edge_clamp
GL_SGIS_texture_lod
GL_SUN_multi_draw_arrays

Reproducing

I'm running OpenSCAD 2021.01 on a Debian distribution using the following simple Dockerfile:

FROM mcr.microsoft.com/vscode/devcontainers/base:0-bullseye

RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
    && apt-get -y full-upgrade \
    && apt-get -y install --no-install-recommends openscad

I'm viewing the OpenSCAD window through the desktop-lite devcontainer feature, which adds a desktop environment to codespaces, powered by the Fluxbox window manager.

I've published this configuration as a repository, so this can be reproduced by following the "Getting started" section in that repository's README.

Please let me know if there is any more info I can provide!


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@t-paul
Copy link
Member

t-paul commented Sep 20, 2022

Getting only 404 on that repository, is it set to private?

@iansan5653
Copy link
Author

Fixed! Sorry about that

@iansan5653
Copy link
Author

iansan5653 commented Sep 20, 2022

I did see this issue which describes a similar problem, but I don't think it's the same underlying cause - I don't have OpenGL ES installed and I don't see an error in the error log.

@thehans
Copy link
Member

thehans commented Sep 20, 2022

The bits per channel in your library info are concerning to me, RGBA(5650), depth(0). I think all our code expects 8 bits per color channel, and at least some depth buffer. Not sure if that would cause this type of issue or not.

I've never messed with codespaces, but one thing that's always good to try with OpenGL issues like this, is if you can get output from any GL program, such as glxgears. If you can't, then it's likely a system config issue, and not OpenSCAD's fault ;)

@iansan5653
Copy link
Author

iansan5653 commented Sep 20, 2022

I ran glxgears (after installing mesa-utils) and it seems to run fine (at 1500 fps 👀), so it doesn't look like a system issue:

Screenshot of glxgears running in front of OpenSCAD.

I'm not sure how/if I can configure the color depth but I'll look into that.

@t-paul
Copy link
Member

t-paul commented Sep 20, 2022

Yeah, I was wondering about the 565 color support. We do need depth and stencil buffers, but that reporting seems unreliable. On my local machine (Dell XPS 13 running Debian/Testing) I'm getting:

GLEW version: 2.2.0
OpenGL Version: 4.6 (Compatibility Profile) Mesa 22.2.0-rc3
GL Renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2)
GL Vendor: Intel RGBA(8880), depth(0), stencil(0)
GL_ARB_framebuffer_object: yes
GL_EXT_framebuffer_object: yes
GL_EXT_packed_depth_stencil: yes

Qt graphics widget: QOpenGLWidget
QSurfaceFormat: RGBA(8880), depth(0), stencil(0)

But with completely black screen, it's more likely a context issue. I suspect it's selecting a 3.1 forward compatible / core profile but we need the compatiblity for the ancient fixed pipeline stuff.

Maybe try running with:

MESA_DEBUG=context MESA_GL_VERSION_OVERRIDE=3.1COMPAT openscad

That should select the compat profile and output issues setting up the context.

@iansan5653
Copy link
Author

Maybe try running with:

MESA_DEBUG=context MESA_GL_VERSION_OVERRIDE=3.1COMPAT openscad

No dice there 😞. I don't see any difference at all in UI, console output, or library & build info.

@t-paul
Copy link
Member

t-paul commented Sep 20, 2022

Hmm, and with even more variables added (second one probably not needed):

GALLIUM_DRIVER=softpipe LIBGL_ALWAYS_SOFTWARE=true

That might make everything extremely slow with the softpipe rendering but just to see if it makes a difference. Not having high hopes though as llvmpipe is usually quite good nowadays and I have no idea if they maybe even share the context setup code.

@iansan5653
Copy link
Author

iansan5653 commented Sep 20, 2022

Still no change with all four arguments. The rendering time is much slower (around 1.25s instead of around 0.25 seconds) but nothing appears still.


Small note - I realized in my original issue description and in the repo I wrote Debian buster instead of bullseye, but my screenshots & logs have been from bullseye (otherwise they'd be from the old 2019 version of OpenSCAD). I've fixed that now by changing the version to the latest, bullseye.

The issue does also happen on Debian buster / OpenSCAD 2019.


Just while playing with things, I did also try combining the vscode image with the openscad image like this:

FROM openscad/openscad
FROM mcr.microsoft.com/vscode/devcontainers/base:0-bullseye

But no luck there either; I'm not sure that did anything at all.

@iansan5653
Copy link
Author

Any other ideas I could try before I give up on this?

Is there a document with all of the environment variable options anywhere? I could just work through them and try anything that might affect it.

Or is there any way to get more detailed logging output? I feel like if I could just find one clue as to why this is happening, I might be able to figure it out. But I have absolutely no idea at this point.

@t-paul
Copy link
Member

t-paul commented Sep 22, 2022

That's all Mesa settings, full list can be found at https://docs.mesa3d.org/envvars.html

I'm not sure if there's any additional Qt setup possible, but that likely needs code changes. OpenSCAD itself has no options for tuning the OpenGL context creation.

As that's mostly driver interaction, I don't know if there's additional log possible other than what the Mesa environment variables enable. A more complicated by much more detailed trace would be possible using tools like renderdoc which follows all OpenGL calls.

I don't see that I have any access to codespaces. Maybe there's some way to do this locally but that might be more time consuming than what I can manage currently. Or is there dedicated documentation on mirroring the whole setup locally? I did run OpenSCAD via novnc docker container a while ago and that worked without problems.

@iansan5653
Copy link
Author

iansan5653 commented Sep 22, 2022

Thanks! That link at least gives me something else to play with.

I don't see that I have any access to codespaces. Maybe there's some way to do this locally but that might be more time consuming than what I can manage currently. Or is there dedicated documentation on mirroring the whole setup locally?

I'm sorry, I forgot Codespaces is still in limited access beta. I'm a GitHub employee so I may be able to get you access, but I'm not 100% sure as I'm not on that team. Working on it!

It's also possible to run locally (and I was able to reproduce with this method), although I totally understand you may not have the time:

  1. Install Docker Desktop on your machine and start it so it's running in the background
  2. Install VSCode and the Remote - Containers extension (vscode-remote.remote-containers)
  3. Clone the repo locally (https://github.com/iansan5653/openscad-template.git) and open it in VSCode
  4. When you open the repo, you may be prompted by the extension since there's a devcontainer configuration - if so, click "Reopen in container". If not prompted, run the VSCode command "Remote-Containers: Reopen in container"
  5. You'll now be in the same environment that you would be if you were running a Codespace and can follow the instructions in the repo's readme to get started. Copying here for reference:
    1. View the virtual desktop in your browser at http://localhost:6080/
    2. Sign in with password vscode
    3. Back in VSCode, open box.scad and press the "Preview in OpenSCAD" button in the top-right (same icon as the preview button in OpenSCAD)
    4. The OpenSCAD window should appear on the virtual desktop in your browser. Editing box.scad in VSCode will automatically update the file in the OpenSCAD application

@iansan5653
Copy link
Author

iansan5653 commented Sep 22, 2022

@t-paul You should have access now! You should be able to see a "Codespaces" tab in the Code dropdown on the repo:

Screenshot of the Codespaces tab inside the Code menu for a repo

@iansan5653
Copy link
Author

The only thing I've been able to find so far from playing with the environment variables is if I enable LIBGL_DEBUG=verbose, I see the following:

libGL: MESA-LOADER: dlopen(/usr/lib/aarch64-linux-gnu/dri/swrast_dri.so)
libGL: Can't open configuration file /etc/drirc: No such file or directory.
libGL: Can't open configuration file /home/vscode/.drirc: No such file or directory.

But as far as I can tell, that doesn't look like a critical issue that would cause this problem.

@t-paul
Copy link
Member

t-paul commented Sep 23, 2022

Yes, I think the errors are not concerning. I'm a bit surprised about the AARCH64. Are those 64-bit ARM machines running the code spaces? I'm able to start the codespace now (Thanks!) but did not check that. It should not be a no-go for OpenSCAD though, I have OpenSCAD running on 64-bit RaspiOS just fine.

@iansan5653
Copy link
Author

I'm a bit surprised about the AARCH64. Are those 64-bit ARM machines running the code spaces?

This is using Docker Desktop on an M1 Max MacBook Pro. In Codespaces it's different:

libGL: MESA-LOADER: dlopen(/usr/lib/x86_64-linux-gnu/dri/swrast_dri.so)
libGL: Can't open configuration file /etc/drirc: No such file or directory.
libGL: Can't open configuration file /home/vscode/.drirc: No such file or directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants