Forum
Contact





DirectX using C#
DirectX using C++
DirectX using Visual Basic



Latest Forum posts

 Pavtube 2014 Easter Deals with 20% off
  Posted by: VIKIVannessa
  When: 20/04/2014 at 01:35:55

 20% off on iMedia Converter for Mac
  Posted by: VIKIVannessa
  When: 20/04/2014 at 01:35:54

 Pavtube Video Converter Ultimate Deal
  Posted by: VIKIVannessa
  When: 20/04/2014 at 01:35:50

 Easter Day Deals
  Posted by: Applefly
  When: 19/04/2014 at 22:18:14

 40% OFF Pavtube DVD Ripper for Mac
  Posted by: VIKIVannessa
  When: 19/04/2014 at 02:02:54

 DVD Ripper with 40% off
  Posted by: VIKIVannessa
  When: 19/04/2014 at 02:02:22

 Get DVD Ripper Wind/Mac + $14 Coupon
  Posted by: VIKIVannessa
  When: 19/04/2014 at 02:02:03

 Backup DVD Escape Plan
  Posted by: Applefly
  When: 17/04/2014 at 06:00:12

 Disney DVDs to MP4
  Posted by: Applefly
  When: 17/04/2014 at 05:56:07

 DVD movies through media streamer
  Posted by: VIKIVannessa
  When: 16/04/2014 at 02:25:09

 DVD movies to play on Galaxy Tab 3 10.1
  Posted by: VIKIVannessa
  When: 16/04/2014 at 02:20:51

 Blu-ray to Apple ProRes
  Posted by: Applefly
  When: 12/04/2014 at 00:47:46

 HD H.264 MP4 format
  Posted by: Applefly
  When: 12/04/2014 at 00:43:23

 DVD collection to computer
  Posted by: VIKIVannessa
  When: 04/04/2014 at 07:13:33

 DVD movies to play on Galaxy Tab 3 10.1
  Posted by: VIKIVannessa
  When: 04/04/2014 at 07:11:27

 DVD movies to play on Galaxy Tab 3 10.1
  Posted by: VIKIVannessa
  When: 04/04/2014 at 07:11:27

 DVD Ripper to populate
  Posted by: Applefly
  When: 04/04/2014 at 05:01:35

 kids and family watch DVD
  Posted by: Applefly
  When: 04/04/2014 at 04:59:21

 Blu-ray movie for your lovely kids
  Posted by: VIKIVannessa
  When: 02/04/2014 at 05:47:49

 DVD to DNxHD Converter for Mac
  Posted by: VIKIVannessa
  When: 02/04/2014 at 05:46:04




Topic: TriangleStrip vs TriangleList



  
Goto parent category
  
Create a new user account


   TriangleStrip vs TriangleList
 Poster : KillerFry
 Posts: 2
 Country : Mexico
 City: Juarez

  
Posted by KillerFry on 15/09/2007 at 12:00:44
Hello there,

First of all, I would like to congratulate and thank you Riemer for all the great tutorials! They've helped me a lot along with my trusty book - XNA Unleashed, by SAMS Publishing, good read!. They've helped me a lot to quickly grasp the XNA Concepts. Again, thanks a lot!

I am building my own mini engine, and I'm at the terrain generation part. I was able to create it by using a texture file; I actually did my own Processor to load it from the Content Pipeline... don't know, seemed like a good exercise and challenge. For some reason I think it yields better performance, but I'm not sure... does anyone know?

Anyhow, for some reason I thought changing the terrain generation from an Indexed TriangleList to a TriangleStrip. But then, while working in the algorithm I realized I would have to define a LOT more vertices! (Almost twice). So I began to question my logic.

Thus, my question is: When generating a terrain from a file, what's better performing? An Indexed TriangleList or a TriangleStrip? What are example of good uses for a TriangleStrip? Is there such a thing as an Indexed TriangleStrip?

