Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 2 3 [4] 5 6 ... 23

Author Topic: [PRINT_MODE:SHADER]  (Read 90441 times)

arclance

  • Bay Watcher
    • View Profile
Re: [PRINT_MODE:SHADER]
« Reply #45 on: October 29, 2011, 03:16:58 pm »

I have found a strange bug you should know about.
PRINT_MODE:SHADER works for a few days (more than 2 less than 5) but then SHADER mode starts crashing with a Segmentation Fault.  Other modes (VBO, etc.) keep working.
Here is a backtrace of the crash.
Spoiler (click to show/hide)
This can be worked around by starting with a fresh vanilla Dwarf Fortress install and installing everything again.
Here is the startup output from a fresh install for comparison.
Spoiler (click to show/hide)
This install will work for a few days and then it also stops working.
Logged
I think that might be one of the most dwarfen contraptions I've ever seen the blueprints of.
The Bloodwinery v1.3.1 | Dwarven Lamination v1.5 | Tileset Resizer v2.5 - Mac Beta Tester Needed
Sigtext

lxnt

  • Bay Watcher
    • View Profile
    • pm:full_graphics
Re: [PRINT_MODE:SHADER]
« Reply #46 on: October 29, 2011, 06:32:27 pm »

Thank you very much for the insights into df coloring and tileset. Unfortunately it's too early to think about all this (though I think offset icons on top of creatures won't much of problem).

I made variable-tile-sizes work, but only on gallium software renderer. Thus I uploaded my current testbed script with all necessary data here: http://dffd.wimbli.com/file.php?id=5122

Please try to run it (runme.sh script), preferably on non-ATI cards, and on more-or-less recent Mesa versions for Intel ones,  and report results here.

lxnt

  • Bay Watcher
    • View Profile
    • pm:full_graphics
Re: [PRINT_MODE:SHADER]
« Reply #47 on: October 29, 2011, 07:53:05 pm »

I have found a strange bug you should know about.
PRINT_MODE:SHADER works for a few days (more than 2 less than 5) but then SHADER mode starts crashing with a Segmentation Fault.  Other modes (VBO, etc.) keep working.
Here is a backtrace of the crash.

This is very strange. How can it know it's been installed for a given amount of time? I never wrote any code that would check that.

However, today after extensive shader debugging I lost all understanding how this previous version could work at all. :)

 

lxnt

  • Bay Watcher
    • View Profile
    • pm:full_graphics
Re: [PRINT_MODE:SHADER]
« Reply #48 on: October 29, 2011, 09:05:44 pm »

Found and fixed a bug in vertex shader which was causing fun (and all shader fun is hidden). Please download new version of http://dffd.wimbli.com/file.php?id=5122 .

lxnt

  • Bay Watcher
    • View Profile
    • pm:full_graphics
Re: [PRINT_MODE:SHADER]
« Reply #49 on: October 31, 2011, 09:52:43 am »

Resorted to filing a bug:

https://bugs.freedesktop.org/show_bug.cgi?id=42435

Will continue to develop code using llvmpipe (software) driver for the time being.

arclance

  • Bay Watcher
    • View Profile
Re: [PRINT_MODE:SHADER]
« Reply #50 on: October 31, 2011, 04:02:53 pm »

Found and fixed a bug in vertex shader which was causing fun (and all shader fun is hidden). Please download new version of http://dffd.wimbli.com/file.php?id=5122 .
Assuming I put every thing in the correct place as there were no installation instructions other than the python dependencies it does not work.
This is how it crashes.
Code: [Select]
./runme.sh
texture 0 data loaded
FrameLoader(): 18 frames indexed

vendor: NVIDIA Corporation
renderer: GeForce GT 240/PCI/SSE2
version: 3.3.0 NVIDIA 270.41.06
GLSL version: 3.30 NVIDIA via Cg compiler
GL_MAX_VERTEX_ATTRIBS: 16 needed:7
GL_MAX_VERTEX_UNIFORM_COMPONENTS: 4096 needed:7
GL_MAX_FRAGMENT_UNIFORM_COMPONENTS: 2048 needed:6
GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS: 32 needed:1
GL_MAX_TEXTURE_IMAGE_UNITS: 32 needed:1
GL_MAX_VARYING_FLOATS: 60 needed:20
GL_MAX_TEXTURE_COORDS: 8 needed:5
GL_POINT_SIZE_MIN: 0 needed:-4
GL_POINT_SIZE_MAX: 63 needed:63
GL_MAX_RECTANGLE_TEXTURE_SIZE: 8192 needed:2048
GL_ARB_texture_rectangle: supported
Compiling shaders:
 4varying.vs
 4varying.fs
Traceback (most recent call last):
  File "testbed.py", line 623, in <module>
    r = rednener(stuff, pa.vertex_shader, pa.fragment_shader)
  File "testbed.py", line 181, in __init__
    self.shader_setup()
  File "testbed.py", line 239, in shader_setup
    compileShader(file(self.vs).read(), GL_VERTEX_SHADER),
  File "/usr/lib/pymodules/python2.7/OpenGL/GL/shaders.py", line 162, in compileShader
    shaderType,
