a threshold filter anyone?

BlitzMax Forums/BlitzMax Programming/a threshold filter anyone?

Nate the Great(Posted 2009) [#1]
hey

I am trying to make a threshold filter in bmax but I cant seem to get a speedy method to work. If you dont know what a threshold filter is, it is when you replace all of the pixels in an image that have an rgb between said values with a certain solid color. I have not been able to do this speedily due to my lack of knowledge about blitzmax graphics commands so I was wondering if anyone knew how to use bmax commands to do this or what method works best with the given command set.

edit is there a gpu accelerated way to do this via opengl?


Ked(Posted 2009) [#2]
I think there are some code examples somewhere on here about GLMax2D render to texture functions. That should be what you need. The "standard" commands that come with BlitzMax just don't make the cut.


Nate the Great(Posted 2009) [#3]
oh ok thanks ked

render to texture would probably help but I dont think thats all ill need.


Ked(Posted 2009) [#4]
After you render to a texture, though, you should be able to modify the pixels just like a regular TImage. This might slow it down though.


Nate the Great(Posted 2009) [#5]
you should be able to modify the pixels just like a regular TImage. This might slow it down though.



ok thats where I am stuck... I am looking for a way to do it quickly... ie 30-60 fps full screen. so I am looking for some gpu accelerated way to do it. maybe I am headed the wrong direction... :p


jkrankie(Posted 2009) [#6]
isn't this what shaders are for?

Cheers
Charlie


ImaginaryHuman(Posted 2009) [#7]
Yes.

I am wondering about a workaround. Can you set the alpha threshold value so that you only draw pixels above a certain level?


Nate the Great(Posted 2009) [#8]
hmmm how could I access shaders with blitz max?


_JIM(Posted 2009) [#9]
@Nate the Great:

There's some code here: http://www.blitzbasic.com/Community/posts.php?topic=83997 that makes use of shaders. Didn't check to see if Grover is ok with using his code, but it should give you an idea anyway :)


Nate the Great(Posted 2009) [#10]
hey thanks another jim

and he used my b3d physics engine? ahh thats such a mess of code im embarrased about it but its fun to know other people were watching me build it besides the ones posting :)

http://www.blitzbasic.com/Community/posts.php?topic=83997#957859