Im rastering to the window center point to make sure to stay within my clipping range so my image doesn’t disappear when zooming/panning , etc.
All that works. Image never disappears.
The problem i am having has something to do with the WindowOrg point. When i pan or zoom, the image slowly is offset from my screen points. Note: Im plotting points manually ontop of the image. When I pan around the points are slowly offset more and more drastically the further i pan around. Im assuming its a conversion issue? Everything else in the program works fine.
Also, if i Raster to my 0,0 point everything works just fine in terms of zooming and panning until that 0,0 point is outside the clip range then of course the image disappears.
GLfloat x = (-m_image->width / 2) - (m_pWindowOrg.x);
GLfloat y = (m_image->height / 2) - (m_pWindowOrg.y);
glBitmap(NULL,NULL,m_image->width,m_image->height,m_fZoomScale * x,m_fZoomScale * y,NULL);
//Inver the image (the data coming from OpenCV is inverted)
glPixelZoom(m_fZoomScale * 1.0f,m_fZoomScale * -1.0f);
glDrawPixels(m_image->width, m_image->height, GL_RGB, GL_UNSIGNED_BYTE,m_image->imageData);
The raster position is transformed by the modelview matrix. If you are applying some matrix to your modelview while panning and zooming, then it will effect glRasterPos2f. You might want to load an identity matrix, then call glRasterPos2f.
The exact error/crash is 0xC0000005 Access Violation
Doing some Google work its possible its a hardware problem. Not sure yet.
So, i copied my Release EXE file to another PC and i am not receiving the error but, the glWindowPos does not create the same output as glRasterPos. It seems to move the image to a different part of the screen…
So any suggestions on what to do? glRaster works just find short of the image not lining up perfectly with everything else. See my original problem in first post. When i raster to the center of the view screen my image and my drawing are off just a little bit and the more i pan around, the greater the difference. I assumed it was a pixel / screen point problem and i played around there but still could not get it 100%.