Thread: Some OpenGL Questions:

  1. #1
    People Love Me
    Join Date
    Jan 2003
    Posts
    412

    Question Some OpenGL Questions:

    Sorry for bein' an OpenGL n00b, but I have a few questions I hope you guys can answer:

    1.) Why is it that when you supply a file path\name, you hafta convert the "\"s into "/"s? Does it have something to do w/ some of the special commands you can use with \? i.e: "\n"

    2.) My program doesn't work outside of my computer because it can't find the .bmp file.(And yes, I did supply the full path to the file) It's a simple program where I use a .bmp file to texture a cube. Would I hafta .zip up the game, and include the .bmp files I'm going to use for it to work outside of my computer?

    3.) What's DWORD alignment?

    4.)Using the same method you use to use bitmap textures, would I be able to make an animated GIF texture?

    5.) What's HWND stand for?

    6.)What's a window handle?

  2. #2
    Used Registerer jdinger's Avatar
    Join Date
    Feb 2002
    Posts
    1,065

    Re: Some OpenGL Questions:

    Originally posted by Krak
    1.) Why is it that when you supply a file path\name, you hafta convert the "\"s into "/"s? Does it have something to do w/ some of the special commands you can use with \? i.e: "\n"
    This has nothing to do with OpeGL. It's because of the C/C++ escape characters use the backslash. Also, a double-backslash works (ie: "c:\\myfolder\\myfile.txt")

    2.) My program doesn't work outside of my computer because it can't find the .bmp file.(And yes, I did supply the full path to the file) It's a simple program where I use a .bmp file to texture a cube. Would I hafta .zip up the game, and include the .bmp files I'm going to use for it to work outside of my computer?
    Yes, regardless of the path being correct if the bitmap isn't on the comp then it doesn't matter.

    5.) What's HWND stand for?
    handle for a window

    6.)What's a window handle? [/B]
    An HWND. A pointer to a window structure.

    You know some of these questions could have very easily been answered with a simple search either here or google.

  3. #3
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    1) Yes, its because of escape sequences. You can also use '\\' instead.

    2) You should always provide a relative path to any files used by your program. You never know where the user will put it.

    3) No clue.

    4) Theoretically.

    5) Window Handle.

    6) An identifier for a window which allows different API functions to access it.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  4. #4
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    crash course in word alignment in 3 sentences or less....

    example: suppose you store things in groups of 4, what happens when you want to store something that is only 1 big (ex. think of a char)? you simply store the 1 then leave 3 empty spaces to sustain alignment. with raw image data, no such alignment is done for you thus bitmap dimensions (as i assume you are inquiring about) must be exact powers of 2 when texturing.

  5. #5
    People Love Me
    Join Date
    Jan 2003
    Posts
    412
    Originally posted by Perspective
    crash course in word alignment in 3 sentences or less....

    example: suppose you store things in groups of 4, what happens when you want to store something that is only 1 big (ex. think of a char)? you simply store the 1 then leave 3 empty spaces to sustain alignment. with raw image data, no such alignment is done for you thus bitmap dimensions (as i assume you are inquiring about) must be exact powers of 2 when texturing.
    Okay, I sorta see what you're saying, and I sorta dont. Correct me if I'm wrong, but what your saying is:
    Code:
    char * string[10]; //I'm not sure if that's the correct way to do it or not. It's been a while
    and then having the string end up being only 3 characters long is acceptable, but using a bitmap that's too small isn't, right?

    I'm still a little confused by this. Maybe someone could give me a complete retard's guide to what DWORD means, and why bitmap dimensions have to be in powers of 2? Sorry, I'm totally new to this.


  6. #6
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    the concepts and consequences of aligned and disaligned memory are pretty complicated and in depth topics. it is not really possible to inform you of all that goes on in just a few sentances. start here if you want to learn more.

    http://www.google.ca/search?hl=en&ie...t+memory&meta=

  7. #7
    Registered User SAMSAM's Avatar
    Join Date
    Nov 2001
    Posts
    218
    The number of bits per pixel is always 4(each byte 2 pixel), 8(each byte is one pixel) or 24(each pixel needs 3 bytes).
    for example the lenght of each line(row) of the bitmap(DIB)
    is always a multiple of 4.

    bmRow = 4 * ((bitmapwidth * bitcount + 31) / 32;

    You add zeros at right side of the row to make it even.

  8. #8
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    >>2.) My program doesn't work outside of my computer because it can't find the .bmp file.(And yes, I did supply the full path to the file) It's a simple program where I use a .bmp file to texture a cube. Would I hafta .zip up the game, and include the .bmp files I'm going to use for it to work outside of my computer?

    Use a ./ to set the path relative to your apps working folder
    or
    Use GetWorkingFolder() and sprintf() to set the full path
    or
    include the BMP as a resource in your exe and load using LoadImage() and MAKEINTRESOURCE().

    AND
    ensure that the app can create a subsitute if the BMP is unavailable. That is the app will handle the error and continue.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. OpenGl questions
    By Shadowwoelf in forum Windows Programming
    Replies: 4
    Last Post: 06-20-2007, 05:35 PM
  2. lots of questions about opengl
    By n3v in forum Game Programming
    Replies: 9
    Last Post: 07-01-2006, 07:32 AM
  3. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  4. OpenGL .dll vs video card dll
    By Silvercord in forum Game Programming
    Replies: 14
    Last Post: 02-12-2003, 07:57 PM
  5. MISC questions about OpenGL
    By Silvercord in forum Game Programming
    Replies: 12
    Last Post: 01-25-2003, 04:20 PM