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: need help

  1. #1
    Intern Newbie
    Join Date
    Nov 2002
    Location
    bucharest, romania
    Posts
    35

    need help

    I'm making a side scroller, and need to load a bitmap(doesn't matter what kind of:bmp,tga,tiff,png,pcx,raw,etc) but not in the way they done it in nehe tutorials.I.e. I don't want to texture map the bitmap , I just want every point of bitmap to correspond to a pixel on the screen in full screen mode.
    CAN YOU HELP?

  2. #2
    Junior Member Newbie
    Join Date
    Nov 2002
    Location
    Istabul/Izmır
    Posts
    11

    Re: need help

    Ortho Mode????THen you will have 800x600 pixels on the screeen and you can use glVertex2i(0,0);
    glVertex2i(800,0);
    glVertex2i(800,600);
    glVertex2i(0,600);

    To put a image O_o
    Omnium rerum principia parva sunt.

  3. #3
    Intern Newbie
    Join Date
    Nov 2002
    Location
    bucharest, romania
    Posts
    35

    Re: need help

    No, I am reffering to something like that:
    consider the screen with absolute coordinates
    (0,0) to (800,600) and a bitmap with 100x100 size.Can I use a code like:
    for(int i = 0; i < 100; i++)
    for(int j = 0; j < 100; j++) {
    c = read_pixel_from_bitmap();
    put_pixel(i, j, c);
    } ?
    If I've could to use texture mapping I've considered it but I must use bitmaps whose width and height are not powers of 2.
    Thanks for help!

  4. #4
    Intern Newbie
    Join Date
    Nov 2002
    Location
    Germany
    Posts
    48

    Re: need help

    glDrawPixels and glBitmap should be, what you need. Can't explain, never used them, sorry.

    Well, texture mapping, I've heard, is faster and if your bitmap isn't ^2, scale it and just draw a portion of it on screen. You can as well add junk data to get the appropriate size.
    Knowledge is Power

  5. #5
    Intern Newbie
    Join Date
    Nov 2002
    Location
    bucharest, romania
    Posts
    35

    Re: need help

    Yes it can be done, but if I scale the bitmap I am loosing quality.I guess i need more readings.

  6. #6
    Senior Member OpenGL Pro
    Join Date
    Jun 2000
    Location
    Shreveport, LA, USA
    Posts
    1,505

    Re: need help

    You can still use textures even if the source images are not powers of 2. Simply either use one of the texture rectangle extensions or pad the source image to make the dimensions powers of 2.

Posting Permissions

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