Thanks in advance!

Oh, and here's my vertex algorithm, so you can have a look at it... maybe a TriangleStrip is a good idea, but my code is all wrong! Hahaha. Here it is!

private void LoadHeightData()
        {
            Texture2D tex = this.terrain;
            Color[] pixels = new Color[tex.Width * tex.Height];
            tex.GetData<Color>(pixels);

            this.WIDTH = tex.Width;
            this.HEIGHT = tex.Height;
            heightData = new int[WIDTH, HEIGHT];
            for (int x = 0; x < HEIGHT; x++)
            {
                for (int y = 0; y < WIDTH; y++)
                {
                    int height = (int)(pixels[x * WIDTH + y].R);
                    height += (int)(pixels[x * WIDTH + y].G);
                    height += (int)(pixels[x * WIDTH + y].B);
                    height /= 8;
                    heightData[WIDTH - 1 - y, HEIGHT - 1 - x] = height;
                    /*if (height < MinimumHeight)
                    {
                        MinimumHeight = height;
                    }
                    if (height > MaximumHeight)
                    {
                        MaximumHeight = height;
                    }*/
                }
            }
        }

        private void SetUpVertices()
        {
            vertices = new VertexPositionColor[(WIDTH * HEIGHT * 2) - (HEIGHT * 2)];
            for (int y = 0; y < HEIGHT - 1; y++)
            {
                for (int x = 0; x < WIDTH; x++)
                {
                    if (y % 2 == 0)
                    {
                        vertices[(y * WIDTH * 2) + (x * 2)].Position = new Vector3(x, y + 1, heightData[x, y + 1]);
                        vertices[(y * WIDTH * 2) + (x * 2)].Color = Color.White;
                        vertices[(y * WIDTH * 2) + (x * 2) + 1].Position = new Vector3(x, y, heightData[x, y]);
                        vertices[(y * WIDTH * 2) + (x * 2) + 1].Color = Color.White;
                    }
                    else
                    {
                        vertices[(y * WIDTH * 2) + (x * 2)].Position = new Vector3(WIDTH - 1 - x, y, heightData[WIDTH - 1 - x, y]);
                        vertices[(y * WIDTH * 2) + (x * 2)].Color = Color.White;
                        vertices[(y * WIDTH * 2) + (x * 2) + 1].Position = new Vector3(WIDTH - 1 - x, y + 1, heightData[WIDTH - 1 - x, y + 1]);
                        vertices[(y * WIDTH * 2) + (x * 2) + 1].Color = Color.White;
                    }
                }
            }
            vb = new VertexBuffer(graphics.GraphicsDevice, sizeof(float) * 4 * (WIDTH * HEIGHT * 2) - (HEIGHT * 2), ResourceUsage.WriteOnly);
            vb.SetData(vertices);
        }


  
Post a new reply
 



Useronline Insert Failed >

Google
 
Web www.riemers.net
If you appreciate the amount of time I spend creating and updating
these pages, feel free to donate -- any amount is welcome !
- Website design & DirectX code : Riemer Grootjans -
©2006 Riemer Grootjans


News
Home
Forum
XNA 2.0 Recipes Book (8)
XNA 3.0 Recipes Book (8)
Downloads
Extra Reading (3)
Matrices: geometrical
Matrix Mathematics
Homogenous matrices
Community Projects (1)
Tutorials (160)
XNA 4.0 using C# (89)
DirectX using C# (54)
Series 1:Terrain (14)
Opening a window
Linking to the Device
Drawing a triangle
Camera
Rotation - Translation
Indices
Terrain creation
Terrain from file
DirectInput
Importing bmp files
Colored vertices
DirectX Light basics
Mesh creation
Mesh lighting
Series 2: Flightsim (19)
Series 3: HLSL (19)
Short Tuts (2)
Resizing problem
Checking Device caps
DirectX using C++ (15)
DirectX using VB (2)