Git Product home page Git Product logo

Comments (26)

flibitijibibo avatar flibitijibibo commented on August 20, 2024

Are you Disposing the Game? These would fail if you're letting the GC
handle it.
On Jun 17, 2013 12:14 PM, "drandell" [email protected] wrote:

Creating a new plain project (i.e. the cornflower blue window), when
closing the project i receive a system access violation on the following
lines in SDL2_GameWindow.cs in the INTERNAL_Destroy() function;

    GL.DeleteFramebuffer(INTERNAL_glFramebuffer);
    GL.DeleteTexture(INTERNAL_glColorAttachment);
    GL.DeleteTexture(INTERNAL_glDepthStencilAttachment);

Am i doing not linking in or creating something correctly?


Reply to this email directly or view it on GitHubhttps://github.com//issues/104
.

from fna-mghistory.

drandell avatar drandell commented on August 20, 2024

I don't believe i am. Do i need to call Game.Dispose() before the call to Exit()?

from fna-mghistory.

flibitijibibo avatar flibitijibibo commented on August 20, 2024

There are typically two uses:

using (MyGame theGame = new MyGame())
{
    theGame.Run();
}

Or...

MyGame theGame = new MyGame();
theGame.Run();
theGame.Dispose();

Either of those two will work. You basically want the Dispose call to be the very last thing you do in your program.

from fna-mghistory.

drandell avatar drandell commented on August 20, 2024

Works perfectly 👍 off-topic; but whats the status of the SDL2 version on Linux? I tried running this on linux *making a new plain project, and well i get an error when returning from GameWindow

from fna-mghistory.

flibitijibibo avatar flibitijibibo commented on August 20, 2024

The SDL2 project was built on a Linux box primarily. :)

The SDL2 project works on Windows, Mac and Linux without modifications. In fact, the binaries you just built on Windows should run natively on Linux if you've got the native libs.

Right now, the WindowsGL, MacOS and Linux projects are borked; my intention is to have them destroyed in the near future. Use the SDL2 project on all three.

If you run into problems with the SDL2 project, throw a stack trace at me and I'll have a look.

from fna-mghistory.

flibitijibibo avatar flibitijibibo commented on August 20, 2024

Oh! And be sure you have SDL2#.dll.config and TheoraPlay#.dll.config in the output folder. Still trying to figure out how to automatically copy those...

from fna-mghistory.

drandell avatar drandell commented on August 20, 2024

I didn't know about copying SDL2#.dll.config to the output. Thanks for the heads up. Here is the stacktrace i recieve from monodevelop;

OpenTK.Graphics.GraphicsContextMissingException: No context is current in the calling thread (ThreadId: 1).
at OpenTK.Graphics.OpenGL.ErrorHelper..ctor (IntPtr context) [0x00010] in /home/danielrandell/Dropbox/SDL 2/MonoGameSDL2/ThirdParty/SDL2#/src/MiniTK/Graphics/OpenGL/ErrorHelper.cs:63
at OpenTK.Graphics.OpenGL.GL.GenFramebuffers (Int32 n, System.Int32& framebuffers) [0x00000] in /home/danielrandell/Dropbox/SDL 2/MonoGameSDL2/ThirdParty/SDL2#/src/MiniTK/Graphics/OpenGL/GL.cs:49969
at Microsoft.Xna.Framework.SDL2_GameWindow..ctor () [0x000e8] in /home/danielrandell/Dropbox/SDL 2/MonoGameSDL2/MonoGame.Framework/SDL2/SDL2_GameWindow.cs:618
at Microsoft.Xna.Framework.SDL2_GamePlatform..ctor (Microsoft.Xna.Framework.Game game) [0x0000e] in /home/danielrandell/Dropbox/SDL 2/MonoGameSDL2/MonoGame.Framework/SDL2/SDL2_GamePlatform.cs:124
at Microsoft.Xna.Framework.GamePlatform.Create (Microsoft.Xna.Framework.Game game) [0x00000] in /home/danielrandell/Dropbox/SDL 2/MonoGameSDL2/MonoGame.Framework/GamePlatform.cs:92
at Microsoft.Xna.Framework.Game..ctor () [0x0020d] in /home/danielrandell/Dropbox/SDL 2/MonoGameSDL2/MonoGame.Framework/Game.cs:141
at TestSDL2.Game1..ctor () [0x00000] in :0
at TestSDL2.Program.Main () [0x00000] in /home/danielrandell/Projects/TestSDL2/TestSDL2/Program.cs:20

