MipMap Images for Image Viewer

MipMap Images for Image Viewer

Post by Sean Fin » Fri, 28 Jul 2000 04:00:00



Hi there.

I'm writing an image processing app, and using OpenGL for the image viewing.
I am trying to use MipMap and Textures to display the 2D data in a window.

I read in the image data, and create a window that is equal to the images
height and width.  But, when I create the Rectangle (using glVertex2f), I am
just using the -1,-1,1,1 coords for a standard rectangle.  The image is
therefore becoming a square, no matter what the width and height are.

Next step was to create width and height ratios:

GLfloat width_r = width / height;
GLfloat height_r = height / width;
...
glVertex2f(-width_r, -height_r);
glVertex2f(-width_r, heihgt_r);
glVertex2f(width_r, height_r);
glVertex2f(width_r, -height_r);

This works ok when height is greater than width, or vice versa.  But, when
they are equal or near equal, the rectangle takes up only part of the
window.

Is there any way to just create a rectangle using Object coords that will be
equal to the Window size I have specified?

Thanks for any help,

Sean

 
 
 

MipMap Images for Image Viewer

Post by Sean Fin » Tue, 01 Aug 2000 04:00:00


Well, since no one replied, I figured it out by myself:

for future reference:

GLfloat width_r, height_r;

if(image->width > image->height)
{
    width_r = 1.0f;
    height_r = image->height / image->width;

Quote:}

else
{
    height_r = 1.0f;
    width_r = image->width / image->height;

Quote:}

glRectf(-width_r, -heigh_r, width_r, height_r);

SwapBuffers(dc);

________________________


> Hi there.

> I'm writing an image processing app, and using OpenGL for the image
viewing.
> I am trying to use MipMap and Textures to display the 2D data in a window.

> I read in the image data, and create a window that is equal to the images
> height and width.  But, when I create the Rectangle (using glVertex2f), I
am
> just using the -1,-1,1,1 coords for a standard rectangle.  The image is
> therefore becoming a square, no matter what the width and height are.

> Next step was to create width and height ratios:

> GLfloat width_r = width / height;
> GLfloat height_r = height / width;
> ...
> glVertex2f(-width_r, -height_r);
> glVertex2f(-width_r, heihgt_r);
> glVertex2f(width_r, height_r);
> glVertex2f(width_r, -height_r);

> This works ok when height is greater than width, or vice versa.  But, when
> they are equal or near equal, the rectangle takes up only part of the
> window.

> Is there any way to just create a rectangle using Object coords that will
be
> equal to the Window size I have specified?

> Thanks for any help,

> Sean



 
 
 

1. Image viewer for plain binary images

I have a plain binary image with following specification.

Resolution: 256 X 256 8 bits/pixel monochrome.

I am looking for a shareware or freeware image viewer for WIN95 by which
I can read this image.

--> Please note that this image is in plain binary format and not in any
standard format like TIFF or GIF.

Any help would be appreciated.

Thanks,

V.P.Patel

2. Somebody know what's up with Relisys Web Page

3. Image viewer which handles wavelet compressed images?

4. Artist wanted for Atari Jaguar game

5. image controls on image viewer?

6. current version of Steamer

7. Image Viewer for several image formats

8. IP address for ftp.newtek.com?

9. Envision Image Library / Wang Image Viewer

10. Image Database Software / Image Catalogues / Image Library summary

11. OPEN/image TIPS: Attention Wang OPEN/image document imaging sites

12. image 1 + image 2 = image 3 how ???

13. Image, Hot Image and Disabled Image