custom SDL that doesn't delete textures during resize

Moderator
Posts: 1,140
Joined: 2005.07
Post: #16
I added this in there (to ensure it doesn't crash or anything if you switch to software for an unknown reason)
Code:
// dave put this here
    if (!SDL_SharedContext || (sharedAccelerated && this->gl_config.accelerated <= 0) ||
        (!sharedAccelerated && this->gl_config.accelerated > 0))
    {
        //Further added by Aaron Barany
        if (this->gl_config.accelerated > 0)
            sharedAccelerated = TRUE;
        else
            sharedAccelerated = FALSE;
        //End further added

        fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes:attr];
        SDL_SharedContext = [[NSOpenGLContext alloc] initWithFormat:fmt shareContext:NULL];
        [fmt release];
    }
    // end dave
Gotta love these changes within changes. Rasp I thought that NoRecovery was for hardware only, but it appears to be for any context type regardless. It works on my end, hardware accelerated and software. (going from windowed, to fullscreen, back to windowed) I've updated the final version with both our changes added and it's uploaded to the same link. Thanks for the help!

BTW, as soon as I get them working (which will probably be Monday, when I'm at work and have access to the computers necessary), I can also put up 3 simple source files that will allow you to call one function before SDL_SetVideoMode and one after to set the new window's position the same as the old one's. (that way if you want to do have drag-able resizing, it won't jump around) Essentially, you include one file with your code depending on which platform you're compiling for. (one for Windows, Mac, and Linux)
Quote this message in a reply
Member
Posts: 320
Joined: 2003.06
Post: #17
Woops, forgot about that bit! Cheers Smile

I hate to have to say this... but I can't seem to get it working on windows. Sorry I know this is a mac game dev forum, but I think that there are many of us using SDL for cross platform compatibility so I'm going to talk windows anyway Rasp

My windows knowledge is very small... enough to build my app but not much more. I'm using the pre-built binaries, replaced the old dll and .lib files with the new, even replaced the include directory, re-built the game from clean, replaced the dlls in the built game's directory, and my textures are disappearing on all switches/resizes.

The binaries were from the 14th.

Any ideas? I will probably investigate further tomorrow, but as I said my knowledge is lacking in this area so I'm not all that likely to find anything.

Cheers, and at least the mac version works... if necessary I'll just make it compulsory full screen on windows... windows users are used to that sort of thing anyway!

Chopper, iSight Screensavers, DuckDuckDuck: http://majicjungle.com
Quote this message in a reply
Moderator
Posts: 1,140
Joined: 2005.07
Post: #18
Don't worry, even if it's Windows, I need to deal with Windows, too, so am very interested in making sure this works correctly. Does everything but the context sharing work? What are you using for the accelerated flag? (>0? Does 0 (software) or <0 (generic) work? Note, with the original build of SDL > 0 was generic and < 0 was full, but I changed it around to make it a little more consistent with Mac and Linux) Also, try printing out the result from GetLastError right after calling SDL_SetVideoMode, and hopefully it will have something like 2000. (invalid pixel context; Error codes are here.) Of course, I don't know, it might just reset before the end of the function with making other contexts.

It was working on my Windows machine at work, which has an integrated card from around a year or two ago, so I figured it would work. I'll probably just copy all the rest of their pixel format creation code for the case of using wglChoosePixelFormatARB (2 methods at once to create a pixel format? Blink) and see if that will work. (you might want to make sure things like adding FSAA and changing bit depth still works, though) I guess it doesn't surprise me that it doesn't work always with how complicated it is to get that damn thing set up in Windows, but it certainly would have been nice to have it working after all that work. Mad I swear, I've learned more about Windows in the past couple of months than I care to. Cry
Quote this message in a reply
Moderator
Posts: 1,140
Joined: 2005.07
Post: #19
I have uploaded both a new Mac and Windows version. I discovered that it has the accelerated value negative by default, and that caused my code to create the shared context every time if you didn't specify the acceleration. I have tweaked both the Mac and Windows code so that if their accelerated flag is 0 it's software, otherwise (positive or negative) it's fully accelerated.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Showing resize control over NSOpenGLView AnotherJake 14 7,709 Oct 25, 2004 06:13 PM
Last Post: AnotherJake