Comments (26)
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.
I don't believe i am. Do i need to call Game.Dispose() before the call to Exit()?
from fna-mghistory.
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.
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.
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.
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.
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.
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.
I get; "Video subsystem has not been initialized", that doesn't sound good :/.
from fna-mghistory.
o_o That would mean that SDL_Init(SDL_INIT_VIDEO) failed... is this a virtual machine?
from fna-mghistory.
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.
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.
Well im extremely new to Linux, and well i'm not sure where exactly to copy the Libs too :(
from fna-mghistory.
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.
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.
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():
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.
well even worse then that it says "No available video device".. Now that sounds really bad :/
from fna-mghistory.
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.
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.
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.
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.
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.
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.
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.
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.
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)
- shader normalmap not work HOT 3
- Can't run on machine without audio device HOT 9
- [OpenGL] VMware/VBox Support? HOT 7
- [MojoShader] MOJOSHADER_glSetVertexAttribDivisor causes 'System.AccessViolationException' on some computers HOT 3
- [Keyboard] Proposal for Keyboard.GetLayoutEXT() HOT 1
- Microsoft.Xna.Framework.Input.GamePad.INTERNAL_AddInstance throws "An element with the same key already exists in the dictionary" HOT 2
- Triangle color is wrong with fairly simple shader + access violation exception HOT 7
- Unable to load a texture (.PNG) from stream HOT 9
- Initialization order mishap HOT 3
- GraphicsDeviceManager never set in Game HOT 1
- GL Object Disposal Wrappers are not thread-safe HOT 3
- DynamicSoundEffectInstance behavior incompatible with XNA4 HOT 8
- OpenGL 3.2+ Core Profile support HOT 4
- Starting game in full screen bug HOT 8
- Null reference when disposing sound effect after checking sound device exists HOT 5
- [QUESTIONS] learning, using FNA HOT 3
- More spec-compliant Touch Support HOT 34
- FNA Binary Release HOT 1
- RasterizerState.MultiSampleAntiAlias not implemented HOT 8
- Set Render Target to Another Window HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fna-mghistory.