Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7502307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:49:17+00:00 2026-05-29T20:49:17+00:00

Hey I’m having a little trouble. I’ve been working with xna for a while,

  • 0

Hey I’m having a little trouble. I’ve been working with xna for a while, but I’m completely new to 3D. I’m following the code verbatim from the winformsgraphicsdevice sample on the msdn website. It has a control that draws a primitive triangle to the screen. Simple as that, but I get an exception on this line:

GraphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleList, vertices, 0, 1);

Which says:

"The current vertex declaration does not include all the elements required by the current vertex shader. Normal0 is missing."

I’m assuming it has something to do with my VertexPositionColor variable, vertices. That code is here:

vertices = new VertexPositionColor[3];
vertices[0] = new VertexPositionColor(new Vector3(-1, -1, 0), Color.Black);
vertices[1] = new VertexPositionColor(new Vector3( 1, -1, 0), Color.Black);
vertices[2] = new VertexPositionColor(new Vector3(0, 1, 0), Color.Black);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T20:49:20+00:00Added an answer on May 29, 2026 at 8:49 pm

    Your vertex shader is demanding a normal value (used for lighting calculations) but VertexPositionColor struct doesn’t have it.

    You’ll have to create a struct for storing vertex position, color AND normal data as it’s not a prebuilt type on XNA.

    You can learn how to create it here: http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series1/Terrain_lighting.php

    There he creates a struct called VertexPositionColorNormal, use it instead of VertexPositionColor that you’re currently using.

    If you don’t want any lighting and you’re not using BasicEffect, just remove your lighting variables/calculations from the technique you’re using.
    If you are using BasicEffect try setting LightingEnabled and TextureEnabled properties to false.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey having some trouble trying to maintain transparency on a png when i create
Hey guys, sorry I'm kind of new to programming, but I had a small
Hey everyone, I'm using Virtual PC and working with a virtual hard disk (*.vhd)
Hey, I've been developing an application in the windows console with Java, and want
Hey peoples, I've been studying Java for a couple of weeks, and have decided
Hey, in the Programming Pearls book, there is a source code for setting, clearing
hey guys I have the follow code in js: $(document).ready(function(){ $(.replyLink).click(function(){ $(#form-to-+this.id).html(htmlForm()).toggle(500); return false;
Hey so I've been searching around for this topic and couldn't find a whole
Hey guys I'm following the rails tutorial found here http://net.tutsplus.com/tutorials/ruby/the-intro-to-rails-screencast-i-wish-i-had/ and I've gotten to
Hey I need a little help with unsigned char bit access. I need to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.