Git Product home page Git Product logo

Comments (17)

flibitijibibo avatar flibitijibibo commented on July 19, 2024

TextureCube has never really been supported, so you're on your own here.

Verify that it works with XNA4 first, then grab apitrace and get to work.

from fna-mghistory.

Vodacek avatar Vodacek commented on July 19, 2024

MonoGame and XNA version works fine

from fna-mghistory.

flibitijibibo avatar flibitijibibo commented on July 19, 2024

Cool, now you'll just need to figure out why.

from fna-mghistory.

flibitijibibo avatar flibitijibibo commented on July 19, 2024

https://github.com/flibitijibibo/MonoGame/blob/monogame-sdl2/MonoGame.Framework/Graphics/TextureCube.cs#L72

What happens when you add GL.BindTexture(TextureTarget.TextureCubeMap, texture.Handle); before this line?

from fna-mghistory.

Vodacek avatar Vodacek commented on July 19, 2024

GL.GetError() returned InvalidValue

in OpenGLDevice line 864, I will create test project.

from fna-mghistory.

flibitijibibo avatar flibitijibibo commented on July 19, 2024

While you're getting that together, I've pulled some more GL calls into OpenGLDevice that might narrow it down further:

12bfab8

from fna-mghistory.

Vodacek avatar Vodacek commented on July 19, 2024

Test project is here: https://github.com/Vodacek/TestProjects/tree/master/TextureCube
works fine (sky is now rendered correctly), but in my main project I still have exception mentioned in my previous post

from fna-mghistory.

flibitijibibo avatar flibitijibibo commented on July 19, 2024

At this point I really strongly recommend tracing in apitrace. If we've got a minimum case for it functioning, odds are it's how OpenGLDevice handles TextureTargets.

from fna-mghistory.

Vodacek avatar Vodacek commented on July 19, 2024

apitrace file: http://t.zvb.cz/imperium/databaze/lidi/vodacek/zvb2.1.rar

Playback is very cool function :-)

from fna-mghistory.

flibitijibibo avatar flibitijibibo commented on July 19, 2024

Huh, that's really weird... I don't see a glBindTexture for CubeMapFace anywhere in the trace.

If you run the app with force set to true:

https://github.com/flibitijibibo/MonoGame/blob/monogame-sdl2/MonoGame.Framework/Graphics/OpenGLDevice.cs#L596

... does that do anything? The main lead I'm following is a missing TextureTarget Flush() somewhere.

from fna-mghistory.

Vodacek avatar Vodacek commented on July 19, 2024

Just for sure exception is thrown when I try to render sky:
Microsoft.Xna.Framework.Graphics.MonoGameGLException: GL.GetError() returned InvalidValue
v Microsoft.Xna.Framework.Graphics.GraphicsExtensions.CheckGLError() v C:\Users\admin\Documents\GitHub\sdl2\MonoGame\MonoGame.Framework\Graphics\GraphicsExtensions.cs:řádek 398
v Microsoft.Xna.Framework.Graphics.OpenGLDevice.FlushGLState(Boolean force) v C:\Users\admin\Documents\GitHub\sdl2\MonoGame\MonoGame.Framework\Graphics\OpenGLDevice.cs:řádek 864
v Microsoft.Xna.Framework.Graphics.GraphicsDevice.ApplyState(Boolean applyShaders) v C:\Users\admin\Documents\GitHub\sdl2\MonoGame\MonoGame.Framework\Graphics\GraphicsDevice.cs:řádek 1230
v Microsoft.Xna.Framework.Graphics.GraphicsDevice.DrawIndexedPrimitives(PrimitiveType primitiveType, Int32 baseVertex, Int32 minVertexIndex, Int32 numVertices, Int32 startIndex, Int32 primitiveCount) v C:\Users\admin\Documents\GitHub\sdl2\MonoGame\MonoGame.Framework\Graphics\GraphicsDevice.cs:řádek 746
v Microsoft.Xna.Framework.Graphics.ModelMesh.Draw() v C:\Users\admin\Documents\GitHub\sdl2\MonoGame\MonoGame.Framework\Graphics\ModelMesh.cs:řádek 87
v VodacekEngine.SkySphere.Draw() v C:\Users\admin\Desktop\programy\devkniha\VodacekEngine\VodacekEngine\Components\SkySphere.cs:řádek 65
...

drawing code is same as in my test project: https://github.com/Vodacek/TestProjects/blob/master/TextureCube/TextureCube/TextureCube/TextureCube/Sky.cs#L68

from fna-mghistory.

flibitijibibo avatar flibitijibibo commented on July 19, 2024

At this point I'd say throw a few more GraphicsExtensions.CheckGLError() calls in these two blocks, after each GL call:

https://github.com/flibitijibibo/MonoGame/blob/monogame-sdl2/MonoGame.Framework/Graphics/OpenGLDevice.cs#L832
https://github.com/flibitijibibo/MonoGame/blob/monogame-sdl2/MonoGame.Framework/Graphics/OpenGLDevice.cs#L137

At that point we'd at least be sure what GL call is pushing GL_INVALID_VALUE. Could be our texture target, could be a texparameter, not entirely sure.

from fna-mghistory.

flibitijibibo avatar flibitijibibo commented on July 19, 2024

Ah-ha, think I found it... found the CubeMap stuff at the end of your trace, my fault there...

So I'm almost 100% sure that the INVALID_VALUE is coming from the MaxAnistropy texparameter call; it's setting the anistropy to... 0. What.

Do you have any SamplerStates where MaxAnistropy is set to 0?

from fna-mghistory.

Vodacek avatar Vodacek commented on July 19, 2024

Yes MaxAnisotropy is 0 :-)

from fna-mghistory.

flibitijibibo avatar flibitijibibo commented on July 19, 2024

I think the fix is to replace Anistropy.Flush() found here:

https://github.com/flibitijibibo/MonoGame/blob/monogame-sdl2/MonoGame.Framework/Graphics/OpenGLDevice.cs#L187

With Math.Max(Anistropy.Flush(), 1.0f). Does that fix it?

from fna-mghistory.

Vodacek avatar Vodacek commented on July 19, 2024

Works very well :-) Thank you again!

from fna-mghistory.

flibitijibibo avatar flibitijibibo commented on July 19, 2024

Weird, I wonder why XNA silently clamps the value like that?

In any case, this has been pushed:

67a4cc0

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.