RuntimeError: ('Shader compile failure (0): 0(22) : error C7532: global type sampler2DRect requires "#version 140" or later\n0(22) : error C0000: ... or #extension GL_ARB_texture_rectangle : enable\n0(62) : error C7531: global function texture2DRect requires "#extension GL_ARB_texture_rectangle : enable" before use\n', ['#line 1 0\n#version 120\n#ifndef GL_ARB_texture_rectangle\n#extension GL_ARB_texture_rectangle : require\n#endif\n#pragma optimize(off)\n#pragma debug(on)\n\n/*\n    row-major order.\n    idx, rows, columns\n\n    column = fract(idx/columns)*columns (aka mod(idx, rows))\n    row = floor(idx/columns)\n\n    nc_t = column/columns = fract(idx/columns)\n    nc_s = row/rows = floor(idx/columns)/rows\n*/\n\nconst float ANSI_CC = 16.0; // ansi color count \n\nuniform sampler2DRect txco;\nuniform vec4 txsz;              // { w_tiles, h_tiles, tile_w, tile_h }\nuniform vec2 viewpoint;\t\t\t\nuniform vec3 pszar; \t\t\t// { parx, pary, psz }\n// Total 7 float values, 1 sampler\n\nattribute vec4 screen;          // { ch, fg, bg, bold } \nattribute float texpos;         //  tile_tex_idx \nattribute float addcolor;\nattribute float grayscale;\nattribute float cf;\nattribute float cbr;\nattribute vec2 position;        // almost forgot teh grid\n// Total 7 attributes  = 13 float values \n\nvarying vec4 ansicolors;        // tile: computed foreground and background color indexes for tile and creature\nvarying vec4 tile;         \t// creature: offset into font texture and tile size\nvarying vec4 creature;          // tile: offset into font texture and tile size\n\n// Total 6 texcoords  = 24 varying floats\n\nvec2 ansiconvert(vec3 c) { // { fg, bg, bold }, returns {fg_idx, bg_idx}\n    vec2 rv;\n    float bold_factor = 0.0;\n    if (c.z > 0.1)\n        bold_factor = 8.0;\n\n    rv.x = mod(c.x + bold_factor, ANSI_CC);\n    rv.y = mod(c.y, ANSI_CC);\n    return rv;\n}\n\nvec4 idx2texco(float idx) {\n    vec4 tile_size;\n    vec2 tile_coords;\n    vec4 rv;\n    \n    rv.x = txsz.x*fract( idx / txsz.x ) * txsz.z;  // pixel coords \n    rv.y = txsz.w*floor( idx / txsz.x ); // txsz.y;  // into font texture - "offset"\n\n    tile_size = texture2DRect(txco, rv.xy);\n    rv.zw = tile_size.xy * 256.0; // pixel size of the tile = "tilesize"\n    \n    return rv;\n}\n\nvoid main() { // precomputes whatever there can be precomputed\n    \n    ansicolors.xy = ansiconvert(screen.yzw);\n    tile = idx2texco(screen.x);\n    \n    vec2 defaultcolors = vec2(0.0, 15.0);\n    if (texpos > 0.1) {\n\tcreature = idx2texco(texpos);\n\tif  (grayscale > 0.1) {  \n\t    ansicolors.zw = ansiconvert(vec3(cf, screen.z, cbr));\n\t} else if (addcolor > 0.1) {\n\t    ansicolors.zw = ansicolors.xy;\n\t} else {\n\t    ansicolors.zw = defaultcolors;\n\t}\n    } else {\n\tcreature = vec4(0.0); // size of 0 = no creature.\n\tansicolors.zw = defaultcolors;\n    }\n    \n    vec2 posn = pszar.xy*position*pszar.z - viewpoint;\n     \n    gl_Position = gl_ModelViewProjectionMatrix*vec4(posn.x, posn.y, 0.0, 1.0);\n    gl_PointSize = pszar.z;    \n}\n'], GL_VERTEX_SHADER)

The old version is still working as of now. 
It just feels like it randomly decides to not work after a few days (not while playing, at startup) and you have to start from scratch with a new df_linux folder.
Logged
I think that might be one of the most dwarfen contraptions I've ever seen the blueprints of.
The Bloodwinery v1.3.1 | Dwarven Lamination v1.5 | Tileset Resizer v2.5 - Mac Beta Tester Needed
Sigtext

lxnt

  • Bay Watcher
    • View Profile
    • pm:full_graphics
Re: [PRINT_MODE:SHADER]
« Reply #51 on: November 01, 2011, 04:47:46 am »

Nvidia driver is  being picky and wants #extension GL_ARB_texture_rectangle : enable line somewhere after #version line in the shader source code.

You can also try the testcase from the bug I submitted to the FDO (link in above post), it's somewhat more documented.

In other news I found a workaround for my problems - moving most of processing to the fragment shader, so the point is hopefully moot.
This would waste GPU resources, but hey, it would work at last. So expect new libgraphics.so shortly.



lxnt

  • Bay Watcher
    • View Profile
    • pm:full_graphics
Re: [PRINT_MODE:SHADER]
« Reply #52 on: November 05, 2011, 08:33:32 pm »

Okay, I got rid of graphic tile size limitation, the only remaining is the aspect ratio one. New lib uploaded. It also should work on i965 (Intel Sandy Bridge chipset) machines.

As for aspect ratio limit : currently my code assumes all tiles are of same aspect ratio as the one in the font, and will shamelessly stretch anything else. It also assumes that both font/graphics pixels and on-screen ones are square.

Here's the question: If one uses, say, 8x14 font with half 32x32 graphics, other half being, say, 12x24 :  what should the code do?
Or the other way around: 32x24 font, 16x16 and 8x12 graphics. and some 48x54 ones just for fun.

arclance

  • Bay Watcher
    • View Profile
