Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all articles
Browse latest Browse all 6821

[SOLVED]Texture3D invalid argument exception

$
0
0

@Manuli wrote:

Hi guys.

I'm new in this community and I'm starting to approach Monogame.

My first test was to render a 3D volume, loaded from a .raw file.
My idea is to create a 3D texture, the next steps are not important in order to explain you my current problem.

I immediately had problems with an exception when texture was created.

Here's a bit of code:

public void InitializeVolume(GraphicsDevice d, BasicEffect effect)
{
    // Exception in the next line "HRESULT: [0x80070057], Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments], Message: Incorrect parameter.
    _volume = new Microsoft.Xna.Framework.Graphics.Texture3D(Game1.Instance.GraphicsDevice, _width, _height, _depth, false, SurfaceFormat.Single);
            
    _volume.SetData(_scalars);  // Scalars are an array of normalized float( [0 -> 1])

    effect.Parameters["Volume"].SetValue(_volume);
 }

There is some problem with the parameters? Why?
Do you have any idea?
Do not be afraid to answer, so I can continue with my study. :sweat_smile:
Thanks very much!

EDIT The problem was that the depth was not divisible by 4.:joy::sweat_smile:
@Alkher Thanks the same, if you have other tips are welcome.

Posts: 4

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles