Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » Bitmap flags not honored under opengl

This thread is locked; no one can reply to it. rss feed Print
Bitmap flags not honored under opengl
keefer
Member #14,955
February 2013

Hi everyone. Using allegro 5.1.10.

Just ran into a situation where I was drawing a relatively massively scaled-up bitmap (specifically created without the mag_linear flag) and to my surprise it was scaled. Upon further inspection, it became evident it wasn't scaled on the first frame but rather every frame after that. It was also the only thing on the screen, so nothing else interfered and it didn't interfere with anything else.

Now, this is the first time in 4+ years I've tried to draw something with nearest instead of linear. I suspect almost everyone always uses linear for everything.

The reason it works on frame 1 is because ogl_upload_bitmap sets glTexParameteri based on the create flags, but ogl_draw_bitmap_region doesn't check the flags at all.

My current fix is to call glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST) right before the draw and set it back to GL_LINEAR after that, and this works fine.

Seems like a relatively easy fix, didn't know if someone in the know wanted to fix it properly. Otherwise, I can try my hand at it in a week or so.

SiegeLord
Member #7,827
October 2006
avatar

The setting of glTexParameteri should persist once set, which is why it's only set during the bitmap's creation. By default, Allegro uses nearest filtering so typically it works fine in isolation... are you creating linear filtered bitmaps sometimes as well?

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

keefer
Member #14,955
February 2013

Sorry, still a little raw with gl. Yes, mostly we use linear bitmaps, but I have a specific need to scale up these particular images (think really scaled pixel art).

SiegeLord
Member #7,827
October 2006
avatar

I played around with this using the ex_filter example. On my system, however, it appears that the first frame is properly filtered as expected. I'm not sure what goes wrong in your case :/. EDIT: Err... and I should say it filters ok the remaining frames too.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Go to: