fast line drawing
-
Hello, I am writing a program that draws a lot of lines (up to about 30000 lines/seconds) and some text (it is a kind of chart). In order to do this, I am using GDI. I draw everything in a backbuffer and I use BitBlt to copy it to the front buffer (which is the device context of a CDialog on a dialog based VC++ 6 project). The result is that my program is very slow, use a lot of cpu time and slow down when I drag the mouse over it! Since i want to increase the speed of my code, I would like to use DirectX, OpenGL or something else. Does anybody know wich one would be the fastest to draw a lot of lines and some text with double buffering, and what would be the approximative gain of speed? Thanks for your attention (and sorry for my bad english!). TV
-
Hello, I am writing a program that draws a lot of lines (up to about 30000 lines/seconds) and some text (it is a kind of chart). In order to do this, I am using GDI. I draw everything in a backbuffer and I use BitBlt to copy it to the front buffer (which is the device context of a CDialog on a dialog based VC++ 6 project). The result is that my program is very slow, use a lot of cpu time and slow down when I drag the mouse over it! Since i want to increase the speed of my code, I would like to use DirectX, OpenGL or something else. Does anybody know wich one would be the fastest to draw a lot of lines and some text with double buffering, and what would be the approximative gain of speed? Thanks for your attention (and sorry for my bad english!). TV
It sounds like you draw in the backbuffer and blit it to your frontbuffer, as you call it, every time WM_PAINT is called. If the window is not resized or scrolled, you could just blit your backbuffer to your frontbuffer, without doing all the drawing, because nothing have changed in the view... I hope you understand what I mean, I might have been drinking too much redvine to explain propely :-O BTW, if all the lines you are drawing only are horizontal or vertical, it's way faster to bitblt a small bitmap as the line, than using LineTo()... - Anders Money talks, but all mine ever says is "Goodbye!"
-
It sounds like you draw in the backbuffer and blit it to your frontbuffer, as you call it, every time WM_PAINT is called. If the window is not resized or scrolled, you could just blit your backbuffer to your frontbuffer, without doing all the drawing, because nothing have changed in the view... I hope you understand what I mean, I might have been drinking too much redvine to explain propely :-O BTW, if all the lines you are drawing only are horizontal or vertical, it's way faster to bitblt a small bitmap as the line, than using LineTo()... - Anders Money talks, but all mine ever says is "Goodbye!"
Hello, Actually I am using a timer to redraw every 20 milliseconds my drawing because I am aquiring point from some sensors. I agree with your remark about vertical or horizontal lines, but it is rarely (never...) the case, I have always non-horizontal nor vertical lines.
-
Hello, I am writing a program that draws a lot of lines (up to about 30000 lines/seconds) and some text (it is a kind of chart). In order to do this, I am using GDI. I draw everything in a backbuffer and I use BitBlt to copy it to the front buffer (which is the device context of a CDialog on a dialog based VC++ 6 project). The result is that my program is very slow, use a lot of cpu time and slow down when I drag the mouse over it! Since i want to increase the speed of my code, I would like to use DirectX, OpenGL or something else. Does anybody know wich one would be the fastest to draw a lot of lines and some text with double buffering, and what would be the approximative gain of speed? Thanks for your attention (and sorry for my bad english!). TV
An earlier version of DX will give you DirectDraw, a 2D API which will be much easier to use that OpenGL. Christian NO MATTER HOW MUCH BIG IS THE WORD SIZE ,THE DATA MUCT BE TRANSPORTED INTO THE CPU. - Vinod Sharma Anonymous wrote: OK. I read a c++ book. Or...a bit of it anyway. I'm sick of that evil looking console window. I think you are a good candidate for Visual Basic. - Nemanja Trifunovic