angeloskath / simple-3dviz

A library for 3D visualization with moderngl
http://simple-3dviz.com/
Other
133 stars 22 forks source link

TexturedMesh() error #9

Closed JackW987 closed 2 years ago

JackW987 commented 2 years ago

when I want to add some mesh to my scene,I get this error.Maybe my modernGL version is wrong? the enviroment: wxpython=4.1.1,moderngl=5.6.4

Traceback (most recent call last): File "preprocess_data.py", line 278, in main(sys.argv[1:]) File "preprocess_data.py", line 268, in main render( File "/home/wj/my_pro/atiss/scripts/utils.py", line 182, in render scene.add(r) File "/home/wj/anaconda3/envs/atiss/lib/python3.8/site-packages/simple_3dviz/scenes.py", line 60, in add renderable.init(self._ctx) File "/home/wj/anaconda3/envs/atiss/lib/python3.8/site-packages/simple_3dviz/renderables/textured_mesh.py", line 197, in init self.material = self._material File "/home/wj/anaconda3/envs/atiss/lib/python3.8/site-packages/simple_3dviz/renderables/textured_mesh.py", line 230, in material self._prog["diffuse"].write(self._material.diffuse.tobytes()) File "/home/wj/anaconda3/envs/atiss/lib/python3.8/site-packages/moderngl/program_members/uniform.py", line 180, in write self.mglo.data = data moderngl.error.Error: data size mismatch 24 != 12

paschalidoud commented 2 years ago

Hi @JackW987,

I think your wxpython version is causing this issue. In my environment, I am using simple-3dviz with wxpython=4.0.7 and moderngl=5.6.4 and it works fine.

Best, Despoina

JackW987 commented 2 years ago

Hi @JackW987,

I think your wxpython version is causing this issue. In my environment, I am using simple-3dviz with wxpython=4.0.7 and moderngl=5.6.4 and it works fine.

Best, Despoina

Thanks for your reply!

JackW987 commented 2 years ago

I retry my code in the enviroment that build with wxpython=4.0.7 moderngl=5.6.4,this error has occurred again.I change TexturedMesh.from_file to Mesh.from_file then the render work fine. Maybe I use the texture image with wrong image format as .png? it should be the .jpeg or something else.Anyway,the code is running great,Thanks a lot.

paschalidoud commented 2 years ago

Hey @JackW987,

Can you maybe share the name of the object you were trying to visualize? Best, Despoina

JackW987 commented 2 years ago

Hey @JackW987,

Can you maybe share the name of the object you were trying to visualize? Best, Despoina

Thanks for your reply! https://drive.google.com/file/d/19rz_YBenOvt-mjt0G2J3IU7H2vznXDjB/view?usp=sharing This the link of some files(.obj format) I trying to render.My envs: python=3.7 wxpython=4.0.7 modernGl=5.6.4.

paschalidoud commented 2 years ago

Thanks @JackW987. We submitted a fix that should be solving this issue, even when using TexturedMesh.

Best, Despoina