Disable texture filters patch!

BlitzMax Forums/MiniB3D Module/Disable texture filters patch!

Kippykip(Posted 2013) [#1]
How to add a command to minib3d to turn off texture filtering
You will need to patch some files

Step 1: Open TMesh.bmx and scroll down until you find:
' mipmapping texture flag
If tex_flags&8<>0
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR)
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR)
Else
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR)				 
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR)
EndIf
Change it to look like:
' mipmapping texture flag
If(THardwareInfo.TextureFilters)
    If tex_flags&8<>0
        glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR)
        glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR)
        Else
            glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR)
            glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR)
	EndIf
    Else
        glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST)
        glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST)
EndIf
Step 2: Open THardwareInfo.bmx and add-
Global TextureFilters : Int = 1
-at the end of the globals (e.g. under MaxLights)

Step 3: Open functions.bmx and add this wherever you think is comfortable
Rem
bbdoc: MiniB3D Only
about: Enables/disables texturefilters.

The command enables/disables texture filters on meshes.
End Rem
Function TextureFilters(boolean:Int)
	THardwareInfo.TextureFilters = boolean
End Function

Rem
bbdoc: MiniB3D Only
about: Returns the value of TextureFilters.

The command returns wether TextureFilters is enabled or not.
End Rem
Function GetTextureFilters:Int()
	Return THardwareInfo.TextureFilters
End Function

To use, put TextureFilters(boolean) in your main file
True blurs textures like before and false pixelates textures like Doom!

ENJOY!

Could not have been done without this thread:
http://www.blitzbasic.com/Community/posts.php?topic=97016


Streaksy(Posted 2014) [#2]
omg if this works i'll be your bestest friend


Kippykip(Posted 2014) [#3]
omg if this works i'll be your bestest friend

Well did it work? XD


Streaksy(Posted 2014) [#4]
what, you haven't received the flowers and chocolates yet?


Kippykip(Posted 2014) [#5]
:D


FBEpyon(Posted 2014) [#6]
I did this a while ago myself.. I was having a problems with my textures always looking washed out, and I added the same codes to my minib3d, I have also added a new code for PixmapToTexture to the TTexture.bmx file so that you can edit a pixmap and then make it the texture, but now I trying to figure out how to do this in real time for Texture Blending.. Any suggestions, and sorry for highjacking your post..

Thanks,