GithubHelp home page GithubHelp logo

Comments (8)

flibitijibibo avatar flibitijibibo commented on August 16, 2024

I take it this sample's missing some characters... which tex is tex?

from fna.

QuarkRobot avatar QuarkRobot commented on August 16, 2024

Ahh, sorry, tex = tex1. Also, tex2 is drawn using the same width/height of tex1.
Updated sample.

from fna.

flibitijibibo avatar flibitijibibo commented on August 16, 2024

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.

QuarkRobot avatar QuarkRobot commented on August 16, 2024

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.

flibitijibibo avatar flibitijibibo commented on August 16, 2024

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.

QuarkRobot avatar QuarkRobot commented on August 16, 2024

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.

flibitijibibo avatar flibitijibibo commented on August 16, 2024

Cool, I'll write this in on Monday.

from fna.

flibitijibibo avatar flibitijibibo commented on August 16, 2024

32cf0e4

from fna.

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.