Results 1 to 3 of 3

Thread: matrix

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2005
    Location
    Malaysia
    Posts
    5

    matrix

    first of all, sorry for my stupid question. but i really have no idea about it.

    how to write matrix condition in a if else function? as i used the matrix to build walls.

    for example,

    short matrix[]={ 1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,
    1,1,1,0,0,0,1,1,1,1,0,0,0,1,0,0,0,1,0,1,
    1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,};

    if(matrix[???]==1)
    {
    ....
    }

    so, what should i put with the ? symbol??

    thank u very much!!!

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: matrix

    Put whatever index for which you want to see its value.
    This is basic C knowledge, try to find some online simple tutorials for C, it will help a lot

  3. #3
    Junior Member Newbie
    Join Date
    Jan 2005
    Location
    Malaysia
    Posts
    5

    Re: matrix

    sry...
    the building walls coding is like this,
    int k=0;
    loop i
    loop j
    if(matrix[k] == 1)
    {
    glBegin(GL_QUADS);
    .....
    glEnd();
    }
    k++;
    glTranslatef(2.0f,0.0f,0.0f);
    }
    glTranslatef(-40.0f,0.0f,2.0f);
    }

    so, should i put k for the matrix in the if else condition at somewhere else? or i could write another way round? i have tried so many times including putting k.
    pls help me

Similar Threads

  1. Replies: 0
    Last Post: 09-16-2015, 03:27 PM
  2. Replies: 1
    Last Post: 07-20-2014, 03:29 PM
  3. Replies: 3
    Last Post: 04-03-2010, 03:10 PM
  4. Need an advice on separating model matrix from view matrix.
    By Obli in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 10-09-2003, 06:07 AM
  5. Can concatenate projection matrix with viewport transformation matrix?
    By MelvinEng in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 07-07-2002, 10:31 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
  •  
Proudly hosted by Digital Ocean