Open LiyueAnd opened 1 month ago
很高兴我的问题得到了解决,我看了bug列表中的https://github.com/hoffstadt/DearPyGui/issues/2124,只要将add_dynamic_texture换为dpg.add_raw_texture并将格式稍微修改,就能达到30fps,谢谢 !
I face the same issue.
I want to interact with a large image, and I figured out using a plot would be a good fit, using several textures.
I found out that just having the textures on the plot would make everything extremely slow when the textures are dynamic or raw, even if the content of the textures is not updated at all.
However when the textures are static, the speed is greatly improved. Sadly there is a non negligible overhead I can measure of creating the textures which slow down rendering, despite creating the textures in a callback (But I guess it is expected of opengl. Deleting and creating a lot of textures frequently is not expected to be performant).
I suspect the reason dynamic and raw textures are slow is that the content would be uploaded synchronously every frame (even if the content wasn't changed). But that's just a wild guess.
The proposed test code measures the time to update a dynamic texture (configure_item) and not the frame rate. It seems that the pull request doesn't impact the speed of configure_item. I suspect the reason behind the slow performance might be that the internal copy could be optimized better (ToFloatVect).
Using the code with a numpy array and a raw texture, the speed of set_value is a matter of microseconds. The frame rate I achieve is a full 200 fps with vsync off.
My own issue I described above is fixed by #2365, but this PR has no impact on the test code of this issue as the texture content is changed every frame.
Version of Dear PyGui
Version: 1.11.1 Operating System:Windows 11&Windows 10
My Issue/Question
To render a 1920 * 1280 pixel image in dpg. plot, it takes a huge amount of time (usually around 35ms) and it is difficult to achieve a frame rate of 30fps/s or higher. My graphics card is 3060ti. If I run it on a computer with poorer hardware or render a higher resolution image, the time will further increase. For better demonstration, I loop through the code to render the same image (in actual projects, I render each frame of the video), and the code and image attachments used will be placed in the front of the bottom
To Reproduce
Put my code and the provided images in the same directory, run the code, and the console will print the rendering time for each frame
Expected behavior
I hope to render the image data as quickly as possible after receiving it, and I hope to render a 1920 1280 pixel image with a time limit of less than 10ms ,I hope to render the image data as quickly as possible after receiving it, and I hope to render a 1920 1280 pixel image with a time limit of less than 10ms Also, it is hoped that add_dynamic_texture can receive the original pixel data: [R, G, B, A], rather than having to convert it to floatation: [R/255, G/255, B/255, A/255] in order to be received Because most third-party libraries currently return image data in RGB format, converting it to floating-point data will increase preprocessing time
Screenshots/Video
Standalone, minimal, complete and verifiable example
import time import dearpygui.dearpygui as dpg
dpg.create_context() dpg.create_viewport(title='Visualization Tool') with dpg.window(no_scrollbar=True, delay_search=True, no_move=False, label="main", width=2000, height=1500) as window1:
dpg.setup_dearpygui() dpg.show_viewport() dpg.start_dearpygui() dpg.destroy_context()