Re: [PRINT_MODE:SHADER]
« Reply #53 on: November 05, 2011, 09:15:56 pm »

Okay, I got rid of graphic tile size limitation, the only remaining is the aspect ratio one. New lib uploaded.
Does not work with the Nvidia drivers (and probably any drivers other than the one you are using that does not update libstdc++) if you follow the instructions in your readme.
Spoiler (click to show/hide)
You need to update libstdc++ (and possibly some other things) using this repository https://launchpad.net/~ubuntu-toolchain-r/+archive/test for it to work.

Also tiles are not rendered in the correct size and the screen is not filled when first loading a save file. 
Spoiler (click to show/hide)
This can be worked around by playing with the zoom until it looks right (or using an old screenshot to be sure its right).
Spoiler (click to show/hide)
It also should work on i965 (Intel Sandy Bridge chipset) machines.
Do you mean that it will work with the built in graphics in the sandy bridge chipset?
« Last Edit: November 05, 2011, 09:59:56 pm by arclance »
Logged
I think that might be one of the most dwarfen contraptions I've ever seen the blueprints of.
The Bloodwinery v1.3.1 | Dwarven Lamination v1.5 | Tileset Resizer v2.5 - Mac Beta Tester Needed
Sigtext

Mike Mayday

  • Bay Watcher
  • gfx whr
    • View Profile
    • Goblinart
Re: [PRINT_MODE:SHADER]
« Reply #54 on: November 06, 2011, 06:09:23 am »

Here's the question: If one uses, say, 8x14 font with half 32x32 graphics, other half being, say, 12x24 :  what should the code do?
Or the other way around: 32x24 font, 16x16 and 8x12 graphics. and some 48x54 ones just for fun.

The biggest problem with all this is that game icons are, by necessity, pixelart. This means that any resizing other than upscaling them by increments of 2 is a murder on the piece of work that they are- seriously decreasing not only their looks but most of all their readability.
Sometimes decreasing them by 2x will work for a general overview and that's it. However, text and clear symbols can usually be downscaled with less of an impact, though it will also never look as good as the original.
Not to mention, the second situation is bloody unlikely- since the interface NEEDS to have 80 tiles horizontally, that would require a resolution of 2560...
An additional general rule: the aspect ratio of EVERY tile (tileset and graphics) must ALWAYS be mantained.

Due to those problems, I believe separating the worldview zoom from the menus is the only way to go. Any playing around with stretching and zooming is useless as long as most users can use 16px tiles at best (if I'm not mistaken, the most popular horizontal resolution is still 1280).
Once/IF that's taken care of, an optimum for me would be:

-situation 1 is: keep the menus with the original fontsize and for the worldview choose the largest of tiles (32x32), stretch the base tileset by a maximum fitting increment of 2x (in this case= once, because that will yield 16x24) and CENTER them, and keep the second set of graphic as is and also center them.

-situation 2: check your maximum resolution and keep decreasing the base tilest by increments of 2 until it fits- so in my case= just once, which results in 16x12 tiles. If your horizontal resolution is 1920 you can leave it be.
Now we've got a problem with the graphics: the basic view would indeed use the largest- 48x54 tiles, and stretch/center the others to 48x48 and 36x48 respectively.
But now that we're using tiles that big, one should be able to keep zooming out (STILL by increments of 2) until they reach the smallest tilesize of the set.
So the next zoomout will yield: 24x27, 16x16 and 8x12. Now we've come to a dumb situation because the tileset author decided to use a weird tile size- we can't divide 27 by two. I guess it's up to you to decide how to downscale it, let's say this results in 12x14, 8x8 and 8x12. Now we need to zoomout once again to make it fit the smallest original tiles (8x12) but the second one is good enough already. So the result of the last zoomout will be 6x12, 8x8 and 8x12.

I'm pretty sure that was not at all clear, in which case let me know. I'm also pretty sure all this is very hard to do and you'll want to look for another method, in which case also let me know and I'll try to think of more general rules without worrying about even scaling and readability so much.

EDIT: another thing! when stretching tiles by increments of 2, it's optimal to use the nearest neighbour method- tiles are designed to look best with it. All other stretches/squeezes should use some hq/SaI/etc. algorithm (don't remember which one you're using right now).
« Last Edit: November 06, 2011, 06:16:33 am by Mike Mayday »
Logged
<3

lxnt

  • Bay Watcher
    • View Profile
    • pm:full_graphics
Re: [PRINT_MODE:SHADER]
« Reply #55 on: November 06, 2011, 09:32:48 am »

Does not work with the Nvidia drivers (and probably any drivers other than the one you are using that does not update libstdc++) if you follow the instructions in your readme.

Yup, my fault. Used a gcc too fresh. Will recompile with oldest gcc possible.


Also tiles are not rendered in the correct size and the screen is not filled when first loading a save file. 

That one is strange. Can you please post output from the console?

This can be worked around by playing with the zoom until it looks right (or using an old screenshot to be sure its right).

Try the reset-zoom hotkey,  F10, it should reset zoom so that tiles are drawn pixel-for-pixel.


Do you mean that it will work with the built in graphics in the sandy bridge chipset?

Yup. Works for me at:

Code: [Select]
OpenGL renderer: Mesa DRI Intel(R) Sandybridge Desktop x86/MMX/SSE2
OpenGL version: 2.1 Mesa 7.12-devel
lspci:
       Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)

dmidecode:
Base Board Information
        Manufacturer: Intel Corporation
        Product Name: DH67BL
        Version: AAG10189-204

With xorg-edgers drivers, as you see, but still.

