Blurred textures - need it sharp


With my c++ app you are allowed to load images as a texture of arbitrary size. The quad I want to texture is a lot bigger than the texture or is shown a lot bigger, but has same xsize/ysize ratio.
While mapping the texture to the quad, it get´s blurred, but i need the image shown really sharp.

These are no real images. Just some bitmaps holding area information represented by different colors - like a chessboard, with exact edges between different colors.

My way:
-load image (eg 50x05px)
-get its ratio
-draw a quad with same ratio (1,1)(-1,1)(-1,-1)(1,-1)
-texture it
-render it in adjustable display window e.g. 500x500
-> blurred

Any ideas?
Thanx a lot in advance

The easiest way to avoid the blur wuld be rescalng the texture to match the display size. If the edges are clearly detectible, it won’t be difficult to write a function that does it.

If your image is really like chesboard, that is, it can be subdivided in uniformly-coloured rectangles of the same size, then you can also encode the image with every texel representing such rectangle and then use a shader to reproduce the final image.

Just disable bilinear filtering :

True, I haven’t thought of that :smiley:

Thanks a lot again, ZbuffeR and Zenga - again, what i´ve searched. - Problem solved by disabling bilinear filtering.

Hello Again,
I found the problem as solved, but with very tiny pictures it wont´t work.

In bmp format i made a 1x5 pixel image, 24bit color depth, and 96dpi hoizintal and vetical resolution. Index 0…4 as usual I set manually the
pixelcolor at (0,2) to yellow:

My app is parsing this image befor it get loaded as texture. Each white pixel get alpha = 0.

When showing it nor any color, neither yellow is displayed.

  1. picer i set up with
    parse ist again
    It gets blue, at one corner blurred red where it should be, BUT also on opposit side but just the edge?!

Here my init-stuff:
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); // Thought this shout enable the interpolation??

What can i do?? I have no clue. do you need some more Infos?
BTW: The tiny images are just for testing reason and i´m still using Qt with QtGlWidget - I´m still checkt this out, if ther comes the interpolation. Nothing found jet.


Add also this :

There are separate setting for enlarged and reduced textures, look up the documentation :