opengl + zoom

  • Follow


hello groups.

sorry to ask again but i m not getting the solution.

i have loaded the tiff image but not able to zoom the image.
my code is as follows.


int main(int argc, char** argv)
{

   glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
    TIFF *tif;
   	char emsg[1024];
  	int i;


	tif = TIFFOpen("vancouver.tif", "r");

	if (TIFFRGBAImageBegin(&img, tif, 0, emsg)) {

    	npixels = img.width * img.height;
	raster = (uint32 *) _TIFFmalloc(npixels * sizeof(uint32));
    	if (raster != NULL) {
      	if (TIFFRGBAImageGet(&img, raster, img.width, img.height) == 0)
{
        TIFFError(filename, emsg);
        //exit(1);
      }
    }
    TIFFRGBAImageEnd(&img);
  } else {
    TIFFError(filename, emsg);
   exit(1);
  }

	imgwidth = img.width;
 	 imgheight = img.height;

    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);

   glutInitWindowSize(imgwidth, imgheight);
   glutCreateWindow(argv[0]);
   	glutReshapeFunc(reshape);
	glutDisplayFunc(display);

   init();

      glutMainLoop();
   return 0;
}


and using glDrawPixel() to display the image.

and glPixelZoom(); and glCopyPixel() to zoom the image.

this image is a map.

now i want to zoom this image . i want to select the perticular portion
of the image and  zoom it, just same as in google earth or wikimapia.
can anybody  tell me how to zoom the image . which functions shall i
use ?
or can give some sample code.

plz help to solve this problem.

thanx in advance.

0
Reply aaliya.zarrin (19) 12/15/2006 10:22:33 AM

ruby wrote:

> now i want to zoom this image . i want to select the perticular
> portion of the image and  zoom it, just same as in google earth
> or wikimapia. can anybody  tell me how to zoom the image .
> which functions shall i use ?

Don't use glDrawPixels. It's old and will be probably removed
from OpenGL 3. Use textures instead. Those are usually more
performant, too. Especially selecting a subimage is far easier
with textures.

> or can give some sample code.

Look up texturing tutorials. You might also want to have a look
at ARB_texture_rectangle extension (you will hardly find a card
that can't do this).

Wolfgang Draxinger
-- 
E-Mail address works, Jabber: hexarith@jabber.org, ICQ: 134682867

0
Reply Wolfgang 12/15/2006 10:29:18 AM


actually i m using opengl with wxWidgets for creating collecting the
rectangle (selecting the section for zooming image)coordinates on mouse
click event.

i want the area inside the rectangle should get zoomed.
i m not much familiar with texturing?
shall tiff image can be directly read as texture image?

0
Reply ruby 12/15/2006 11:35:32 AM

ruby wrote:

> i want the area inside the rectangle should get zoomed.
> i m not much familiar with texturing?
> shall tiff image can be directly read as texture image?

It makes no difference if you pass the data to glDrawPixels or to
glTexImage2D. The in memory format is the same. Disable
mipmaping, then there's nothing additional you have to bother
with.

Wolfgang Draxinger
-- 
E-Mail address works, Jabber: hexarith@jabber.org, ICQ: 134682867

0
Reply Wolfgang 12/15/2006 11:45:46 AM

but still i m not getting !!!!!!!!!!

0
Reply ruby 12/18/2006 3:54:32 AM

4 Replies
305 Views

(page loaded in 0.055 seconds)

Similiar Articles:













7/26/2012 1:55:16 AM


Reply: