PDA

View Full Version : need help



Zork
11-09-2002, 01:36 AM
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?

Black Knight
11-09-2002, 03:37 AM
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

Zork
11-10-2002, 01:09 AM
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!

mm_freak
11-10-2002, 10:41 AM
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.

Zork
11-10-2002, 11:17 AM
Yes it can be done, but if I scale the bitmap I am loosing quality.I guess i need more readings.

DFrey
11-10-2002, 12:11 PM
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.