Hello everybody,

I am changing the Novashell source code so it can use the linear filter when scaling tiles.

I have created a checkbox in the entity/tile properties page so the user can enable the linear filter if necessary.

I think I've changed everything correctly, but something is not working.

In Tile.cpp - RenderTilePic(...) there is the following code

Code:
	rectDest.bottom = RoundNearest(rectDest.bottom, 1.0f);
	rectDest.right = RoundNearest(rectDest.right, 1.0f);
	rectDest.top = RoundNearest(rectDest.top, 1.0f);
	rectDest.left = RoundNearest(rectDest.left, 1.0f);
	
	clTexParameteri(CL_TEXTURE_2D, CL_TEXTURE_MAG_FILTER, CL_NEAREST);
	clTexParameteri(CL_TEXTURE_2D, CL_TEXTURE_MIN_FILTER, CL_NEAREST);

	pSurf->set_color(pTile->GetColor());
	pSurf->draw_subpixel(pTile->m_rectSrc, rectDest, pGC);
I've changed it to
Code:
	rectDest.bottom = RoundNearest(rectDest.bottom, 1.0f);
	rectDest.right = RoundNearest(rectDest.right, 1.0f);
	rectDest.top = RoundNearest(rectDest.top, 1.0f);
	rectDest.left = RoundNearest(rectDest.left, 1.0f);

	if (pTile->GetBit(Tile::e_linearFilter)) // flag created for the linear filter
	{
		clTexParameteri(CL_TEXTURE_2D, CL_TEXTURE_MAG_FILTER, CL_LINEAR);
		clTexParameteri(CL_TEXTURE_2D, CL_TEXTURE_MIN_FILTER, CL_LINEAR);
	}
	else
	{
		clTexParameteri(CL_TEXTURE_2D, CL_TEXTURE_MAG_FILTER, CL_NEAREST);
		clTexParameteri(CL_TEXTURE_2D, CL_TEXTURE_MIN_FILTER, CL_NEAREST);
	}
	pSurf->set_color(pTile->GetColor());
	pSurf->draw_subpixel(pTile->m_rectSrc, rectDest, pGC);
When I check the Linear Filter checkbox the if condition is satisfied and the correct code is executed

Code:
		clTexParameteri(CL_TEXTURE_2D, CL_TEXTURE_MAG_FILTER, CL_LINEAR);
		clTexParameteri(CL_TEXTURE_2D, CL_TEXTURE_MIN_FILTER, CL_LINEAR);
But the filtering is not applied to the tile.

If I just change the CL_NEAREST param to CL_LINEAR with no IF, then the filtering is applied, but it is applied to all tiles.

It seems like the clTexParameteri call with CL_NEAREST is cancelling any previous calls with CL_LINEAR.

Thank you for any help.