News:

Simutrans Sites
Know our official sites. Find tools and resources for Simutrans.

A Simutrans Prettification Project + Open GL dev

Started by _Hajo_, January 31, 2023, 08:20:59 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Andarix

as far as Yona's problem is concerned

Back when I started the repos for Linux, I had the problem that the program created under Xubuntu (based on Ubuntu) crashed under Mageia (based on Fedora) with a memory access error.

Yona-TYT

Fortunately it already works again in Nightly build r10973, would it be a corrupt file?. It seems strange that it was fixed without touching anything related. ¿?  :o  :o  :o

Yona-TYT

- The gadget that resizes windows is not displayed in the correct place.
Captura desde 2023-12-25 16-22-32.png

- Station labels and previewing objects in windows only work well at a specific zoom level.

- Object previews in windows appear too dark in some cases.

Look and compare the two images below:
Captura desde 2023-12-25 16-44-06.png
Captura desde 2023-12-25 16-44-12.png

_Hajo_

Oops, something went very wrong with the labels there. I hope it wont be too hard to fix.

The resizing corner should be an easy catch, though. Luckily the zoom was the last big feature to add, now things should slowly stabilize.

And the preview windows. I had seen that they are too dark, but forgot to look into the problem. Definitely linked to the changes that I made to zoom the landscape. At least this way I won't get bored the next days ;D 

_Hajo_

The world views in the info windows should now have the right colors and work even if the main view is zoomed in or out. Also I could fix the labels so the parts stay together when the map is zoomed.

Furthermore the window size change gadget should stay in the bottom right corner during zoom. And eventually, I've changed the label shape for town labels in the silver theme to make them more distinct from station labels.

https://github.com/Varkalandar/simutrans_ts/releases/tag/Nightly

Yona-TYT

#110
- Minimap has some black buttons.

- Regarding zooming in the minimap, wouldn't it be better if the screen maintained the position of the cursor/mouse, like Google Maps does?.

Captura desde 2023-12-26 12-19-16.png

Edit.

- Maybe it's a mistake in the pakset, but there are some black lines on the slopes that  detract from the elegance of the pak72.Elegance.

- There is a strange cutout in the station coverge.
Captura desde 2023-12-26 19-08-25.png




_Hajo_

Quote from: Yona-TYT on December 26, 2023, 04:21:38 PM- Minimap has some black buttons.

- Regarding zooming in the minimap, wouldn't it be better if the screen maintained the position of the cursor/mouse, like Google Maps does?.

I can't reproduce the black buttons, on my system they show in colors. Does it happen always on your system or just with certain settings?


I agree on the zoom being centered on the mouse if one zooms by mouse. Unfortunately there quite some more problems in the minimap, which I want to fix first.

Quote from: Yona-TYT on December 26, 2023, 04:21:38 PM- Maybe it's a mistake in the pakset, but there are some black lines on the slopes that  detract from the elegance of the pak72.Elegance.

- There is a strange cutout in the station coverge.

The black lines come from rounding errors and that 72 pixels are a somewhat unusual raster size, so the code was not made for that. Right now I see no easy fix for this, I'll do it once I start to fix all the display glitches that the current code has.

Also, no idea about the cutout, but I think that's something I can fix.

Andarix

Quote from: _Hajo_ on December 27, 2023, 02:34:45 PMI can't reproduce the black buttons, on my system they show in colors. Does it happen always on your system or just with certain settings?

...

The problem also exists on Windows. You can see it in a screenshot of mine above.

Yona-TYT

Quote from: _Hajo_ on December 27, 2023, 02:34:45 PMI can't reproduce the black buttons, on my system they show in colors. Does it happen always on your system or just with certain settings?
It always happens and apparently it has been there from the beginning.

_Hajo_

Quote from: Andarix on December 27, 2023, 03:20:57 PMThe problem also exists on Windows. You can see it in a screenshot of mine above.

Yes I saw it. I couldn't reproduce it back then either, so I chose to ignore it.

Edit: That's how it look on my system.

Edit 2: The white buttons give a hint though. There is actually a difference how these get their color and how the others get their color. So I have a clue for a fix.

Andarix

Can you test it with another theme?

