Hi. I have to rewrite a scientific soft dealing with dicom images (256 grayscale levels, 512x512) adding contours, panning and zooming. The problem is that’s written with drawpixels and the image flicks when adding countours for example (each time it refreshs itself - glDrawPixels and glPixelZoom is used for the moment) :
for countouring the image.
Any help for (sigh great) improvement? (textures for the image (512 is not too big?) - glOrtho, glPerspective, … for the zoom and pan - …) Exemples of code welcome;
Thanks a lot everybody adding something ^o^
You should absolutety make textures out of those pictures and drawing them as textured quads. It’s a lot faster that way, and 512*512 textures, even larger, are perfectly ok unless you have a really old graphics card. An additional advantage is, that your image gets scaled by the same matrix as the contours, so they keep automatically nicely attached.
The flicker can propably be fixed by using double buffering.
Ok So I don’t have to cut it in quads ? great ^^
And I understand very well the meaning of taking the same matrix scaling, but how to do that (sorry I just begin OpenGL because of this problem sigh and I’m read all tutorials but it doesn’t deal with such specific problems)
ps: the soft is using glui and glut…
The keyword is “automatically”. You draw the quad representing the image by glVertex commands similar to the ones you use with the contours, so they get transformed in a similar manner.
Ok, thanks a lot it works great ^^
But if i can ask more… Which technique is the best to use to zoom and pan with a texture used in 2D that way??