tsugite icon indicating copy to clipboard operation
tsugite copied to clipboard

PaintGL and GLWidget

Open stuffnex opened this issue 3 years ago • 14 comments

Hello, first of all thanks for your job. It's amazing and I can't wait to test it and realize something out of it. Unfortunately I have an issue: The program runs: the interface opens but on display remain white and nothing appear, in the terminal I have this error:

Traceback (most recent call last):
  File "Tsugite_app.py", line 92, in paintGL
    self.display.update()
AttributeError: 'GLWidget' object has no attribute 'display'

All the dependency looks satisfied. I didn't find any content on forums so here I am.

I using Ubuntu 20.04.1 LTS, 64-bit. Thanks for your time

stuffnex avatar Oct 22 '20 00:10 stuffnex

Dear Stuffnex, Great to hear that you are testing it out! I am using windows 10, and it works. Unfortunately, I do not know the answer to your question. If you find an answer, maybe post it here as it might be of interest for others. Otherwise, maybe try running the code on Windows 10 (or the executable file available for download from the project website, also for Windows 10). Hope it works out. /Maria

marialarsson avatar Oct 22 '20 02:10 marialarsson

I had the same issue in my laptop, but it runs well in my desktop, only difference is my desktop has a dedicated GPU I don't know if it makes sense to you

dvdrbls avatar Oct 22 '20 13:10 dvdrbls

Interesting..... I honestly don't know anything about how computer hardware might effect the program. It is also hard for me to debug this issue, because it works on my computer (both laptop and desktop).