from fna-mghistory.

flibitijibibo avatar flibitijibibo commented on August 20, 2024

https://github.com/flibitijibibo/MonoGame/blob/monogame-sdl2/MonoGame.Framework/SDL2/SDL2_GameWindow.cs#L594

This line would be where the issue starts. When we initialize the window, we also create a GLContext, then make it current on this thread. If context creation fails, however, the subsequent OpenGL calls will fail claiming there's no context, since we're setting the current context to IntPtr.Zero.

If you want to see if SDL2 gives an error, add System.Console.WriteLine(SDL.SDL_GetError()); after the CreateContext call and see what it tells you. Usually the cause for that failing is a problem with the current OpenGL driver; SDL2 might be a bit more specific than that.

from fna-mghistory.

drandell avatar drandell commented on August 20, 2024

I get; "Video subsystem has not been initialized", that doesn't sound good :/.

from fna-mghistory.

flibitijibibo avatar flibitijibibo commented on August 20, 2024

o_o That would mean that SDL_Init(SDL_INIT_VIDEO) failed... is this a virtual machine?

from fna-mghistory.

drandell avatar drandell commented on August 20, 2024

Nope i'm running on Linux Mint 15 on my laptop. I used to use SDL before, and well i don't think i've ever seen this error :/

from fna-mghistory.

flibitijibibo avatar flibitijibibo commented on August 20, 2024

Ah, might be that SDL2 missed the X11 backend then.

Here are all the native libs you might use for MG-SDL2, both 32- and 64-bit:

http://www.flibitijibibo.com/mgsdl2Deps_Linux.tar.bz2

Odds are you won't need most of them, but just in case 🤷. These are the same ones that shipped in Capsized.

from fna-mghistory.

drandell avatar drandell commented on August 20, 2024

Well im extremely new to Linux, and well i'm not sure where exactly to copy the Libs too :(

from fna-mghistory.

flibitijibibo avatar flibitijibibo commented on August 20, 2024

In this case you can just throw the libs into the output folder, no "lib" folder needed (copy the architecture you're running), but when you distribute you'll want to use MonoKickstart, which I put in 'ThirdParty/' (the README in there elaborates a bit more... also, it works for OSX too, not just Linux).

If you want a good MG-SDL2 example and bought Humble Bundle 8, definitely take a look at Capsized. You can pretty much rip that game off as much as you like. Gateways, Blueberry Garden and Fez will all be using this stuff as well, once they actually ship.

from fna-mghistory.

drandell avatar drandell commented on August 20, 2024

Well done what you said, as you can see; http://imgur.com/j6wSTC1,c7PhBa1
but i still get the "Video subsystem has not been initialized" which then leads onto http://imgur.com/j6wSTC1,c7PhBa1#1

from fna-mghistory.

flibitijibibo avatar flibitijibibo commented on August 20, 2024

Hm, well if the Mono architecture is the same as the native lib architecture, you'll need the SDL.SDL_GetError() output after SDL.SDL_Init():

https://github.com/flibitijibibo/MonoGame/blob/monogame-sdl2/MonoGame.Framework/SDL2/SDL2_GameWindow.cs#L551

If it says something about lack of an SDL video driver, it's probably using the one in LD_LIBRARY_PATH, so you'll want to either uninstall your build or rebuild SDL2 with the X11 development headers. I'm actually not entirely sure what the name of that package is in Mint; for Fedora we usually just 'yum-builddep SDL'.

from fna-mghistory.

drandell avatar drandell commented on August 20, 2024

well even worse then that it says "No available video device".. Now that sounds really bad :/

from fna-mghistory.

flibitijibibo avatar flibitijibibo commented on August 20, 2024

Yeah, sounds like your SDL2 lib is missing the X11 device. Uninstall your
version, it'll know to pick the locally bundled lib once that's gone.
On Jun 17, 2013 7:16 PM, "drandell" [email protected] wrote:

well even worse then that it says "No available video device".. Now that
sounds really bad :/


Reply to this email directly or view it on GitHubhttps://github.com//issues/104#issuecomment-19581366
.

from fna-mghistory.

drandell avatar drandell commented on August 20, 2024

So i've installed "libx11-dev" and cleaned my install of SDL2. Running the ./configure of SDL2 however tells me this;
http://imgur.com/H4vObXT (It says i don't have the headers but going into usr/include i see the X11 folder with headers :S)

Edit:
Looking in my folder actually i don't have those extensions (i'm guess those relate to distro specific options?) But its that "OpenGL (GLX) support... no" line that worries me. ". I have a build of my game running fine using the monogame.framework.linux project, so im sure i have OpenGL support.

