how many bits in this?

This is a discussion on how many bits in this? within the C++ Programming forums, part of the General Programming Boards category; Code: GLubyte mask[] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...

  1. #1
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427

    how many bits in this?

    Code:
    
      GLubyte mask[] = {
        0x0, 0x0, 0x0, 0x0,
        0x0, 0x0, 0x0, 0x0,
        0x0, 0x0, 0x0, 0x0,
        0x0, 0x0, 0x0, 0x0,
        0x0, 0x0, 0x0, 0x0,
        0x0, 0x0, 0x0, 0x0,
        0x0, 0x0, 0x0, 0x0,
        0x0, 0x0, 0x0, 0x0,
        0x0, 0x0, 0x0, 0x0,
        0x7, 0xFF, 0xF0, 0x0,
        0x1F, 0xE0, 0x1E, 0x0,
        0x7E, 0x20, 0x01, 0x0,
        0x7F, 0x39, 0xAB, 0x6F,
        0xFC, 0xA6, 0xAB, 0x6F,
        0xF8, 0x66, 0x6E, 0xEC,
        0xF8, 0x6A, 0x2A, 0x6C,
        0xFC, 0x80, 0x02, 0x2C,
        0x7F, 0x0, 0x1, 0xC8,
        0x7F, 0x0, 0x1, 0xC8,
        0x1F, 0xC0, 0x0C, 0x0,
        0x07, 0xFF, 0xF0, 0x0,
        0x03, 0xFF, 0xE0, 0x0,
        0x0, 0x1C, 0x0, 0x0,
        0x0, 0x0, 0x0, 0x0,
        0x0, 0x0, 0x0, 0x0,
        0x0, 0x0, 0x0, 0x0,
        0x0, 0x0, 0x0, 0x0,
        0x0, 0x0, 0x0, 0x0,
        0x0, 0x0, 0x0, 0x0,
        0x0, 0x0, 0x0, 0x0,
        0x0, 0x0, 0x0, 0x0,
        0x0, 0x0, 0x0, 0x0
      };
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

  2. #2
    Banned nickname_changed's Avatar
    Join Date
    Feb 2003
    Location
    Australia
    Posts
    986
    Count it up yourself. Take all the ones with 2 hex digits and multiple them by 16, then take the single digit ones and multiply them by 8.

    Edit: Or was this supposed to be a trick question?

  3. #3
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427
    Originally posted by stovellp
    Count it up yourself. Take all the ones with 2 hex digits and multiple them by 16, then take the single digit ones and multiply them by 8.

    Edit: Or was this supposed to be a trick question?


    No it wasn't a trick question, I am just trying to figure how tou make patterns.......this is supposed to be a 16 bit array, but it doesn't add up the way you're telling me. The function definitions takes 16 bits , but I don't see how this is 16 bits.
    Last edited by incognito; 03-15-2003 at 11:12 PM.
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

  4. #4
    Registered User SAMSAM's Avatar
    Join Date
    Nov 2001
    Posts
    218
    This i think is a 32 by 32 bits array.

    each line is 32 bits;

    0x0, 0x0, 0x0, 0x0, = 0x00, 0x00, 0x00, 0x00,

    each 0x00 = 8 bits or 2 words
    8 * 4 = 32 .

  5. #5
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427
    Originally posted by SAMSAM
    This i think is a 32 by 32 bits array.

    each line is 32 bits;

    0x0, 0x0, 0x0, 0x0, = 0x00, 0x00, 0x00, 0x00,

    each 0x00 = 8 bits or 2 words
    8 * 4 = 32 .
    Then how is it possible to pass this to a function which is waiting for some 16 bits?


    //EDIT: sometime later



    ahh I see why............

    glPolygonStipple() This takes in a 32*32 array, it's a different function.


    And 0x1E is 8 bits or 00011110 * 4 of these would equal our 32
    times 32 columms then we have our 32*32 mask.......

    And 0x3F07 would be an example for function
    void glLineStipple(GLint factor, GLushort pattern);
    So this would take in the 16 bits for this function........


    //whoa 3 a.m. mabe I should hit the sack now.......again people please correct me if I am wrong.
    Last edited by incognito; 03-16-2003 at 12:00 AM.
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

  6. #6
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427
    One more question...........

    example 0011111100000111

    is a pixel drawn everytime it encounters a zero? Everytime it encounters one? Which one makes a pixel to be drawn.
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

  7. #7
    Registered User SAMSAM's Avatar
    Join Date
    Nov 2001
    Posts
    218
    "is a pixel drawn everytime it encounters a zero? Everytime it encounters one? Which one makes a pixel to be drawn"



    1 sets the pixel.
    0 doesnt.

    but in monochrom bitmaps (win API) the opposit is true.



    cheers!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. SDLKey to ASCII without unicode support?
    By zacs7 in forum Game Programming
    Replies: 6
    Last Post: 10-07-2007, 03:03 AM
  2. Replies: 7
    Last Post: 08-19-2007, 08:10 AM
  3. Help counting number of bits set in an integer
    By JayDiddums10 in forum C Programming
    Replies: 5
    Last Post: 12-07-2006, 02:21 PM
  4. byte is equal 8 bits???
    By Micko in forum C Programming
    Replies: 3
    Last Post: 10-15-2004, 10:12 AM
  5. Writing binary data to a file (bits).
    By OOPboredom in forum C Programming
    Replies: 2
    Last Post: 04-05-2004, 03:53 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21