arclance

  • Bay Watcher
    • View Profile
Re: [PRINT_MODE:SHADER]
« Reply #56 on: November 06, 2011, 10:06:33 am »

Also tiles are not rendered in the correct size and the screen is not filled when first loading a save file. 

That one is strange. Can you please post output from the console?
Here you go.
Code: [Select]
./df
textures::load(): data/art/Phoebus_20x20.png 320x320 16x16 20x20
textures::load(): data/art/Phoebus_20x20.png 320x320 16x16 20x20
Loading bindings from data/init/interface.txt
textures::load(): data/art/mouse.png 32x32
set_mode(): requesting vsync=0 and singlebuf=0.
set_mode(): SDL_GL_SWAP_CONTROL: 0
set_mode(): SDL_GL_ACCELERATED_VISUAL: 1
set_mode(): SDL_GL_DOUBLEBUFFER: 1
set_mode(): SDL_FULLSCREEN: 0
GLEW: 1.5.2
OpenGL vendor: NVIDIA Corporation
OpenGL renderer: GeForce GT 240/PCI/SSE2
OpenGL version: 3.3.0 NVIDIA 270.41.06
OpenGL GLSL version: 3.30 NVIDIA via Cg compiler
GL_MAX_VERTEX_ATTRIBS=16, needed=7
GL_MAX_VERTEX_UNIFORM_COMPONENTS=4096, needed=7
GL_MAX_FRAGMENT_UNIFORM_COMPONENTS=2048, needed=6
GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS=32, needed=1
GL_MAX_TEXTURE_IMAGE_UNITS=32, needed=2
GL_MAX_VARYING_FLOATS=60, needed=12
GL_MAX_TEXTURE_COORDS=8, needed=3
GL_POINT_SIZE_MIN=0, needed=4
** GL_POINT_SIZE_MAX=63, needed=64
makeansitex(): 2.
Embedded shader set 'rect'
Embedded shader set 'cbr_is_bold' x
Using embedded vertex shader code from 'cbr_is_bold'.
Using embedded fragment shader code from 'cbr_is_bold'.
GL_COMPILE_STATUS: true
GL_COMPILE_STATUS: true
GL_LINK_STATUS: true
GL_VALIDATE_STATUS: true
makeansitex(): 2.
gps_allocate(80, 25)
Resetting textures
texdumpst::init(): allocating 2048x288 (max 64x9 32x32 cells)
accepted font texture (name=1): 2048x288px oa
accepted txco texture (name=3): 64x9px oa
reshape(): got grid 0x0 window -1x-1 texture_ready=1 stretch=0 snap=0
reshape(): final grid 80x25 window 1600x500 viewport 1600x500 Psz 20x20
set_viewport(): got 1600x500 out of 1600x500
reshape(): got grid 96x51 window 1920x1025 texture_ready=1 stretch=0 snap=0
reshape(): final grid 96x51 window 1920x1025 viewport 1920x1020 Psz 20x20
gps_allocate(96, 51)
set_mode(): requesting vsync=0 and singlebuf=0.
set_mode(): SDL_GL_SWAP_CONTROL: 0
set_mode(): SDL_GL_ACCELERATED_VISUAL: 1
set_mode(): SDL_GL_DOUBLEBUFFER: 1
set_mode(): SDL_FULLSCREEN: 0
set_viewport(): got 1920x1020 out of 1920x1025
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/Beefmo/dorfs.png 240x500 12x25 20x20
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/Beefmo/humans.png 240x500 12x25 20x20
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/Beefmo/goblins.png 240x500 12x25 20x20
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/Beefmo/elfs.png 240x500 12x25 20x20
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/Beefmo/koboldz.png 240x500 12x25 20x20
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/mayday/creature_birds.png 100x120 5x6 20x20
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/mayday/creature_domestic.png 440x120 22x6 20x20
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/mayday/creature_large_mountain.png 100x120 5x6 20x20
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/mayday/animals.png 240x600 12x30 20x20
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/mayday/water.png 80x140 4x7 20x20
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/mayday/gibbon.png 80x180 4x9 20x20
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/mayday/beasts.png 120x80 6x4 20x20
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/mayday/mans.png 240x340 12x17 20x20
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/mayday/newbeasts.png 120x160 6x8 20x20
Resetting textures
texdumpst::init(): allocating 2048x2656 (max 64x83 32x32 cells)
accepted font texture (name=1): 2048x2656px oa
accepted txco texture (name=3): 64x83px oa
reshape(): got grid 0x0 window -1x-1 texture_ready=1 stretch=0 snap=0
reshape(): final grid 80x25 window 1920x1025 viewport 1920x600 Psz 24x24
gps_allocate(80, 25)
set_viewport(): got 1920x600 out of 1920x102
This can be worked around by playing with the zoom until it looks right (or using an old screenshot to be sure its right).