My guess is that when the buttons are changed by the theme, it turns black. Just like it was with the other windows.

_Hajo_

Works with any theme for me. But I see a difference how the white and how the colored buttons are initialized in the code. So I have a hint what to change.

_Hajo_

It's the github build process. The versions I compiled locally work, the one I downloaded from github does not. Must see what I do different locally.

Edit: Thanks Yona and Andarix, mystery solved! I can now go and fix this.

Yona-TYT

Quote from: _Hajo_ on December 27, 2023, 02:34:45 PMAlso, no idea about the cutout, but I think that's something I can fix.

I think this is related to the zoom out issue, as the crops match exactly the screen divisions shown in the image below:
Captura desde 2023-12-27 14-21-31.png

Edit.


Vehicle markings are drawn outside the minimap when the window is resized with zoom in.
Captura desde 2023-12-27 14-31-21.png

Andarix

simutrans ogl windows 10987

Minimap buttons work

The tab icons are not displayed in the lists or are transparent. The icons on the pak64.german are in gray color.

_Hajo_

Good to know the colored buttons work now.

I could fix the missing icons for the tabbed panels meanwhile. The vehicle display in the minimap will take longer, can't finish it today. Same for the cutout in the station coverage display.

Thanks, Yona and Andarix, for testing so busily! Alone I'd never find the mistakes so quickly.

Yona-TYT

#121
QuoteThanks, Yona and Andarix, for testing so busily! Alone I'd never find the mistakes so quickly.

Always collaborating.  ;)

Edit.
@Hajo, I suspect that the changes in gl are breaking things in the other backends, so I think we should start testing in the normal builds as well.

Can you publish the executables on Github?.

_Hajo_

I'm afraid it is not possible to build both versions from the same code base because each place that sets a color uses a color structure with 4 floats (red, green, blue, alpha) in Simutrans GL, while in Standard all these places use 16 bit integers, many of which were indices into a mapping table.

isidoro

Maybe you can abstract a "Color" class and define its properties and methods depending on which version is compiled...  On modern C++ a lot of tricks can even be done at compile time (for instance, calculate the float values from the integer ones after looking at the mapping table if that's static)...  But it all depends on what compilers you're targeting.

Andarix

windows ogl 10993

The light went out again in the minimap  8)

10993.jpg

_Hajo_

Quote from: isidoro on December 29, 2023, 12:51:15 AMMaybe you can abstract a "Color" class and define its properties and methods depending on which version is compiled...

Yes, that's a option. Still needs all these places to be changed from a simple type to a class. But it's doable.

Quote from: Andarix on December 29, 2023, 01:42:52 PMThe light went out again in the minimap  8)

Help! The darkness is consuming my work!

No idea what I did wrong this time. But I'll try to fix it. Of course my self compiled version does not show this problem, so it's a bit tricky again to find the cause. Thanks for reporting!


Andarix

windows ogl 10997

Light was turned back on. Thanks

The vehicle graphics are still missing from the lists.

Screenshot 2023-12-29 191505.png

isidoro

When I was working in my OpenGL project, I used apitrace to debug OpenGL.  I remember it to be very useful.  It's capable to "see" even textures, buffers, etc.  Just in case it's useful, since some implementations of OpenGL are more lenient to errors.

Isaac Eiland-Hall

Quote from: Andarix on December 29, 2023, 01:42:52 PMThe light went out again in the minimap

Are you playing at night?

Quote from: Andarix on December 29, 2023, 06:17:53 PMLight was turned back on.

Good morning! :)

ceeac

Quote from: isidoro on December 29, 2023, 11:45:12 PMWhen I was working in my OpenGL project, I used apitrace to debug OpenGL.  I remember it to be very useful.  It's capable to "see" even textures, buffers, etc.  Just in case it's useful, since some implementations of OpenGL are more lenient to errors.
There's also RenderDoc, but it does not work with fixed-function OpenGL.

Yona-TYT

#131
Found a bug when zooming out with pak192.comic.

gdb:
[Thread 0x7fff211266c0 (LWP 411062) exited]

