VOGONS


opengl output changes

Topic actions

First post, by thomas001

User metadata
Rank Newbie
Rank
Newbie

Hi, i looked a bit into the opengl output of dosbox and made some changes i'd like to post for discussion.

  • remove GFX_RGBONLY check from gl output, as opengl can do RGB in 32bit. advantage is opengl output together with scalers like hq3x.
  • move texture coordinates half an pixel into the image. this should prevent interpolation with not filled areas in the texture for the right and down edge of the screen (i get strange gray lines at those edges otherwise). top and left edge where moved in because for symmetry.
  • remove NV_pixel_data_range support and add ARB_pixel_buffer_object support instead.
  • fix opengl extension recognition. simply using strstr() is the wrong way.

Everything works fine on my system, but the patch has not been tested on other systems.

comments are welcome 😀

Reply 1 of 4, by robertmo

User metadata
Rank l33t++
Rank
l33t++

if you check CGA Compatibility Tester, version 0.5a from http://www.oldskool.org/pc/cgacomp

with:
machine=cga
windowresolution=1280x800
output=openglnb
scaler=none

you will notice that the main menu screen, and moire tests don't look properly.

Reply 2 of 4, by thomas001

User metadata
Rank Newbie
Rank
Newbie
robertmo wrote:
if you check CGA Compatibility Tester, version 0.5a from http://www.oldskool.org/pc/cgacomp […]
Show full quote

if you check CGA Compatibility Tester, version 0.5a from http://www.oldskool.org/pc/cgacomp

with:
machine=cga
windowresolution=1280x800
output=openglnb
scaler=none

you will notice that the main menu screen, and moire tests don't look properly.

Thanks for your testing. i changed the patch. now when bilinear filtering is disabled texture coordinates are set as before the patch. also the patch now checks for ARB_texture_non_power_of_two. this is a opengl 2.0 core feature (we detect it anyway for <2.0 implementations) that allows textures of arbitrary size. so the texture doesn't need to be bigger than the actual frame is.

Reply 3 of 4, by gulikoza

User metadata
Rank Oldbie
Rank
Oldbie

During my tests I found that non-pow2 textures are much slower than pow2. Maybe this is already fixed in the last generations of the cards, but since dosbox does not really use that much texture ram slightly bigger texture is not an issue.
Also I'm not really sure about the texture coordinate offset. Direct3D does have a 0.0 coordinate in the center of the pixel, but OpenGL IIRC has 0.0 coordinate in the upper left corner.

http://www.si-gamer.net/gulikoza

Reply 4 of 4, by thomas001

User metadata
Rank Newbie
Rank
Newbie

oh sorry. i did not know there where slower...

i did not introduce NPOT textures because of the small memory benefit. i searched for a way to get filtering right. the thing is that linear filtering at the right and bottom edge of the screen will be wrong, as it filters with the "width+1"-th and "height+1"-th pixel. with NPOT textures the texture is exactly width x height so the screen edges are actual texture edges and the problem does not occur. those offsets are another approach which work, but they cut of half the area of the border pixels, so not an ideal solution either. perhaps this is unnoticeable when bilienar filtering is turned on. the last idea whould be to manually copy the last column and row, which whould result in correctly filtered borders but sounds slow...

... i whould remove the NPOT texture code again and use the offsets iff bilinear filtering is enabled?

edit: we could also add additional textured quads on the right and bottom edge which "fake" correct border interpolation. those quads whould be half an dosbox pixel width.