How to call :OGL Convolution Filter

BlitzMax Forums/BlitzMax OpenGL Programming/How to call :OGL Convolution Filter

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Maybe your graphics card does not support it?

This works fine for me:
SuperStrict

GLGraphics(640,480)
glewinit()

'
' Check if convolution is supported
Local extensions:String = String.FromCString(Byte Ptr(glGetString(GL_EXTENSIONS))).Replace(" ","~n")
If extensions.Contains( "GL_ARB_imaging" ) = False
	Print "GL_ARB_imaging not available"
	End
EndIf
If glConvolutionFilter2D = Null
	Print "glConvolutionFilter2D not available!"
	End
EndIf

'
' Load a pixmap
Local p:TPixmap = LoadPixmap("C:\blitzmax\samples\breakout\media\b-max.png")

'
' Setup convolution filter
Local filter:Float[] = [0.00000067, 0.00002292, 0.00019117, 0.00038771, 0.00019117, 0.00002292, 0.00000067, 0.00002292, 0.00078633, 0.00655965, 0.01330373, 0.00655965, 0.00078633, 0.00002292, 0.00019117, 0.00655965, 0.05472157, 0.11098164, 0.05472157, 0.00655965, 0.00019117, 0.00038771, 0.01330373, 0.11098164, 0.22508352, 0.11098164, 0.01330373, 0.00038771, 0.00019117, 0.00655965, 0.05472157, 0.11098164, 0.05472157, 0.00655965, 0.00019117, 0.00002292, 0.00078633, 0.00655965, 0.01330373, 0.00655965, 0.00078633, 0.00002292, 0.00000067, 0.00002292, 0.00019117, 0.00038771, 0.00019117, 0.00002292, 0.00000067]
Local size:Int = Int(Sqr(filter.length))
glConvolutionFilter2D(GL_CONVOLUTION_2D, GL_LUMINANCE, size, size, GL_LUMINANCE, GL_FLOAT, Varptr(filter[0]) )
glEnable( GL_CONVOLUTION_2D )

'
' Setup view matrix
glOrtho 0,640,480,0,-1,1

'
' Draw the pixmap
glpixelzoom 1.0,-1.0
glRasterPos2i 0,0
glBitmap 0,0,0,0,0,0,Null
glPixelStorei GL_UNPACK_ROW_LENGTH, p.pitch Shr 2
glDrawPixels p.width,p.height,GL_RGBA,GL_UNSIGNED_BYTE,p.pixels
		
Flip

WaitKey()

End