One thing I would suspect as a possible reason is that there are different installation modes of opengl (https://pypi.org/project/PyOpenGL/).

$ pip install PyOpenGL PyOpenGL_accelerate $ pip install PyOpenGL ... (maybe others)

If anybody finds a solution, please post it here to help other people with the same issue!

marialarsson avatar Oct 22 '20 13:10 marialarsson

I did install the ones you mention, and this happens, also noted the one use in my desktop is the executable, haven't tried to run the code

C:\Users\Dell\Desktop\tsugite\setup>pip3 install PyOpenGL PyOpenGL_accelerate Requirement already satisfied: PyOpenGL in c:\python38\lib\site-packages (3.1.5) Collecting PyOpenGL_accelerate Downloading PyOpenGL_accelerate-3.1.5-cp38-cp38-win_amd64.whl (340 kB) |████████████████████████████████| 340 kB 656 kB/s Installing collected packages: PyOpenGL-accelerate Successfully installed PyOpenGL-accelerate-3.1.5

C:\Users\Dell\Desktop\tsugite\setup>pip3 install PyOpenGL Requirement already satisfied: PyOpenGL in c:\python38\lib\site-packages (3.1.5)

C:\Users\Dell\Desktop\tsugite\setup>python3 tsugite_app.py Unable to load numpy_formathandler accelerator from OpenGL_accelerate Traceback (most recent call last): File "tsugite_app.py", line 74, in initializeGL self.display = Display(self,self.type) File "C:\Users\Dell\Desktop\tsugite\setup\Display.py", line 12, in init self.create_color_shaders() File "C:\Users\Dell\Desktop\tsugite\setup\Display.py", line 53, in create_color_shaders self.shader_col = OpenGL.GL.shaders.compileProgram(OpenGL.GL.shaders.compileShader(vertex_shader, GL_VERTEX_SHADER), File "C:\Python38\lib\site-packages\OpenGL\GL\shaders.py", line 235, in compileShader raise ShaderCompilationError( OpenGL.GL.shaders.ShaderCompilationError: ('Shader compile failure (0): b"ERROR: 0:4: '#extension' : 'GL_ARB_explicit_uniform_location' is not supported\nERROR: 0:8: 'location layout qualifier' : not supported \nERROR: 0:9: 'location layout qualifier' : not supported \nERROR: 0:10: 'location layout qualifier' : not supported \nERROR: 0:15: 'transform' : undeclared identifier \nERROR: 0:15: 'translate' : undeclared identifier \nERROR: 0:15: 'position' : undeclared identifier \nERROR: 0:15: 'constructor' : not enough data provided for construction \nERROR: 0:16: 'newColor' : undeclared identifier \nERROR: 0:16: 'myColor' : undeclared identifier \nERROR: 0:17: 'outTexCoords' : undeclared identifier \nERROR: 0:17: 'inTexCoords' : undeclared identifier \n\n"', [b'\n #version 330\n #extension GL_ARB_explicit_attrib_location : require\n #extension GL_ARB_explicit_uniform_location : require\n layout(location = 0) in vec3 position;\n layout(location = 1) in vec3 color;\n layout(location = 2) in vec2 inTexCoords;\n layout(location = 3) uniform mat4 transform;\n layout(location = 4) uniform mat4 translate;\n layout(location = 5) uniform vec3 myColor;\n out vec3 newColor;\n out vec2 outTexCoords;\n void main()\n {\n gl_Position = transform* translate* vec4(position, 1.0f);\n newColor = myColor;\n outTexCoords = inTexCoords;\n }\n '], GL_VERTEX_SHADER)

dvdrbls avatar Oct 22 '20 14:10 dvdrbls

hmm.. maybe the issue is that I have a variable called "display" and "Display" (with a capital D) is already a taken name by opengl. I will change the name of my variable to see if that helps... Ill let you know when it is done.

marialarsson avatar Oct 22 '20 14:10 marialarsson

I pushed the changes. But I am not sure it will make a difference...

marialarsson avatar Oct 22 '20 14:10 marialarsson

Just to double check versions... pip show pyopengl (command line) gives this result. Do you have the same installation of PyOpenGl?

Name: PyOpenGL Version: 3.1.5 Summary: Standard OpenGL bindings for Python Home-page: http://pyopengl.sourceforge.net Author: Mike C. Fletcher Author-email: [email protected] License: BSD

marialarsson avatar Oct 22 '20 14:10 marialarsson

Yes is the same

C:\Users\Dell\Desktop\tsugite-master\setup>pip3 show pyopengl Name: PyOpenGL Version: 3.1.5 Summary: Standard OpenGL bindings for Python Home-page: http://pyopengl.sourceforge.net Author: Mike C. Fletcher Author-email: [email protected] License: BSD Location: c:\python38\lib\site-packages Requires: Required-by:

dvdrbls avatar Oct 22 '20 14:10 dvdrbls

Hi, I have an update. I made some tests, updated all the requirements up to the right version and downloaded the new code.

I believe we're on the right way. Maybe because linux is case-sensitive? Now I have another error, with same effect on the UI, I can see a pattern in here: might be another capital letter in a variable like "d/Display"?

Traceback (most recent call last): File "Tsugite_app.py", line 92, in paintGL self.show.update() AttributeError: 'builtin_function_or_method' object has no attribute 'update'

Might it be a good lead? Thank you!

for reference:

$ uname -a
Linux b1d0n3 5.4.0-52-generic #57-Ubuntu SMP Thu Oct 15 10:57:00 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
$ sudo lshw -short
H/W path         Device     Class          Description
======================================================
                            system         20B3001XIX (LENOVO_MT_20B3_BU_Think_FM_ThinkPad S5-S540)
/0                          bus            20B3001XIX
/0/0                        processor      Intel(R) Core(TM) i5-4200U CPU @ 1.60GHz
/0/0/2                      memory         32KiB L1 cache
/0/0/3                      memory         256KiB L2 cache
/0/0/4                      memory         3MiB L3 cache
/0/1                        memory         32KiB L1 cache
/0/5                        memory         8GiB System Memory
/0/5/0                      memory         8GiB SODIMM DDR3 Synchronous 1600 MHz (0,6 ns)
/0/5/1                      memory         DIMM [empty]
/0/44                       memory         128KiB BIOS
/0/100                      bridge         Haswell-ULT DRAM Controller
/0/100/2                    display        Haswell-ULT Integrated Graphics Controller
/0/100/3                    multimedia     Haswell-ULT HD Audio Controller
/0/100/14                   bus            8 Series USB xHCI HC
/0/100/14/0      usb2       bus            xHCI Host Controller
/0/100/14/0/2               input          USB Optical Mouse
/0/100/14/0/4               communication  Bluetooth wireless interface
/0/100/14/0/5               input          Synaptics Large Touch Screen
/0/100/14/0/6               multimedia     Integrated Camera
/0/100/14/0/7               generic        VFS5011 Fingerprint Reader
/0/100/14/1      usb3       bus            xHCI Host Controller
/0/100/16                   communication  8 Series HECI #0
/0/100/1b                   multimedia     8 Series HD Audio Controller
/0/100/1c                   bridge         8 Series PCI Express Root Port 1
/0/100/1c.1                 bridge         8 Series PCI Express Root Port 2
/0/100/1c.1/0    enp3s0     network        RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
/0/100/1c.2                 bridge         8 Series PCI Express Root Port 3
/0/100/1c.2/0    wlp4s0     network        Wireless 7260
/0/100/1c.3                 bridge         8 Series PCI Express Root Port 4
/0/100/1c.3/0               generic        RTS5227 PCI Express Card Reader
/0/100/1d                   bus            8 Series USB EHCI #1
/0/100/1d/1      usb1       bus            EHCI Host Controller
/0/100/1d/1/1               bus            USB hub
/0/100/1f                   bridge         8 Series LPC Controller
/0/100/1f.2      scsi0      storage        8 Series SATA Controller 1 [AHCI mode]
/0/100/1f.2/0    /dev/sda   disk           480GB KINGSTON SA400S3
/0/100/1f.2/0/1             volume         511MiB Windows FAT volume
/0/100/1f.2/0/2  /dev/sda2  volume         446GiB EXT4 volume
/0/100/1f.2/1    /dev/sdb   disk           16GB LITEONIT LSS-16L
/0/100/1f.2/1/1  /dev/sdb1  volume         9215MiB Windows NTFS volume
/0/100/1f.2/1/2  /dev/sdb2  volume         512MiB Windows FAT volume
/0/100/1f.2/1/3  /dev/sdb3  volume         5542MiB EXT4 volume
/0/100/1f.3                 bus            8 Series SMBus Controller
/0/2                        system         PnP device PNP0c02
/0/3                        system         PnP device PNP0b00
/0/4                        generic        PnP device INT3f0d
/0/6                        input          PnP device PNP0303
/0/7                        generic        PnP device LEN2000
/0/8                        system         PnP device PNP0c02
/0/9                        system         PnP device PNP0c31
/1                          power          45N1165
$ lscpu
Architecture:                    x86_64
CPU op-mode(s):                  32-bit, 64-bit
Byte Order:                      Little Endian
Address sizes:                   39 bits physical, 48 bits virtual
CPU(s):                          4
On-line CPU(s) list:             0-3
Thread(s) per core:              2
Core(s) per socket:              2
Socket(s):                       1
NUMA node(s):                    1
Vendor ID:                       GenuineIntel
CPU family:                      6
Model:                           69
Model name:                      Intel(R) Core(TM) i5-4200U CPU @ 1.60GHz
Stepping:                        1
CPU MHz:                         1108.561
CPU max MHz:                     2600,0000
CPU min MHz:                     800,0000
BogoMIPS:                        4589.33
Virtualization:                  VT-x
L1d cache:                       64 KiB
L1i cache:                       64 KiB
L2 cache:                        512 KiB
L3 cache:                        3 MiB
NUMA node0 CPU(s):               0-3
Vulnerability Itlb multihit:     KVM: Mitigation: Split huge pages
Vulnerability L1tf:              Mitigation; PTE Inversion; VMX conditional cache flushes, SMT vulnerable
Vulnerability Mds:               Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Meltdown:          Mitigation; PTI
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1:        Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:        Mitigation; Full generic retpoline, IBPB conditional, IBRS_FW, STIBP conditional, RSB filling
Vulnerability Srbds:             Mitigation; Microcode
Vulnerability Tsx async abort:   Not affected
Flags:                           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmo
                                 n pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt
                                  tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_a
                                 djust bmi1 avx2 smep bmi2 erms invpcid xsaveopt dtherm ida arat pln pts md_clear flush_l1d

stuffnex avatar Oct 22 '20 18:10 stuffnex

Well here is your problem from one error:

OpenGL.GL.shaders.ShaderCompilationError: ('Shader compile failure (0): b"ERROR: 0:4: '#extension' : 'GL_ARB_explicit_uniform_location' is not supported

If this from your laptop, it's gpu may not support the features needed by a shader. This would explain why a discrete desktop gpu worked.

DanielJoyce avatar Oct 27 '20 16:10 DanielJoyce

@stuffnex

Could you try now my fork? I have made some changes and it works well for me on Linux (blackPanther OS).

ghost avatar Nov 05 '20 00:11 ghost

@hmikihth, thank you for your work, unfortunately I still have the same output as before:

AttributeError: 'builtin_function_or_method' object has no attribute 'view'
Traceback (most recent call last):
  File "Tsugite_app.py", line 92, in paintGL
    self.show.update()
AttributeError: 'builtin_function_or_method' object has no attribute 'update'
Traceback (most recent call last):
  File "Tsugite_app.py", line 182, in mouseMoveEvent
    if self.show.view.dragged:
AttributeError: 'builtin_function_or_method' object has no attribute 'view'
Traceback (most recent call last):
  File "Tsugite_app.py", line 182, in mouseMoveEvent

Again, UI loads in no time tho the frame where the joint should be displayed is blank see this screenshot if might help... I was so excited for this app.. It's a pain to not make it work on my laptop..

Thank you all for your support, please come ahead if you have insights!

stuffnex avatar Nov 10 '20 09:11 stuffnex

Hi, I see the line numbers are not the same, so that was not my fork. I guess you do not have the hashbang (#!/usr/bin/env python3) in the first line, and maybe you started it with python2 instead of python3.

How did you start the script?

python tsugite_app.py

OR

python3 tsugite_app.py

OR

./tsugite_app.py

And did you try it in virtualenv?

ghost avatar Nov 10 '20 09:11 ghost

Linux build for container exposing the app through the browser (no hardware acceleration, "softpipe" rendering) works around hardware issues with graphics drivers at the cost of slower rendering, see https://github.com/marialarsson/tsugite/pull/25.

mskyttner avatar Dec 13 '21 08:12 mskyttner