Login
Username:

Password:

Remember me



Lost Password?

Register now!
Sections
Who's Online
37 user(s) are online (33 user(s) are browsing Forums)

Members: 0
Guests: 37

more...
Support us!
Recent OS4 Files
OS4Depot.net
Report message:*
 

Re: SDL1 open issues

Subject: Re: SDL1 open issues
by kas1e on 2019/1/27 19:27:23

@Capehill
I think i found what issues is (at least in that test code).

There is original part of code:

void sys_resizeint widthint heightint callfrom )
{

    
SDL_Surface screen;
    
Uint32 flags;

    if(
width 958width 958;      // don't resize below this
    
if(height 750height 750;
    
ignore callfrom;
    
screen SDL_GetVideoSurface();
    
flags screen->flags/* Save the current flags in case toggling fails */
    
SDL_EnableKeyRepeat0);

    
screen SDL_SetVideoModewidthheightscreen->format->BitsPerPixelscreen->flags);

    
SDL_Delay(300);
    
//fprintf(stderr,"Called x: %i y: %in",width,height);
    
SDL_EnableKeyRepeatSDL_DEFAULT_REPEAT_DELAYSDL_DEFAULT_REPEAT_INTERVAL );
    if(
screen == NULL) {
           
screen SDL_SetVideoMode(000flags); /* If failed, then switch back */
    
}
    
SDL_EnableKeyRepeatSDL_DEFAULT_REPEAT_DELAYSDL_DEFAULT_REPEAT_INTERVAL );
    if(
screen == NULL) {
           
fprintf(stderr,"Video-Error on window resize. Terminatingn");
           
sys_exit(1); /* If you can't switch back for some reason, then epic fail */
    
}
    
ResizeWindow(width,height);

}



And that didn't works. Window resizes , but black screen. Same to switch to fullscreen (its from another funciton, but i t also call that one in end).

But once i just change that line:

screen = SDL_SetVideoMode( width, height, screen->format->BitsPerPixel, screen->flags);

on that one:

screen = SDL_SetVideoMode( width, height, screen->format->BitsPerPixel, SDL_OPENGL | SDL_RESIZABLE);

Everything start works as expected. I.e. just change screen->flags on SDL_OPENGL | SDL_RESIZABLE.

What is more interesting, that in the debug output, flags in both cases are same OPENGL RESIZABLE. But in first case , when screen->flags is used, i have that kind of output when trying to resize window:

[os4video_SetVideoModeRequesting new video mode 958x750x32
[os4video_SetVideoModeRequested flagsOPENGL RESIZEABLE
[os4video_SetVideoModeCurrent mode 1202x750x32
[os4video_SetVideoModeCurrent mode flags OPENGL RESIZEABLE
[os4video_SetVideoModeCurrent hwdata 0x596B4794
[os4video_SetVideoModeCreating new display
[os4video_SetVideoModeDeleting old display
[os4video_GL_TermHere
[os4video_DeleteCurrentDisplayClosing window 0x62996018
[os4video_SetVideoModeOpening new display
[os4video_CreateDisplayCreating a 958x750x32 windowed display
[os4video_CreateDisplayScreen depth32 pixel format6
[os4video_GetBestWindowPositionVisible screen: (0,0)/(1920x1080)
[
os4video_OpenWindowTrying to open window at (476,149of size (958x750)
[
os4video_GL_InitInitializing MiniGL (window 0x62996018)...
[
os4video_AllocateBitMapAllocating bitmap 958*750*16
[os4video_AllocateBitMapAllocating bitmap 958*750*16
[os4video_SetVideoMode] New display created
[os4video_SetVideoModeObtained flagsOPENGL RESIZEABLE
[os4video_ShowWMCursorSetting cursor 0x639F6010
[os4video_ResetCursorCursor image set


And that one, when all works, when i only change screen->flags on SDL_OPENGL | SDL_RESIZABLE:

[os4video_SetVideoModeRequesting new video mode 1154x750x32
[os4video_SetVideoModeRequested flagsOPENGL RESIZEABLE
[os4video_SetVideoModeCurrent mode 958x750x32
[os4video_SetVideoModeCurrent mode flags OPENGL RESIZEABLE
[os4video_SetVideoModeCurrent hwdata 0x596B4794
[os4video_SetVideoModeResizing window1154x750
[os4video_PIXF2BitsUnknown pixelformat 0
[os4video_InitOffScreenBufferAllocating a 1156x752x0 off-screen buffer with pixel format 0SWSURFACE
[os4video_InitOffScreenBufferPixels 0x62E6E000pitch 1168
[os4video_AllocateBitMapAllocating bitmap 1154*750*16
[os4video_AllocateBitMapAllocating bitmap 1154*750*16
[os4video_ShowWMCursorSetting cursor 0x639FB010


See, it tries to resize then.

Question is : wtf ! Maybe that code produce something weird:

SDL_Surface screen;
screen SDL_GetVideoSurface();


So, while in serial output we have same OPENGL RESIZABLE words, it still have something else in screen->flags, which make calling of os4video_SetVideoMode's Resizing window() skips ?

Powered by XOOPS 2.0 © 2001-2016 The XOOPS Project