Try the reset-zoom hotkey,  F10, it should reset zoom so that tiles are drawn pixel-for-pixel.
Does not fix it. It looks like this after pressing F10.
Spoiler (click to show/hide)
Code: [Select]
/df
textures::load(): data/art/Phoebus_20x20.png 320x320 16x16 20x20
textures::load(): data/art/Phoebus_20x20.png 320x320 16x16 20x20
Loading bindings from data/init/interface.txt
textures::load(): data/art/mouse.png 32x32
set_mode(): requesting vsync=0 and singlebuf=0.
set_mode(): SDL_GL_SWAP_CONTROL: 0
set_mode(): SDL_GL_ACCELERATED_VISUAL: 1
set_mode(): SDL_GL_DOUBLEBUFFER: 1
set_mode(): SDL_FULLSCREEN: 0
GLEW: 1.5.2
OpenGL vendor: NVIDIA Corporation
OpenGL renderer: GeForce GT 240/PCI/SSE2
OpenGL version: 3.3.0 NVIDIA 270.41.06
OpenGL GLSL version: 3.30 NVIDIA via Cg compiler
GL_MAX_VERTEX_ATTRIBS=16, needed=7
GL_MAX_VERTEX_UNIFORM_COMPONENTS=4096, needed=7
GL_MAX_FRAGMENT_UNIFORM_COMPONENTS=2048, needed=6
GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS=32, needed=1
GL_MAX_TEXTURE_IMAGE_UNITS=32, needed=2
GL_MAX_VARYING_FLOATS=60, needed=12
GL_MAX_TEXTURE_COORDS=8, needed=3
GL_POINT_SIZE_MIN=0, needed=4
** GL_POINT_SIZE_MAX=63, needed=64
makeansitex(): 2.
Embedded shader set 'rect'
Embedded shader set 'cbr_is_bold' x
Using embedded vertex shader code from 'cbr_is_bold'.
Using embedded fragment shader code from 'cbr_is_bold'.
GL_COMPILE_STATUS: true
GL_COMPILE_STATUS: true
GL_LINK_STATUS: true
GL_VALIDATE_STATUS: true
makeansitex(): 2.
gps_allocate(80, 25)
Resetting textures
texdumpst::init(): allocating 2048x288 (max 64x9 32x32 cells)
accepted font texture (name=1): 2048x288px oa
accepted txco texture (name=3): 64x9px oa
reshape(): got grid 0x0 window -1x-1 texture_ready=1 stretch=0 snap=0
reshape(): final grid 80x25 window 1600x500 viewport 1600x500 Psz 20x20
set_viewport(): got 1600x500 out of 1600x500
reshape(): got grid 96x51 window 1920x1025 texture_ready=1 stretch=0 snap=0
reshape(): final grid 96x51 window 1920x1025 viewport 1920x1020 Psz 20x20
gps_allocate(96, 51)
set_mode(): requesting vsync=0 and singlebuf=0.
set_mode(): SDL_GL_SWAP_CONTROL: 0
set_mode(): SDL_GL_ACCELERATED_VISUAL: 1
set_mode(): SDL_GL_DOUBLEBUFFER: 1
set_mode(): SDL_FULLSCREEN: 0
set_viewport(): got 1920x1020 out of 1920x1025
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/Beefmo/dorfs.png 240x500 12x25 20x20
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/Beefmo/humans.png 240x500 12x25 20x20
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/Beefmo/goblins.png 240x500 12x25 20x20
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/Beefmo/elfs.png 240x500 12x25 20x20
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/Beefmo/koboldz.png 240x500 12x25 20x20
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/mayday/creature_birds.png 100x120 5x6 20x20
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/mayday/creature_domestic.png 440x120 22x6 20x20
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/mayday/creature_large_mountain.png 100x120 5x6 20x20
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/mayday/animals.png 240x600 12x30 20x20
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/mayday/water.png 80x140 4x7 20x20
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/mayday/gibbon.png 80x180 4x9 20x20
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/mayday/beasts.png 120x80 6x4 20x20
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/mayday/mans.png 240x340 12x17 20x20
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/mayday/newbeasts.png 120x160 6x8 20x20
Resetting textures
texdumpst::init(): allocating 2048x2656 (max 64x83 32x32 cells)
accepted font texture (name=1): 2048x2656px oa
accepted txco texture (name=3): 64x83px oa
reshape(): got grid 0x0 window -1x-1 texture_ready=1 stretch=0 snap=0
reshape(): final grid 80x25 window 1920x1025 viewport 1920x600 Psz 24x24
gps_allocate(80, 25)
set_viewport(): got 1920x600 out of 1920x1025
reshape(): got grid 60x32 window -1x-1 texture_ready=1 stretch=0 snap=0
reshape(): final grid 80x32 window 1920x1025 viewport 1920x768 Psz 24x24
gps_allocate(80, 32)
set_viewport(): got 1920x768 out of 1920x1025
Here is the result of playing with the zoom until it is correct.
Spoiler (click to show/hide)
Code: [Select]
andrew@The-Hammer:/media/Linux_Data/Dwarf_Fortress/Test_Fortress/printmodeshader/current/df_linux$ ./df
textures::load(): data/art/Phoebus_20x20.png 320x320 16x16 20x20
textures::load(): data/art/Phoebus_20x20.png 320x320 16x16 20x20
Loading bindings from data/init/interface.txt
textures::load(): data/art/mouse.png 32x32
set_mode(): requesting vsync=0 and singlebuf=0.
set_mode(): SDL_GL_SWAP_CONTROL: 0
set_mode(): SDL_GL_ACCELERATED_VISUAL: 1
set_mode(): SDL_GL_DOUBLEBUFFER: 1
set_mode(): SDL_FULLSCREEN: 0
GLEW: 1.5.2
OpenGL vendor: NVIDIA Corporation
OpenGL renderer: GeForce GT 240/PCI/SSE2
OpenGL version: 3.3.0 NVIDIA 270.41.06
OpenGL GLSL version: 3.30 NVIDIA via Cg compiler
GL_MAX_VERTEX_ATTRIBS=16, needed=7
GL_MAX_VERTEX_UNIFORM_COMPONENTS=4096, needed=7
GL_MAX_FRAGMENT_UNIFORM_COMPONENTS=2048, needed=6
GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS=32, needed=1
GL_MAX_TEXTURE_IMAGE_UNITS=32, needed=2
GL_MAX_VARYING_FLOATS=60, needed=12
GL_MAX_TEXTURE_COORDS=8, needed=3
GL_POINT_SIZE_MIN=0, needed=4
** GL_POINT_SIZE_MAX=63, needed=64
makeansitex(): 2.
Embedded shader set 'rect'
Embedded shader set 'cbr_is_bold' x
Using embedded vertex shader code from 'cbr_is_bold'.
Using embedded fragment shader code from 'cbr_is_bold'.
GL_COMPILE_STATUS: true
GL_COMPILE_STATUS: true
GL_LINK_STATUS: true
GL_VALIDATE_STATUS: true
makeansitex(): 2.
gps_allocate(80, 25)
Resetting textures
texdumpst::init(): allocating 2048x288 (max 64x9 32x32 cells)
accepted font texture (name=1): 2048x288px oa
accepted txco texture (name=3): 64x9px oa
reshape(): got grid 0x0 window -1x-1 texture_ready=1 stretch=0 snap=0
reshape(): final grid 80x25 window 1600x500 viewport 1600x500 Psz 20x20
set_viewport(): got 1600x500 out of 1600x500
reshape(): got grid 96x51 window 1920x1025 texture_ready=1 stretch=0 snap=0
reshape(): final grid 96x51 window 1920x1025 viewport 1920x1020 Psz 20x20
gps_allocate(96, 51)
set_mode(): requesting vsync=0 and singlebuf=0.
set_mode(): SDL_GL_SWAP_CONTROL: 0
set_mode(): SDL_GL_ACCELERATED_VISUAL: 1
set_mode(): SDL_GL_DOUBLEBUFFER: 1
set_mode(): SDL_FULLSCREEN: 0
set_viewport(): got 1920x1020 out of 1920x1025
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/Beefmo/dorfs.png 240x500 12x25 20x20
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/Beefmo/humans.png 240x500 12x25 20x20
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/Beefmo/goblins.png 240x500 12x25 20x20
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/Beefmo/elfs.png 240x500 12x25 20x20
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/Beefmo/koboldz.png 240x500 12x25 20x20
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/mayday/creature_birds.png 100x120 5x6 20x20
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/mayday/creature_domestic.png 440x120 22x6 20x20
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/mayday/creature_large_mountain.png 100x120 5x6 20x20
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/mayday/animals.png 240x600 12x30 20x20
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/mayday/water.png 80x140 4x7 20x20
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/mayday/gibbon.png 80x180 4x9 20x20
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/mayday/beasts.png 120x80 6x4 20x20
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/mayday/mans.png 240x340 12x17 20x20
textures::load(): data/save/region60-2_phoebus_2_2/raw/graphics/mayday/newbeasts.png 120x160 6x8 20x20
Resetting textures
texdumpst::init(): allocating 2048x2656 (max 64x83 32x32 cells)
accepted font texture (name=1): 2048x2656px oa
accepted txco texture (name=3): 64x83px oa
reshape(): got grid 0x0 window -1x-1 texture_ready=1 stretch=0 snap=0
reshape(): final grid 80x25 window 1920x1025 viewport 1920x600 Psz 24x24
gps_allocate(80, 25)
set_viewport(): got 1920x600 out of 1920x1025
reshape(): got grid 60x32 window -1x-1 texture_ready=1 stretch=0 snap=0
reshape(): final grid 80x32 window 1920x1025 viewport 1920x768 Psz 24x24
gps_allocate(80, 32)
set_viewport(): got 1920x768 out of 1920x1025
reshape(): got grid 83x44 window -1x-1 texture_ready=1 stretch=0 snap=0
reshape(): final grid 83x44 window 1920x1025 viewport 1909x1012 Psz 23x23
gps_allocate(83, 44)
set_viewport(): got 1909x1012 out of 1920x1025
reshape(): got grid 87x46 window -1x-1 texture_ready=1 stretch=0 snap=0
reshape(): final grid 87x46 window 1920x1025 viewport 1914x1012 Psz 22x22
gps_allocate(87, 46)
set_viewport(): got 1914x1012 out of 1920x1025
reshape(): got grid 83x44 window -1x-1 texture_ready=1 stretch=0 snap=0
reshape(): final grid 83x44 window 1920x1025 viewport 1909x1012 Psz 23x23
gps_allocate(83, 44)
set_viewport(): got 1909x1012 out of 1920x1025
reshape(): got grid 80x42 window -1x-1 texture_ready=1 stretch=0 snap=0
reshape(): final grid 80x42 window 1920x1025 viewport 1920x1008 Psz 24x24
gps_allocate(80, 42)
set_viewport(): got 1920x1008 out of 1920x1025
reshape(): got grid 76x41 window -1x-1 texture_ready=1 stretch=0 snap=0
reshape(): final grid 80x41 window 1920x1025 viewport 1920x984 Psz 24x24
gps_allocate(80, 41)
set_viewport(): got 1920x984 out of 1920x1025
reshape(): got grid 83x44 window -1x-1 texture_ready=1 stretch=0 snap=0
reshape(): final grid 83x44 window 1920x1025 viewport 1909x1012 Psz 23x23
gps_allocate(83, 44)
set_viewport(): got 1909x1012 out of 1920x1025
reshape(): got grid 87x46 window -1x-1 texture_ready=1 stretch=0 snap=0
reshape(): final grid 87x46 window 1920x1025 viewport 1914x1012 Psz 22x22
gps_allocate(87, 46)
set_viewport(): got 1914x1012 out of 1920x1025
reshape(): got grid 91x48 window -1x-1 texture_ready=1 stretch=0 snap=0
reshape(): final grid 91x48 window 1920x1025 viewport 1911x1008 Psz 21x21
gps_allocate(91, 48)
set_viewport(): got 1911x1008 out of 1920x1025
reshape(): got grid 96x51 window -1x-1 texture_ready=1 stretch=0 snap=0
reshape(): final grid 96x51 window 1920x1025 viewport 1920x1020 Psz 20x20
gps_allocate(96, 51)
set_viewport(): got 1920x1020 out of 1920x1025
reshape(): got grid 101x53 window -1x-1 texture_ready=1 stretch=0 snap=0
reshape(): final grid 101x53 window 1920x1025 viewport 1919x1007 Psz 19x19
gps_allocate(101, 53)
set_viewport(): got 1919x1007 out of 1920x1025
reshape(): got grid 106x56 window -1x-1 texture_ready=1 stretch=0 snap=0
reshape(): final grid 106x56 window 1920x1025 viewport 1908x1008 Psz 18x18
gps_allocate(106, 56)
set_viewport(): got 1908x1008 out of 1920x1025
reshape(): got grid 112x60 window -1x-1 texture_ready=1 stretch=0 snap=0
reshape(): final grid 112x60 window 1920x1025 viewport 1904x1020 Psz 17x17
gps_allocate(112, 60)
set_viewport(): got 1904x1020 out of 1920x1025
reshape(): got grid 120x64 window -1x-1 texture_ready=1 stretch=0 snap=0
reshape(): final grid 120x64 window 1920x1025 viewport 1920x1024 Psz 16x16
gps_allocate(120, 64)
set_viewport(): got 1920x1024 out of 1920x1025
reshape(): got grid 112x60 window -1x-1 texture_ready=1 stretch=0 snap=0
reshape(): final grid 112x60 window 1920x1025 viewport 1904x1020 Psz 17x17
gps_allocate(112, 60)
set_viewport(): got 1904x1020 out of 1920x1025
reshape(): got grid 106x56 window -1x-1 texture_ready=1 stretch=0 snap=0
reshape(): final grid 106x56 window 1920x1025 viewport 1908x1008 Psz 18x18
gps_allocate(106, 56)
set_viewport(): got 1908x1008 out of 1920x1025
reshape(): got grid 112x60 window -1x-1 texture_ready=1 stretch=0 snap=0
reshape(): final grid 112x60 window 1920x1025 viewport 1904x1020 Psz 17x17
gps_allocate(112, 60)
set_viewport(): got 1904x1020 out of 1920x1025
reshape(): got grid 106x56 window -1x-1 texture_ready=1 stretch=0 snap=0
reshape(): final grid 106x56 window 1920x1025 viewport 1908x1008 Psz 18x18
gps_allocate(106, 56)
set_viewport(): got 1908x1008 out of 1920x1025
reshape(): got grid 101x53 window -1x-1 texture_ready=1 stretch=0 snap=0
reshape(): final grid 101x53 window 1920x1025 viewport 1919x1007 Psz 19x19
gps_allocate(101, 53)
set_viewport(): got 1919x1007 out of 1920x1025
reshape(): got grid 96x51 window -1x-1 texture_ready=1 stretch=0 snap=0
reshape(): final grid 96x51 window 1920x1025 viewport 1920x1020 Psz 20x20
gps_allocate(96, 51)
set_viewport(): got 1920x1020 out of 1920x1025
reshape(): got grid 91x48 window -1x-1 texture_ready=1 stretch=0 snap=0
reshape(): final grid 91x48 window 1920x1025 viewport 1911x1008 Psz 21x21
gps_allocate(91, 48)
set_viewport(): got 1911x1008 out of 1920x1025
reshape(): got grid 96x51 window -1x-1 texture_ready=1 stretch=0 snap=0
reshape(): final grid 96x51 window 1920x1025 viewport 1920x1020 Psz 20x20
gps_allocate(96, 51)
set_viewport(): got 1920x1020 out of 1920x1025
reshape(): got grid 91x48 window -1x-1 texture_ready=1 stretch=0 snap=0
reshape(): final grid 91x48 window 1920x1025 viewport 1911x1008 Psz 21x21
gps_allocate(91, 48)
set_viewport(): got 1911x1008 out of 1920x1025
reshape(): got grid 96x51 window -1x-1 texture_ready=1 stretch=0 snap=0
reshape(): final grid 96x51 window 1920x1025 viewport 1920x1020 Psz 20x20
gps_allocate(96, 51)
set_viewport(): got 1920x1020 out of 1920x1025
reshape(): got grid 101x53 window -1x-1 texture_ready=1 stretch=0 snap=0
reshape(): final grid 101x53 window 1920x1025 viewport 1919x1007 Psz 19x19
gps_allocate(101, 53)
set_viewport(): got 1919x1007 out of 1920x1025
reshape(): got grid 96x51 window -1x-1 texture_ready=1 stretch=0 snap=0
reshape(): final grid 96x51 window 1920x1025 viewport 1920x1020 Psz 20x20
gps_allocate(96, 51)
set_viewport(): got 1920x1020 out of 1920x1025
Logged
I think that might be one of the most dwarfen contraptions I've ever seen the blueprints of.
The Bloodwinery v1.3.1 | Dwarven Lamination v1.5 | Tileset Resizer v2.5 - Mac Beta Tester Needed
Sigtext

