Sharp pixels instead of fuzzy pixels

Hi guys,

Is there a way to make sprites’ pixels sharp and unfiltered but let the other map layers be softened? See screenshot: http://screencast.com/t/n2zBzcx6jnQ  Left is how it is now. Right is close to unfiltered and sharp.

URL error with that link…

These are probably what you are looking for:

display.setDefault(  “magTextureFilter” , “nearest” )

display.setDefault(  “minTextureFilter” , “nearest” )

From build notes:

Add ability to specify GL_LINEAR and GL_NEAREST via display.setDefault( key, value ). Keys are “magTextureFilter” and “minTextureFilter”. Values are “linear” and “nearest”. Once you change the default, a display.new* call will use the new default. However, you cannot change the texture’s filter, once the image has been loaded the first time. If you use the image in other display objects, it will use the filter default from the first time the image was loaded.

I think you need to set those defaults as shown above, load the textures you want to appear sharp, then change the default to the below before loading textures you want to be filtered. 

display.setDefault(  “magTextureFilter” , “linear” )

display.setDefault(  “minTextureFilter” , “linear” )

Once a texture is loaded it will retain its filtering method even if you create a new instance of it later.

Thanks Stephen. That’s it.  Is there a way to change the filter by object?

Thanks

I haven’t used these myself, but from the build notes is seems like you just need to reset the texture filters to whatever you want them to be before loading the object texture.  If you load all your images in advance you could load all the objects with “linear” filtering first, then change the default to “nearest” so whatever textures you load after that will have the sharp filtering.  If you load texture objects as you need them then create a small function that sets the default filtering and call it to set the filtering type prior to loading each new texture object.

Interesting idea Stephen, I will try that out. Thank you

URL error with that link…

These are probably what you are looking for:

display.setDefault(  “magTextureFilter” , “nearest” )

display.setDefault(  “minTextureFilter” , “nearest” )

From build notes:

Add ability to specify GL_LINEAR and GL_NEAREST via display.setDefault( key, value ). Keys are “magTextureFilter” and “minTextureFilter”. Values are “linear” and “nearest”. Once you change the default, a display.new* call will use the new default. However, you cannot change the texture’s filter, once the image has been loaded the first time. If you use the image in other display objects, it will use the filter default from the first time the image was loaded.

I think you need to set those defaults as shown above, load the textures you want to appear sharp, then change the default to the below before loading textures you want to be filtered. 

display.setDefault(  “magTextureFilter” , “linear” )

display.setDefault(  “minTextureFilter” , “linear” )

Once a texture is loaded it will retain its filtering method even if you create a new instance of it later.

Thanks Stephen. That’s it.  Is there a way to change the filter by object?

Thanks

I haven’t used these myself, but from the build notes is seems like you just need to reset the texture filters to whatever you want them to be before loading the object texture.  If you load all your images in advance you could load all the objects with “linear” filtering first, then change the default to “nearest” so whatever textures you load after that will have the sharp filtering.  If you load texture objects as you need them then create a small function that sets the default filtering and call it to set the filtering type prior to loading each new texture object.

Interesting idea Stephen, I will try that out. Thank you