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: c++ terrain loops

  1. #1
    Intern Contributor
    Join Date
    May 2008
    Posts
    67

    c++ terrain loops

    Hi
    i get z values by feeding/incrementing x and y. So i have for ex. 1-1386 z values and the question how to output those to a field of 128x128? (x/y)
    Many thanks

  2. #2
    Senior Member OpenGL Pro BionicBytes's Avatar
    Join Date
    Mar 2009
    Location
    UK, London
    Posts
    1,171

    Re: c++ terrain loops

    Hang on a mo.
    You posted a cryptic message in the Maths & Alg section
    3D Terrain

    ...and now you are doing the same thing again here.

    Your posts are so cryptic no wonder nobody is replying.
    Have you actually read the <a href="http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&amp;Number=305969&amp; an=2#Post305969" rel="nofollow" target="_blank">posting guidelines?
    </a>

  3. #3
    Advanced Member Frequent Contributor
    Join Date
    Apr 2010
    Location
    Germany
    Posts
    898

    Re: c++ terrain loops

    128x128 = 16384, so there is no way you're gonna get thos 1386 values assigned with a one to one mapping. You could randomly select 1386 vertices out of the range of [0, 128] but I doubt that makes any sense.

    And I have to agree with BionicBytes. I had to read the above linked post of yours about 4 times before I kind of got what you wanted.

  4. #4
    Intern Contributor
    Join Date
    May 2008
    Posts
    67

    Re: c++ terrain loops

    for(loopz=0 ; loopz< MapReso; loopz++ ){
    same for x...
    function returning z WeltAlt
    terrainMap[x][loopz][0] = x;
    terrainMap[x][loopz][1] = dWeltAlt/100; //altitude
    terrainMap[x][loopz][2] = -loopz;

    I only need to get dWeltAlt into terrainMap[128][128][3] but
    something is wrong....any ideas? Basically I'm following:
    http://www.codeproject.com/Articles/...n-Introduction
    but without success.
    Thanks

  5. #5
    Senior Member OpenGL Pro BionicBytes's Avatar
    Join Date
    Mar 2009
    Location
    UK, London
    Posts
    1,171

    Re: c++ terrain loops

    Well you could follow it more carefully ....
    Seriously. Just how are you suggesting we go about commenting on what's wrong when we don't know what specifically is not working. We are not telepaths you know. you actually need to describe the issue and post relevant code sections.

  6. #6
    Intern Contributor
    Join Date
    May 2008
    Posts
    67

    Re: c++ terrain loops

    If I'd know I wouldn't need to ask...
    I guess, at least that's what I don't understand is the z returning function takes 2 x and y arguments for each loop x and loopz.
    for x
    posx++
    posy++
    for loopz
    posx++
    posy++
    return z (a struct with x,y,z etc values)
    now for 2D I only read out those results while x<16384 but how to do alike in 3D?

Posting Permissions

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