lxnt

  • Bay Watcher
    • View Profile
    • pm:full_graphics
Re: [PRINT_MODE:SHADER]
« Reply #57 on: November 06, 2011, 10:09:15 am »

The biggest problem with all this is that game icons are, by necessity, pixelart. This means that any resizing other than upscaling them by increments of 2 is a murder on the piece of work that they are- seriously decreasing not only their looks but most of all their readability.

Okay. Since I think that the policy on supported tile resolution/aspect ratios and such should be simple, let's limit it to this:
  • Game is intended to be played without scaling/stretching or otherwise mutilating the graphics.
  • Zoom is intended to be used to get a rough overview of the map, not a pretty one.
  • Aspect ratio is defined by the font, that is, the floor tileset.
  • If some graphics are of different aspect ratio, then they are uniformly scaled to fit inside the floor tile, centered. Resulting ugliness is the user's fault.

Since forcing interface text to the same size as the game tiles is not convenient on modern monitors, it is a project goal to make the interface drawn separately from the world view, preferably with vector fonts.

Zoom and scaling in my code is implemented by adjusting point sprite size in 1-pixel increments. Thus it is trivial to force scaling to exact integer multiple of pixels in the graphic.
Filtering is either GL_NEAREST or GL_LINEAR. While it's possible to implement some insanely complex scaler in the fragment shader, I don't think it's worth it due to the policy point 1.


