Comments (8)
I take it this sample's missing some characters... which tex is tex
?
from fna.
Ahh, sorry, tex = tex1. Also, tex2 is drawn using the same width/height of tex1.
Updated sample.
from fna.
What's likely happening is that we're binding the GL texture handle for tex2, then when tex1 is destroyed there's no handle to bind, so it just sticks with tex2.
If you have a full trace of the XNA error that'll tell us when and where we need to perform this check.
from fna.
System.ObjectDisposedException was unhandled
HResult=-2146232798
Message=Cannot access a disposed object.
Object name: 'Texture2D'.
ObjectName=Texture2D
Source=Microsoft.Xna.Framework
StackTrace:
at Microsoft.Xna.Framework.Helpers.CheckDisposed(Object obj, IntPtr pComPtr)
at Microsoft.Xna.Framework.Graphics.TextureCollection.set_Item(Int32 index, Texture value)
at Microsoft.Xna.Framework.Graphics.SpriteBatch.RenderBatch(Texture2D texture, SpriteInfo[] sprites, Int32 offset, Int32 count)
at Microsoft.Xna.Framework.Graphics.SpriteBatch.Flush()
at Microsoft.Xna.Framework.Graphics.SpriteBatch.End()
at XNA_TEST.Game1.Draw(GameTime gameTime) in C:\Users\Bram\Documents\Lode Runner\XNA_TEST\XNA_TEST\XNA_TEST\Game1.vb:line 74
at Microsoft.Xna.Framework.Game.DrawFrame()
at Microsoft.Xna.Framework.Game.Tick()
at Microsoft.Xna.Framework.Game.HostIdle(Object sender, EventArgs e)
at Microsoft.Xna.Framework.GameHost.OnIdle()
at Microsoft.Xna.Framework.WindowsGameHost.RunOneFrame()
at Microsoft.Xna.Framework.WindowsGameHost.ApplicationIdle(Object sender, EventArgs e)
at System.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FDoIdle(Int32 grfidlef)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Microsoft.Xna.Framework.WindowsGameHost.Run()
at Microsoft.Xna.Framework.Game.RunGame(Boolean useBlockingRun)
at Microsoft.Xna.Framework.Game.Run()
at XNA_TEST.Program.Main(String[] args) in C:\Users\Bram\Documents\Lode Runner\XNA_TEST\XNA_TEST\XNA_TEST\Program.vb:line 9
InnerException:
from fna.
Sidenote: Wow that SpriteBatch trace looks a LOT like FNA's before I rewrote it last month.
On topic: It looks like it's checked in the TextureCollection, so probably right here:
https://github.com/FNA-XNA/FNA/blob/master/src/Graphics/TextureCollection.cs#L28
Seems like a fair check. I would probably just do it in DEBUG mode only though. Try adding a disposed check there and see if it works for you.
from fna.
This what you had in mind? Works as per XNA (albeit rather cheaper). Any plans to tart it up and add to FNA so it matches XNA?
public Texture this[int index]
{
get
{
return textures[index];
}
set
{
// poor man's substitute for Microsoft.Xna.Framework.Helpers.CheckDisposed(Object obj, IntPtr pComPtr)
if (value.IsDisposed)
{
throw new System.ObjectDisposedException("Texture2D", "Cannot access a disposed object.");
}
textures[index] = value;
if (!modifiedSamplers.Contains(index))
{
modifiedSamplers.Enqueue(index);
}
}
}
from fna.
Cool, I'll write this in on Monday.
from fna.
from fna.
Related Issues (20)
- Fn HOT 2
- [MojoShader] Preshaders with bool outputs aren't supported HOT 3
- mono_thread_internal_set_priority: unknown policy 5
- Expose FAudioContext or Device Handle HOT 3
- arm64 fnalibs for Apple Silicone Macs HOT 3
- Add GitHub Actions HOT 1
- Terraria: sigsegv when using vulkan renderer in newer versions of FNA HOT 3
- Add DPI Awareness hint for Windows
- Do a second take of #442 HOT 1
- Support for net8.0-ios targets HOT 2
- Incorrect Wiki instructions: Chapter 5 Creating New Projects HOT 1
- SharpFont + SpriteFont HOT 2
- VertexPositionColorNormalTexture HOT 3
- System.NullReferenceException when using BasicEffect HOT 2
- Question about the process of porting NativeAOT to Consiles HOT 3
- Newer Shader Models
- Add extension method for loading mipmap texture from stream HOT 3
- White artifacts on certain color values in DDS HOT 5
- [BUG] Can't download clone the Wiki HOT 1
- Proxy Blade Zero (313980): Black Screen issue
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.