Sign in to follow this  

[XNA 4.0] Newbie needs help with textured cube

Recommended Posts

I'm quite new to XNA and I've been experimenting with cubes. But I can't get this code to work. This is from [url=""]

The[/url] Error I get is on the line: cubeEffect.CurrentTechnique = cubeEffect.Techniques["Textured"];

I get the message: "This method does not accept null for this parameter."

My basic variables:

public Texture2D cubeTexture;
float aspectRatio = 0.0f;
public BasicEffect cubeEffect;

This is in my LoadContent method:

cubeTexture = Content.Load<Texture2D>(@"Textures\text1");
aspectRatio = GraphicsDevice.Viewport.AspectRatio;
cubeEffect = new BasicEffect(GraphicsDevice);

This is in my Draw method:

cubeEffect.CurrentTechnique = cubeEffect.Techniques["Textured"];
foreach (EffectPass pass in cubeEffect.CurrentTechnique.Passes)
BasicShape s = new BasicShape(new Vector3(1, 1, 1), new Vector3(0, 0, 3));
s.RenderShape(GraphicsDevice, cubeEffect);

(The BasicShape code is the same as in the link to the post; it's lengthy, so I won't paste it here.)

Share this post

Link to post
Share on other sites
[quote name='RDragon1' timestamp='1310877931' post='4836253']
Have you poked around with this in a debugger while it's stopped?

What object is null that shouldn't be?

Yes, I've tried commenting out the line, but the same error occurs with a very similar line of cone in a BasicShapes render method:


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this