View Full Version : Displaying a part of BMP image
04-01-2008, 11:35 AM
I am reading a BMP image and i am using glRasterpos and gldrawpixels to show the image on the opengl window.
However i would like to display a part of the BMP image that is being read. Can anybody help on how to achieve this.
Thanks in advance
04-01-2008, 02:20 PM
int BMPwidth = 256;
int BMPheight = 256;
//display rectangle from bottom left (128,128) to top right(256,256)
int bottom = 128;
int top = 256;
int left = 128;
int right = 256;
glDrawPixels(right-left, top-bottom, GL_RGB, GL_UNSIGNED_BYTE, (GLvoid*)data);
04-01-2008, 09:17 PM
Thanks for the reply.
I am using a color BMP image of size 184 X 92 size. It contains
24 images so each image 23 X 23. So there are 8 images per row.
You can consider it as a table of 8 columns and 4 rows each one being 23 X 23. If i want to display each of the images separately
what parameters should i give for the glPixelstorei. could you help me on this.
Thanks in advance.
04-02-2008, 01:18 AM
//display row i, column j
glDrawPixels(23, 23, GL_RGB, GL_UNSIGNED_BYTE, (GLvoid*)data);
That wasn't so hard, was it? ;)
04-02-2008, 04:14 AM
Thank you for your reply. I was able to display each image separately. Thanks.
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.