from fna-mghistory.

flibitijibibo avatar flibitijibibo commented on August 20, 2024

Yeah, it's SDL2's fault here... I'm not sure how it's missing the headers though.

I just looked this up, maybe sudo apt-get build-dep libsdl1.2 will get us everything needed to build?

from fna-mghistory.

drandell avatar drandell commented on August 20, 2024

I think that may have actually done the trick ;). I installed SDL 1.2-dev from the package manager and running ./configure i know see that opengl support = yes :D. Just running a make, make install now. Will update this comment on if successful fingers crossed

Edit:
Well this is very odd now. http://imgur.com/kMR9J7r - DLL not found, but as you can see its in my output folder and in my root usr/local/lib (from the building of SDL2)

from fna-mghistory.

flibitijibibo avatar flibitijibibo commented on August 20, 2024

And the architectures of SDL2 and Mono are the same? Usually the only reason this happens is because either the proper architecture is missing or we're missing dependencies for that lib, but since we've just built SDL2... hm. I would think Mint 64-bit would use Mono 64-bit in its repo too, so I'm not sure.

from fna-mghistory.

drandell avatar drandell commented on August 20, 2024

Well i copied in the files i had built from usr/local/lib and it compiles and runs :D .. Just a small thing though, this is the full-screen window i get http://i.imgur.com/g59opDS.jpg

Personally i won't be using full-screen, i just forgot to change that in the code. But it looks to be set to a default res, guessing 640x480?

from fna-mghistory.

flibitijibibo avatar flibitijibibo commented on August 20, 2024

We play a little trick in the SDL2 window. In reality, we never leave the desktop resolution; we simulate the various resolutions with an internal FBO. So the real resolution is your desktop resolution, and always will be.

However, it should never actually tell you that we're doing this, it should only tell you the resolution that you ask for. By default we start at 800x600 windowed, but this is immediately overridden by the GraphicsDeviceManager preferences. Do you by chance use the ClientBounds of the window in your code?

Edit: This thing: https://github.com/flibitijibibo/MonoGame/blob/monogame-sdl2/MonoGame.Framework/SDL2/SDL2_GameWindow.cs#L174

If so, the fix is on our end; we probably just need to use the INTERNAL_glFramebuffer dimensions.

from fna-mghistory.

drandell avatar drandell commented on August 20, 2024

The only change i make to anything relating to the window is setting the PrefferedWidth/Height values. But thats in my main project, the project that i was compiling then was really just the bare-bones cornflowerblue screen.
But for my main project, everything works perfectly now :)

from fna-mghistory.

flibitijibibo avatar flibitijibibo commented on August 20, 2024

Excellent, glad we finally got it working. I'll have to look at the Game1 Blue Screen (I still don't know if that project has a real name); I thought I had it working when looking at an upstream MonoGame issue, but maybe I screwed it up somewhere.

Let me know if you find anything else.

from fna-mghistory.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.