hi guys,

i wrote a little gfx-demo using a fire-algorithm and drawing it on a window. i've optimized the code, but the only thing (plotting the pixels) is damn slow for these purposes.
so is there a directer/better way to put a pixel on a window?
Posted on 2002-11-01 13:31:45 by hartyl
You could try and find a way in which you can draw the screen scanline by scanline. Because each time the DrawDot is called, there is a integer multiply (which sadly is still quite slow on todays CPUs)
Posted on 2002-11-01 19:09:57 by x86asm

You could try and find a way in which you can draw the screen scanline by scanline. Because each time the DrawDot is called, there is a integer multiply (which sadly is still quite slow on todays CPUs)


Very true. I used to fiddle around with some 90-ish demo-effects like that in real-mode dos, you have to implement an offscreen buffer.
Draw all your graphics to this allocated memory area, and when done calculating every pixel, use bitblt-api to move it to the window.

I remember I implemented that both in direct draw and in GDI (in c though not asm) two years back. Unhappily I lost all those sources in an
all out-mega-crash of my computer ( not bad excuse for not showing code ;-)
The gdi-version suprised me with it's speed, (320x200res) even though there was lots of 'tearing' when updating screen. (never understood
how to wait for vertical sync with gdi)
With GDI I think I just created a bitmap offscreen somehow, I don't remember, perhaps somebody else can fill in the details.
Posted on 2002-11-01 20:12:55 by david
One word, DIBSections. For an example here's mine. I'm sure there are many others :alright: .
Posted on 2002-11-01 20:21:14 by Eóin
If you want to do fast graphics you have to have access to the video hardware. Unfortunately windows makes this very difficult. You have to know their system first then the hardware then your on your way. Ever notice that QIII doesn't have to click those switches at the back of your monitor to get going. That is because Macormack who is the creator of QIII did enough research to beat M$ at their own game. Its also why he liscences his engine to them for big bucks.

:alright:
Posted on 2002-11-01 21:28:56 by IwasTitan
Or you could do a memory buffer just the size of your effect optimize it

And then at the end of demo GFX frame just copy the buffer on a DIB or a Locked DX SUrface or VESA LFB or SOL OS LFB etc

You will only have to change that alst buffer copy if you change environment ... this way
Posted on 2002-11-01 21:52:45 by BogdanOntanu
good idea, using DIBSections
i didn't know that it's possible to draw into a bitmap with a mov-instruction (i thougth it's only possible via the api)
i'll update my fire-effect by now and maybe post my final code
Posted on 2002-11-02 04:17:00 by hartyl