Jump to content
  • Advertisement
Sign in to follow this  
ChristOwnsMe

Shader Issue with protected memory

This topic is 2227 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a chunked LOD system, and I am using noise to generate the height values. This works properly when the planet face hasn't divided yet, but when I divide for the first time, I am getting the exception "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."



m_Vertices[0] = new VertexPositionTexture(vec1, new Vector2(0, 1));
m_Vertices[1] = new VertexPositionTexture(vec2, new Vector2(1 + ps, 1));
m_Vertices[2] = new VertexPositionTexture(vec3, new Vector2(0, 0 - ps));
m_Vertices[3] = new VertexPositionTexture(vec4, new Vector2(1 + ps, 0 - ps));

perlinCombined.Parameters["xNW"].SetValue(vec1); <--------------- THIS LINE THROWS THE EXCEPTION
perlinCombined.Parameters["xNE"].SetValue(vec2);
perlinCombined.Parameters["xSW"].SetValue(vec3);
perlinCombined.Parameters["xSE"].SetValue(vec4);

This line works the first time, but then if I try to change the value again when a child is created, it throws that exception. Any ideas? Thanks.

P.S: I am extremely new to shaders, so sorry if it is something stupidly simple.

Share this post


Link to post
Share on other sites
Advertisement
Effect perlinCombined = CContentManager.Singleton.Content.Load<Effect>("GeometryMap");

The [] operator is built in to the XNA Effect class. My apologies I forgot to mention I was using XNA.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!