Sign in to follow this  
u235

skybox with mesh, exception without mesh

Recommended Posts

I am currently in the process of writing a little graphics engine but I am having trouble with my skybox class. I was testing out each of the classes I have so far and I was testing out my skybox class. If there is also a mesh present in my scene, the skybox renders as expected, but if the skybox is the only thing in the scene, I get an InvalidCallException that has been boggling my mind for about three days. The exception is thrown on this line: device.DrawPrimitives(PrimitiveType.TrianglelList, 0, 24, 2); which is supposed to draw the first quad of the skybox. I don't know what other code might be helpful since it renders with a mesh, but doesn't without one. If any other code would be helpful, let me know and I will post it. Thanks. -AJ

Share this post


Link to post
Share on other sites
Be sure you're calling SetFVF/SetDeclaration before the draw call. If you don't, you'll get an exception since the data isn't what it's expecting.

If you have a mesh present, it's probably calling SetFVF somewhere internally, which doesn't get reset after the mesh finishes drawing, so that's helping you avoid the error.

Hope this helps.

Share this post


Link to post
Share on other sites
Try running with the debug runtime. It's likely to print a relevant message.

You probably didn't set something that needs to be set, like a vertex declaration, and the mesh sets that for you when you render it.

Edit: I hate it when someone beats me to it. :)

Share this post


Link to post
Share on other sites
Quote:
Original post by sirob
Be sure you're calling SetFVF/SetDeclaration before the draw call. If you don't, you'll get an exception since the data isn't what it's expecting.

If you have a mesh present, it's probably calling SetFVF somewhere internally, which doesn't get reset after the mesh finishes drawing, so that's helping you avoid the error.

Hope this helps.


Of course. How could I be so foolish. Many thanks both of you.

-AJ

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