I think I already posted this yesterday, but it seems it got lost. If it was removed because it's in the wrong folder or something, please let me know where I should put it instead. Anyway.
I want to change my display to black and white at will (for flashbacks, dreams, etc.), so I wrote the following function called 'BWFilter'. It's called between 'renderworld' and 'flip'. It scans all pixels on the screen and replaces the colour with it's grayscale counterpart:
The function itself works fine, but it's very slow. Even on fast computers I don't get much more out of it than 3-4 frames per second. Any ideas how I can speed it up or are there other ways to achieve the same effect? I was thinking of using this filter on the textures instead of the rendered image, but then I'll probably have to reload them or copy them or something ... All help will be very much appreciated :)
This function is very useful for turning the screen to black and white if you don't have to update it every frame, so feel free to use it if you like to.
I want to change my display to black and white at will (for flashbacks, dreams, etc.), so I wrote the following function called 'BWFilter'. It's called between 'renderworld' and 'flip'. It scans all pixels on the screen and replaces the colour with it's grayscale counterpart:
Function BWFilter() LockBuffer(BackBuffer()) For x = 1 To GraphicsWidth() For y = 1 To GraphicsHeight() GetColor(x,y) v = (ColorRed() + ColorGreen() + ColorBlue())/3 WritePixelFast x,y,(v Or (v Shl 8) Or (v Shl 16) Or ($ff000000)),BackBuffer() Next Next UnlockBuffer(BackBuffer()) End Function
The function itself works fine, but it's very slow. Even on fast computers I don't get much more out of it than 3-4 frames per second. Any ideas how I can speed it up or are there other ways to achieve the same effect? I was thinking of using this filter on the textures instead of the rendered image, but then I'll probably have to reload them or copy them or something ... All help will be very much appreciated :)
This function is very useful for turning the screen to black and white if you don't have to update it every frame, so feel free to use it if you like to.