following my another question I have studied in the documentations that I should use this procedure :

Define the texture filter parameters. This will control what happens when a texture is scaled up or down.

glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,filter);
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,filter);  

where filter is:

  • GL_NEAREST specifies that point sampling is to be used when the texture map needs to be magnified or minified.
  • GL_LINEAR specifies that bilinear interpolation among the four nearest neighbors is to be used when the texture map needs to be magnified or minified.

but since my program is all about image processing and applying different filters on an image, I don't want to apply extra filters to the image. Is there any way to apply the textures without filtering?


GL_NEAREST is nearest neighbor, this is effectively no filtering.

  • \$\begingroup\$ thanks @MickLH but as you might know about image-processing in GL_NEAREST method the value of a pixel is replaced by the value of the nearest pixel to it. I mean is there anyway not to have these kinds of transformations on the image and show exactly what is extracted from the filtering algorithms used in my program \$\endgroup\$ – Sepideh Abadpour Aug 13 '13 at 5:39
  • 1
    \$\begingroup\$ Consider that the image has exactly one pixel per counting number (0,1,2,3), but texture coordinates can be rational numbers (1.1, 2.552). Nearest neighbor is simply rounding these texture coordinates (1,3), this is exactly no filtering. \$\endgroup\$ – MickLH Aug 13 '13 at 5:41
  • 1
    \$\begingroup\$ as per the spec "GL_NEAREST Returns the value of the texture element that is nearest (in Manhattan distance) to the specified texture coordinates." > "the value of the texture element" it doesn't do anything with the value, just returns it, see? \$\endgroup\$ – MickLH Aug 13 '13 at 5:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.