Thread 3 "simutran:gdrv0" received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffdf7fe6c0 (LWP 410816)]
__pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
Downloading source file /usr/src/debug/glibc-2.38-14.fc39.x86_64/nptl/pthread_kill.c
44            return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;                                   
(gdb) where
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0)
    at pthread_kill.c:44
#1  0x00007ffff76ae8a3 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:78
#2  0x00007ffff765c8ee in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007ffff76448ff in __GI_abort () at abort.c:79
#4  0x00007fffe76fc717 in _crocus_batch_flush (batch=batch@entry=0x555555d96138,
    file=file@entry=0x7fffe96166a0 "../src/gallium/drivers/crocus/crocus_batch.h", line=line@entry=323)
    at ../src/gallium/drivers/crocus/crocus_batch.c:1022
#5  0x00007fffe8d65ca4 in crocus_require_statebuffer_space (size=2400, batch=0x555555d96138)
--Type <RET> for more, q to quit, c to continue without paging--

Capture:
Captura desde 2023-12-30 15-08-39.png

Edit.
Test 2

gdb:
(gdb) run
Starting program: /home/casa/Descargas/simulinux_gl-x64(1)/simutrans/simutrans
[Thread debugging using libthread_db enabled]                                                                             
Using host libthread_db library "/lib64/libthread_db.so.1".
warning: the debug information found in "/home/casa/Descargas/simulinux_gl-x64(1)/simutrans/lib/libXau.so.6.0.0" does not match "/home/casa/Descargas/simulinux_gl-x64(1)/simutrans/lib/libXau.so.6" (CRC mismatch).
[New Thread 0x7fffdffff6c0 (LWP 412280)]                                                                                   
[New Thread 0x7fffdf7fe6c0 (LWP 412281)]
[New Thread 0x7fff2112e6c0 (LWP 412405)]
[New Thread 0x7fff2082d6c0 (LWP 412407)]
[New Thread 0x7fff03ff56c0 (LWP 412408)]
[New Thread 0x7fff037f46c0 (LWP 412409)]
[Thread 0x7fff2112e6c0 (LWP 412405) exited]

Thread 3 "simutran:gdrv0" received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffdf7fe6c0 (LWP 412281)]
__pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
44            return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;                                   
(gdb) where
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0)
    at pthread_kill.c:44
#1  0x00007ffff76ae8a3 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:78
#2  0x00007ffff765c8ee in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007ffff76448ff in __GI_abort () at abort.c:79
#4  0x00007fffe76fc717 in _crocus_batch_flush (batch=0x555555d95ce8,
    file=file@entry=0x7fffe96163a0 "../src/gallium/drivers/crocus/crocus_batch.c", line=line@entry=597)
    at ../src/gallium/drivers/crocus/crocus_batch.c:1022
#5  0x00007fffe8c7d9e5 in crocus_batch_maybe_flush (batch=<optimized out>, estimate=<optimized out>)
--Type <RET> for more, q to quit, c to continue without paging--


Test 3

gdb:

(gdb) where
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0)
    at pthread_kill.c:44
#1  0x00007ffff76ae8a3 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:78
#2  0x00007ffff765c8ee in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007ffff76448ff in __GI_abort () at abort.c:79
#4  0x00007fffe76fc717 in _crocus_batch_flush (batch=0x555555d95948,
    file=file@entry=0x7fffe96163a0 "../src/gallium/drivers/crocus/crocus_batch.c", line=line@entry=597)
    at ../src/gallium/drivers/crocus/crocus_batch.c:1022
#5  0x00007fffe8c7d9e5 in crocus_batch_maybe_flush (batch=<optimized out>, estimate=<optimized out>)
    at ../src/gallium/drivers/crocus/crocus_batch.c:597
#6  0x00007fffe8d657e4 in crocus_simple_draw_vbo (sc=0x7fffdf7fcea0, indirect=0x0, drawid_offset=0, draw=0x7fffe9b88b18,
    ice=0x555555d953d0) at ../src/gallium/drivers/crocus/crocus_draw.c:325
--Type <RET> for more, q to quit, c to continue without paging--c
#7  crocus_draw_vbo (ctx=0x555555d953d0, info=<optimized out>, drawid_offset=0, indirect=0x0, draws=<optimized out>,
    num_draws=<optimized out>) at ../src/gallium/drivers/crocus/crocus_draw.c:438
