Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
57 user(s) are online (30 user(s) are browsing Forums)

Members: 4
Guests: 53

Reynolds, walkero, orgin, ddni, more...

Headlines

 
  Register To Post  

« 1 ... 58 59 60 (61) 62 63 64 »
Re: SDL2
Just can't stay away
Just can't stay away


See User information
@kas1e

testnative is the example. I noticed it crashes at the moment on exit. I changed the quit function https://github.com/AmigaPorts/SDL-2.0/ ... ain/test/testnative.c#L51 to something like:

quit(int rc)
{
    
// SDL_VideoQuit() was here
    
if (native_window) {
        
factory->DestroyNativeWindow(native_window);
    }
    
SDL_VideoQuit(); // fixed 0xdeadbeef crash
    
SDL_Quit(); // fixed unfreed signal
    
exit(rc);
}


What are you planning to do with a native window?

Go to top
Re: SDL2
Home away from home
Home away from home


See User information
@Capehill
Quote:

What are you planning to do with a native window?


To make it short : some old 68k code have very ugly FLC player routine, and there is very simple and clean SDL based player: https://www.libsdl.org/projects/flxplay/.

So i want just to start a game, and attach to the screen it opens, play the video via sdl code, and then back to the original game.

Also i want to add "auto-scale" in this player if possible, so video will be played full-screen, but didn't know how easy or good it will be with SDL, maybe better compositing or whatever else ..

Go to top
Re: SDL2
Just can't stay away
Just can't stay away


See User information
@kas1e

testnative example is using SDL_Renderer so it should be able to cope with scaling. But I expect there will be some issues, it's not tested much, after all.

Event handling could be problematic. If you check testnative, you can see it gets the shared WA_UserPort message port from SDL. This must be given for the window so that SDL can get events. Not sure if it can changed after window creation (should be checked from Autodocs). But maybe it's enough for you to handle only application events, not SDL ones.

Go to top
Re: SDL2
Site Builder
Site Builder


See User information
@capehill
Are there any differences in how SDL2 for OS4 works under different color depth screens?

I am investigating the following problem with the latest Lite XL (https://git.walkero.gr/walkero/lite-xl/issues/16) that has to do with running it on 16bit screens.

As you might see from the screen, the app looks bad anywhere there is text drawn. I tested it on multiple OS4 computers.

In parallel, I am working on the MorphOS version and tested it on a 16bit screen as well, and the problem does not appear there. It was tested on the same machine with the exact same graphics card, which is my main X5000 with a RadeonHD 6850 gfx card. And the code is the same on both machines.

So, my question is, is there something from the SDL port that breaks things with the rendered text?

I will continue the investigation, in case there is something that could help.

Go to top
Re: SDL2
Quite a regular
Quite a regular


See User information
Hi, I "updated" flxplayer to SDL2, it works, but the video it plays shows color palette totally garbled colors.

If anyone can check what I'm doing wrong (can ask for sources via PM too), any help will be appreciated. TiA

Part of code I added/updated:
...
  
SDL_Surface *mainscreen;
...
SDL_Window *win;
SDL_Renderer *ren;
SDL_Texture *tex;
...
/* Init screen
*/
  //if((flc.mainscreen=SDL_SetVideoMode(flc.screen_w, flc.screen_h, flc.screen_depth, (SDL_HWPALETTE/*|SDL_FULLSCREEN*/))) == NULL){
if( (flc.mainscreen SDL_CreateRGBSurface(0flc.screen_wflc.screen_hflc.screen_depth,
                                        
0,0,0,0)) == NULL ) {// RGBA
                                        /*0x00FF0000,
                                        0x0000FF00,
                                        0x000000FF,
                                        0xFF000000)) == NULL ) {*/
    
DebugPrintF("SDL: Couldn't set video mode %dx%dx%d: %s\n"flc.screen_wflc.screen_hflc.screen_depthSDL_GetError());
  }
SDL_CreateWindowAndRenderer(flc.screen_wflc.screen_hmode, &flc.win, &flc.ren);
flc.tex SDL_CreateTexture(flc.ren,
                            
SDL_PIXELFORMAT_RGB332,
                            
SDL_TEXTUREACCESS_STREAMING,
                            
flc.screen_wflc.screen_h);
//flc.tex = SDL_CreateTextureFromSurface(flc.ren, flc.mainscreen);
//SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear"); // make the scaled rendering look smoother.
//SDL_RenderSetLogicalSize(flc.ren, 640, 480);
}// SDLInit
...
    
