Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 6 of 6

Thread: Terrain Generation / Displaying terrain

Threaded View

  1. #1
    Junior Member Newbie
    Join Date
    May 2013
    Posts
    4

    Terrain Generation / Displaying terrain

    Well I've pretty much got this figured out now I think except in this tutorial I'm following the author leaves out a vital detail;
    For the Triangle class, he leaves out the variable 'STEPS' (int triangleCount = (steps * steps * 2)
    and this is for generating fractal terrain
    Code :
    	private int[] i,j = new int[3];
     
    	public Triangle(int i0, int j0, int i1, int j1, int i2, int j2){
    		i[0] = i0;	i[1] = i1;	i[2] = i2;
    		j[0] = j0;	j[1] = j1;	j[2] = j2;
    		int triangleCount = (steps * steps * 2);
    		Triangle[] triangles = new Triangle[triangleCount];
    		int triangle = 0;
    		for (int i = 0; i < steps; i++){
    			for (int j = 0; j < steps; j++){
    				triangles[triangle++] = new Triangle (i, j, i + 1, j, i, j + 1);
    				triangles[triangle++] = new Triangle (i + 1, j, i + 1, j + 1, i, j + 1);
    			}
    		}
    	}
    Last edited by _Syndic; 05-02-2013 at 05:44 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •