Results 1 to 4 of 4

Thread: Height field

  1. #1
    Guest

    Height field

    Hi! I have a question about reading height field maps. I'm trying to make a terrain visualisation and put there some buildings, etc.

    I found quiet lot code samples how to make triangle strips, but I'm having problems with opening and reading the .bmp file. I'm coding in C++. If you have any good solutions, how to get pixels from file, I would realy appreciate it.

    Thanks in advance!

  2. #2
    Guest

    Re: Height field

    hey piotr, kinda OT, but check this out:
    http://www.gamedev.net/reference/art...rticle1966.asp

    found this with a google for "load a bitmap", page 2

  3. #3
    Guest

    Re: Height field

    I'm looking for some method to get the value of pixel color. The .bmp file should be in grey scale, and of course the darker pixel, the higher terrain. I worked out something like this, but it's not working:

    Code :
     void __fastcall TFormMain::SetupTextures()
    {
        bitmap = new Graphics::TBitmap; //ladowane tylko raz
        bitmap->LoadFromFile("teren.bmp");
     
        for(int i = 0; i < 32; i++)
        {
        	for(int j = 0; j < 32; j++)
            {
                height_field[i][j][0]= float(i)*step;
                height_field[i][j][1]= (float)(bitmap->Canvas->Pixels[i][j])[(i*(AREA_SIZE+j)*3];
                height_field[i][j][2]= -float(i)*step;
     
            }
        }
    The line with Canvas is wrong, but I don't know how to make it work...

  4. #4
    Member Contributor
    Join Date
    Jul 2003
    Posts
    92

    Re: Height field

    Nehe has a source code to load .bmp, .gif and .jpg files with IPICTURE (under Windows).

    The code change the color of the pixels in order to convert rbg to rgb.

    You can use this example to find the color of a pixel.

Similar Threads

  1. glDrawElementsBaseVertex .. GL_TRIANGLE_STRIP .. height-field
    By CarstenT in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 12-14-2013, 01:27 PM
  2. height field terrain
    By incus in forum OpenGL: Advanced Coding
    Replies: 5
    Last Post: 04-14-2003, 09:12 AM
  3. Height field question?
    By ironduke in forum OpenGL: Advanced Coding
    Replies: 11
    Last Post: 01-13-2002, 07:31 AM
  4. A tank running on a height field
    By rafaeldelrey in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 04-14-2001, 07:31 AM
  5. Height field Question?
    By ironduke in forum OpenGL: Basic Coding
    Replies: 7
    Last Post: 07-09-2000, 06:50 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean