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 6937701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:23:52+00:00 2026-05-27T12:23:52+00:00

I am working to generate terrain for our project, something that will be contained

  • 0

I am working to generate terrain for our project, something that will be contained in the Model class that I can draw, but I new class would be alright since I may need to look inside for specific data often, and then I would just need the basic function to work with the Game class.
Anyway, I have a fair amount of knowledge of the XNA framework, but because of how convoluted it handles anything. So my problem is I can’t just make a Model, I can’t instantiate that class or anything. I have what I believe the proper data to form a model’s geometry, which is all I need right now, and later possibly have it textured.
I don’t know where to go from here.

XNA you usually use Content.Load, to have their content pipeline read in a file and parse it specifically, but I want to avoid that because I want my terrain generated. I can compute an array of Vertex data and indices for the triangles I want to make-up a mesh, but so far my efforts have tried to instantiate any object like Model or those it contains, have failed.
If there is some factory class I can use to build it, I have no idea what that is, so if someone else can point me in the right direction there and give me a rough outline on how to build a model, that would help.
If that’s not the answer, maybe I need to do something completely different, either centered on using Content.Load or not, but basically I don’t want my terrain sitting in a file, consistent between executions, I want to control the mesh data on load and randomize it, etc.

So how can I get a model generated completely programmatically, to show up on the screen, and still have its data exposed?

  • 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-27T12:23:52+00:00Added an answer on May 27, 2026 at 12:23 pm

    Model and its associated classes (eg: ModelMesh), are convenience classes. They are not the only way to draw models. It is expected that sometimes, particularly when doing something “special”, you will have to re-implement them entirely, using the same low-level methods that Model uses.

    Here’s the quick version of what you should do:

    First of all, at load time, create a VertexBuffer and an IndexBuffer and use SetData on each to fill each with the appropriate data.

    Then, at draw time, do this:

    GraphicsDevice.SetVertexBuffer(myVertexBuffer);
    GraphicsDevice.Indices = myIndexBuffer;
    
    // Set up your effect. Use a BasicEffect here, if you don't have something else.
    myEffect.CurrentTechnique.Passes[0].Apply();
    
    GraphicsDevice.Textures[0] = myTexture; // From Content.Load<Texture2D>("...")
    
    GraphicsDevice.DrawIndexedPrimitives(...);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a project that requires me to generate a java .class
I'm working on a project that will generate an OAuth querystring in JavaScript, using
I'm working on a tool that will generate the source code for an interface
I'm working on a project where I can generate Word documents, one of the
I'm working on a .NET application in C# that will generate a variable-length string
I'm currently working on an application that will generate actual .cs and .xaml code
I'm working on a simple application that will generate time table (daily planner) for
I am working on a django project that provides an API to generate thumbnails
I'm working with some Java that I generate with JAXB but I don't think
I was working on a servlet that will generate a unique code and update

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.