T
T
Type Programmer2020-07-13 15:27:37
Qt
Type Programmer, 2020-07-13 15:27:37

Qt C++ how to quickly draw in a widget window?

The problem is that when drawing graphical primitives through QPainter, a lot of time is spent. I decided to make a normal raycast render. And so it turns out that while I draw the columns simply by drawing lines, it works more or less quickly, but as soon as I tried to make textures, and for this you need to draw pixel by pixel, the speed dropped to terrible.

Here is the code that slows down...

for( int y = temp; y < tempHeigh; y++ )
      painter.drawPoint(angle,y);


But this replacement works much faster.
painter.drawLine(angle,temp,angle,tempHeigh);

I doubt that it is possible to optimize somehow, the point is in the method itself... How can I get out of the situation?
You need to draw pixels, but without terrible brakes ...

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question