#8  0x00007fffe7ce4791 in tc_call_draw_single (pipe=<optimized out>, call=0x7fffe9b88b10, last_ptr=<optimized out>)
    at ../src/gallium/auxiliary/util/u_threaded_context.c:3732
#9  0x00007fffe7cde979 in batch_execute (parsing=false, last=0x7fffe9b8a110, pipe=0x555555d953d0, batch=0x7fffe9b87100)
    at ../src/gallium/auxiliary/util/u_threaded_context.c:394
#10 tc_batch_execute (job=job@entry=0x7fffe9b87100, gdata=gdata@entry=0x0, thread_index=thread_index@entry=0)
    at ../src/gallium/auxiliary/util/u_threaded_context.c:445
#11 0x00007fffe774d4a1 in util_queue_thread_func (input=input@entry=0x555555d02e70) at ../src/util/u_queue.c:309
#12 0x00007fffe776e48c in impl_thrd_routine (p=<optimized out>) at ../src/c11/impl/threads_posix.c:67
#13 0x00007ffff76ac897 in start_thread (arg=<optimized out>) at pthread_create.c:444
#14 0x00007ffff77336fc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
(gdb)



Yona-TYT

- Pakset loading image is not displayed correctly.
Captura desde 2023-12-30 15-38-52.png


The minimap does not seem to completely cover the window area:
Captura desde 2023-12-30 15-59-47.png


More strange effects related to zoom (the magic numbers appear in the wrong place):
Captura desde 2023-12-30 15-58-59.png

_Hajo_

- The positions of the income/expenditure numbers should be correct now.
- The vehicles in the lists should be visible again.
- The "new map" got the map preview back.
- Likewise the city info windows got their map previews back.
- I've added a simple day/night mode, but there are no working lights at night yet.
- Alternating colored lists should show with an even right border now.

Plus some minor improvements to layout in some dialogs. I have neither investigated the crash with pak192.comic yet, nor could I fix the overdraw problem in the minimap so far. Needs more time.

I've been working on a first test with light by night, but doesn't look good, so I disabled that in the code again, till I have better graphics and better code.

Also, I've been able to merge all changes from Simutrans Standard which were pushed to github recently. That was something I was very worried about, if the code bases are still similar enough to make merges easy.

Yona-TYT

QuoteAlso, I've been able to merge all changes from Simutrans Standard which were pushed to github recently. That was something I was very worried about, if the code bases are still similar enough to make merges easy.
That's great !. 8)

_Hajo_

A title screen inches closer. I can now load and display PNG images as part of dialogs. Still have to see how to integrate that properly with themes and such. As example, the pak selector with the old Simutrans logo in the background.


Yona-TYT

- The transparency of the trees is not working as in normal simutrans. Is this the expected behavior?.
Captura desde 2024-01-03 06-22-46.png

- Activating the isometric view of the minimap no longer allows you to return to the normal view.
Captura desde 2024-01-03 06-17-33.png

_Hajo_

#137
Simutrans GL now got a title screen. The logo was designed by Seth C. Triggs long ago.

simutrans_gl_v003.png


Quote from: Yona-TYT on January 03, 2024, 05:15:28 AM- The transparency of the trees is not working as in normal simutrans. Is this the expected behavior?.
- Activating the isometric view of the minimap no longer allows you to return to the normal view.

The tree transparency is not implemented yet. It was not a priority for me so far.
I'll try to fix the minimap soon.

Edit: In the latest nightly the logo isn't truncated anymore (some pixels are missing from the top in the screenshot)

Andarix

If I could wish for something, the start screen as a patch for standard.

_Hajo_

Simutrans code keeps puzzling me. I have made a new makeobj to store 32 bit "truecolor" graphics in the pak files, including 8bit transparency, and also changed the reading code, but now some road and railroad tiles don't show anymore :o

I surely did not do anything special to scare these tiles away, all graphics are fed through the same routines. Another mystery ...

But anyways, here it is. The first screenshot with 32bit graphics. Doesn't look very special, because the input are the same old pak set sources, yet now another door is opened to make better use of slightly transparent images.