//SDL_SetColors(flc.mainscreen, flc.colors, NumColorsSkip, i);
SDL_SetPaletteColors(flc.mainscreen->format->paletteflc.colorsNumColorsSkipi);
...
      
//SDL_UpdateRect(flc.mainscreen, 0, 0, 0, 0);
SDL_UpdateTexture(flc.texNULLflc.mainscreen->pixelsflc.mainscreen->pitch);
SDL_RenderClear(flc.ren);
//SDL_Rect dstrect = { 0, 0, 640, 480 };
SDL_RenderCopy(flc.renflc.texNULLNULL);//&dstrect);
SDL_RenderPresent(flc.ren);


EDIT: as you can "see" I don't know anything about SDL/SDL2 I just followed https://wiki.libsdl.org/MigrationGuide

Go to top
Re: SDL2
Quite a regular
Quite a regular


See User information
I uploaded an archive with source SDL exec SDL2 exec and test2.fli (~400KB
video is from mplayer test page.

http://jabirulo.byethost13.com/temp/flexplay.7zip

The same video shows Ok under SDLv1 and ugly palette with SDL2.
Is there a way I can see/get SDLv1 PIXELFORMAT it's using?

TiA

Go to top
Re: SDL2
Just can't stay away
Just can't stay away


See User information
@jabirulo

Please check return values of all functions. For example, if SDL_Surface doesn't have a palette (==NULL palette), setting palette colours would fail:

https://github.com/libsdl-org/SDL/blob ... c/video/SDL_pixels.c#L713

I also wonder whether it would be better to call SDL_SetSurfacePalette instead of poking into surface directly.

I haven't tried any of these palette things so cannot say much without experimenting.

Go to top
Re: SDL2
Just can't stay away
Just can't stay away


See User information
@walkero

I need to test it myself. Is the drawing logic still 32-bit in general?

Go to top
Re: SDL2
Just popping in
Just popping in


See User information
@Capehill
But it's 16-Bit Mode He requests Should he really need to use a palette, shouldn't he use type setRGB for the colors he need.
looks on the picture like a common RGB Format error, for instance ARGB versus ABRG (examples only), the screenmode prefs program should tell what it is (I think)?!

Go to top
Re: SDL2
Quite a regular
Quite a regular


See User information
@Capehill

Yes I'll check return values, I just made a quick&dirty "update to SDL2". TiA

EDIT: not sure, but maybe in flxplayer.c COLORS256() and DECODE_COLOR() functions need to be "adapted" to use SDL2 or I'm using a very very wrong PIXELFORMAT in SDL_CreateTexture()


Edited by jabirulo on 2022/5/7 10:40:32
Edited by jabirulo on 2022/5/7 10:58:50
Go to top
Re: SDL2
Site Builder
Site Builder


See User information
@Capehill
Quote:
I need to test it myself. Is the drawing logic still 32-bit in general?


Yeah. No changes at the code between 32bit and 16bit.

The font rendereing is done at the following section of the code, where they blend 3 colors. There is the problem.

https://git.walkero.gr/walkero/lite-xl ... s4/src/renderer.c#290-295

We also tried to use SDL_GetRGBA() and then SDL_MapRGBA() to do the blend but didn't make so much of a difference.

The Window Pixel format in a 16bit screen is RGB565, if that helps at all.

Go to top
Re: SDL2
Just can't stay away
Just can't stay away


See User information
@walkero

Ok so I started to get a crash when trying 16-bit mode (please see the Lite thread).

Assuming application is using the SDL_Renderer subsystem, is there any difference between software-opengles2-compositing?

Go to top
Re: SDL2
Site Builder
Site Builder


See User information
I tested it between all the different modes, and there was no change.

Go to top
Re: SDL2
Just can't stay away
Just can't stay away


See User information
@walkero

But is SDL_Renderer used or not? Define seems to be commented out in makefile. https://git.walkero.gr/walkero/lite-xl ... anch/os4/Makefile.os4#L19 which indicates window framebuffer is used.

If window framebuffer is used instead of SDL_Renderer, it depends on screen depth of the window. But this cannot work if application assumes 32-bit bitmap. Application must inspect the surface and adapt. Pitch, colour mapping and so on.

If the same (window framebuffer using) code works on MorphOS, it probably means MorphOS uses 32-bit bitmap for framebuffers so application expectations are fulfilled.

Go to top
Re: SDL2
Site Builder
Site Builder


See User information
@Capehill
Quote:
Define seems to be commented out in makefile...

When the SDL_Renderer is enabled the app works fine even on 16bit screens, but unfortunately, it gets slower as well.

So, I prefer to not have it enabled and get more speed. On both OS4 and MorphOS builds I tested with 16bit, the SDL_Renderer was not used.

Quote:
...it probably means MorphOS uses a 32-bit bitmap for framebuffers so application expectations are fulfilled

I see. And what is the right way to do that? I mean, should the application adapt to screen depth or should this happen from SDL automatically? Would something like that be beneficial for applications and games ported from other systems, where they are used to have a 32-bit colour depth screen always?

Go to top
Re: SDL2
Just can't stay away
Just can't stay away


See User information
@walkero Quote:

When the SDL_Renderer is enabled the app works fine even on 16bit screens, but unfortunately, it gets slower as well.


Application allocates 32-bit surface https://git.walkero.gr/walkero/lite-xl ... h/os4/src/renwindow.c#L49 . That's why 32-bit rendering logic works.

Operating system has to convert data from 32-bit to 16-bit. When testing SDL2 (testsprite2 program) on a 16-bit screen mode, I noticed slowdown seems to depend on the used render driver (compositing vs. opengles2 vs software).

Quote:

I see. And what is the right way to do that? I mean, should the application adapt to screen depth or should this happen from SDL automatically? Would something like that be beneficial for applications and games ported from other systems, where they are used to have a 32-bit colour depth screen always?


SDL2 currently adapts to screen depth. https://github.com/AmigaPorts/SDL-2.0/ ... /SDL_os4framebuffer.c#L35

Application has to know the surface/bitmap format before writing to it. If application could only render in 16-bit, then it would work wrongly if SDL2 uses a 32-bit framebuffer.

So, if you would like to support different bitmap formats in framebuffer mode, you should branch the renderer logic.

Go to top
Re: SDL2
Site Builder
Site Builder


See User information
@Capehill
Thank you for the explanation and your help.
I will be away from my Amiga for a couple of weeks, and I will recheck all these when I will be back.

Go to top
Re: SDL2
Home away from home
Home away from home


See User information
@Capehill

Quote:

Please check return values of all functions. For example, if SDL_Surface doesn't have a palette (==NULL palette), setting palette colours would fail:

https://github.com/libsdl-org/SDL/blob ... c/video/SDL_pixels.c#L713

I also wonder whether it would be better to call SDL_SetSurfacePalette instead of poking into surface directly.

I haven't tried any of these palette things so cannot say much without experimenting.


One man from freelance sites rewrote this for us, and that what he do:

1. Create 8bit SDL_surface with palette the same as it was with SDL1.2
2. When we draw, we convert it to 32bit ones.
3. Copy this over texture which is shown in the window
4. All other stuff like window-init-creation-etc from "migration guide".

He also says that textures always in ARGB-32 , dunno why he says so. And not sure if it all correct or not, but it works at least.

Now we need to add somehow some programm filters , like HQ2x or so, but i do not know what one is the best for the videos. HQ2x as far as i know good only for the pictures with with clean rounds..

In meantime i use "SDL_SetHint (SDL_HINT_RENDER_SCALE_QUALITY, "2")", this is not as good as filters, but better than without.

Go to top
Re: SDL2
Quite a regular
Quite a regular


See User information
@jabirulo

Looks it was "easy", just use "SDL_ConvertSurfaceFormat()" before "painting frame.

NOTE: yep replying to myself X-)

Go to top
Re: SDL2
Quite a regular
Quite a regular


See User information
Hi, is there some way to open a window on and amigaos "struct Screen"?

I open a screen using OpenScreenTags(), then I want to put some image/video on such screen.

And the want to:
SDL_CreateWindow()
SDL_CreateRenderer()
..
on such screen.

Any idea?
TiA

Go to top

  Register To Post
« 1 ... 58 59 60 (61) 62 63 64 »

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2016 The XOOPS Project