OpenGL and setTiledImageFill


#1

Hi,

today i enabled OpenGL by attaching an OpenGLContext to the mainWindow:

"openGLContext.attachTo(*mainWindow);"

And suddenly my tiledImageFill seems to be painted twice or different or whatever.

I tested the same thing with a simple Demo Application with the same results.

Its either a bug with the tiledImageFill or i am missing something in my code.

Screenshots and files of my Demo Application are attached.

 


#2

Wow, it was never designed for 2x2 textures where the exact pixels matter! The GL shader will use texture coordinate interpolation when drawing these things, I can't vouch for it doing a 1:1 perfect mapping. You could just use a bigger version of the texture?


#3

It has been a 4x4 pattern.

I just increased it to a 32x32 pattern and it doesn't change anything.

Screenshot is attached. :)

But with the new pattern size you can really see what's happening.


#4

Yes - it's resizing it by one pixel, and interpolating. I'm not massively surprised, but also wouldn't consider this a huge priority because none of this stuff was designed for images that can't survive being transformed.

For example, even if I spent hours tweaking the algorithm to make sure that it's precisely correct in this case, if you ran this on an OS where the desktop scale was slightly different from 1:1 (as often happens in Windows, for example), then you'd get even more horrible rescaling artifacts.

Are you trying to draw grid-lines? If so, personally, I'd just draw them with a RectangleList. Images are there for drawing things that are pictures. For drawing things that are geometric, just draw them as shapes, and avoid using images.


#5

I am using lots of tiled image patterns in my application and most of them are more complex, but these even work fine with OpenGL as they have thicker contours. Just for simplicity i have painted my grid patterns the same way. But you are right... its the easiest and a much more reliable solution to draw the lines with a RectangleList. :)

Thx,

Benjamin