How does this sound?


lxnt

  • Bay Watcher
    • View Profile
    • pm:full_graphics
Re: [PRINT_MODE:SHADER]
« Reply #58 on: November 06, 2011, 11:49:20 am »

Also tiles are not rendered in the correct size and the screen is not filled when first loading a save file. 

That one is strange. Can you please post output from the console?
Here you go.

Thank you. New version is up. Does work with standard libstdc++ too.

arclance

  • Bay Watcher
    • View Profile
Re: [PRINT_MODE:SHADER]
« Reply #59 on: November 06, 2011, 12:19:14 pm »

Thank you. New version is up. Does work with standard libstdc++ too.
Tile size is wrong at startup but F10 works now.
At startup
Spoiler (click to show/hide)
After hiting F10.
Spoiler (click to show/hide)
Code: [Select]
./df
textures::load(): data/art/Phoebus_20x20.png 320x320 16x16 20x20
textures::load(): data/art/Phoebus_20x20.png 320x320 16x16 20x20
Loading bindings from data/init/interface.txt
textures::load(): data/art/mouse.png 32x32
set_mode(): requesting vsync=0 and singlebuf=0.
set_mode(): SDL_GL_SWAP_CONTROL: 0
set_mode(): SDL_GL_ACCELERATED_VISUAL: 1
set_mode(): SDL_GL_DOUBLEBUFFER: 1
set_mode(): SDL_FULLSCREEN: 0
GLEW: 1.5.2
OpenGL vendor: NVIDIA Corporation
OpenGL renderer: GeForce GT 240/PCI/SSE2
OpenGL version: 3.3.0 NVIDIA 270.41.06
OpenGL GLSL version: 3.30 NVIDIA via Cg compiler
GL_MAX_VERTEX_ATTRIBS=16, needed=7
GL_MAX_VERTEX_UNIFORM_COMPONENTS=4096, needed=7
GL_MAX_FRAGMENT_UNIFORM_COMPONENTS=2048, needed=6
GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS=32, needed=1
GL_MAX_TEXTURE_IMAGE_UNITS=32, needed=2
GL_MAX_VARYING_FLOATS=60, needed=12
GL_MAX_TEXTURE_COORDS=8, needed=3
GL_POINT_SIZE_MIN=0, needed=4
** GL_POINT_SIZE_MAX=63, needed=64
makeansitex(): 2.
Embedded shader set 'rect'
Embedded shader set 'cbr_is_bold' x
Using embedded vertex shader code from 'cbr_is_bold'.
Using embedded fragment shader code from 'cbr_is_bold'.
GL_COMPILE_STATUS: true
GL_COMPILE_STATUS: true
GL_LINK_STATUS: true
GL_VALIDATE_STATUS: true
makeansitex(): 2.
gps_allocate(80, 25)
Resetting textures
texdumpst::init(): allocating 2048x288 (max 64x9 32x32 cells)
accepted font texture (name=1): 2048x288px oa
accepted txco texture (name=3): 64x9px oa
reshape(): got grid 0x0 window -1x-1 tile 20x20 texture_ready=1 stretch=0 snap=0
reshape(): final grid 80x25 window 1920x1000 viewport 1840x575 Psz 23x23
set_viewport(): got 1840x575 out of 1920x1000
Frame drawn in 2 msec
reshape(): got grid 96x50 window -1x-1 tile 20x20 texture_ready=1 stretch=0 snap=0
reshape(): final grid 96x50 window 1920x1000 viewport 1920x1000 Psz 20x20
gps_allocate(96, 50)
set_viewport(): got 1920x1000 out of 1920x1000
Frame drawn in 0 msec
Logged
I think that might be one of the most dwarfen contraptions I've ever seen the blueprints of.
The Bloodwinery v1.3.1 | Dwarven Lamination v1.5 | Tileset Resizer v2.5 - Mac Beta Tester Needed
Sigtext
Pages: 1 2 3 [4] 5 6 ... 23