Hi everyone
I’m trying to draw an image, and draw a zoom circle on top of it, so when the user moves the mouse, the zoom circle moves and the user sees the zoomed image inside of it.
After running the program, I notice that the zoom circle acts strangely, but only in some parts of the image.
I recorded a short clip of this:
https://www.youtube.com/watch?feature=player_detailpage&v=7QaSrZIwhMw
Since I’m new to both openframeworks and opengl, I’m not sure if I am doing this the right way or not.
here’s my code:
//DRAW IMAGE
ofImage image;
image.loadImage("images/image01.png");
float height=840;
float width=image.width*height/image.height;
ofSetColor(255,255,255);
image.draw(100,30,width,height);
//DRAW ZOOM GLASS
float radius=130;
ofSetColor(57,74,84);
ofNoFill();
ofSetLineWidth(10);
ofCircle(mouseX,mouseY,radius);
//DRAW ZOOMED IMAGE INSIDE GLASS
ofImage zoomedImage=image;
float zoomFactor=image.height/height;
ofSetColor(255,255,255);
ofMesh meshNormal;
ofMesh meshZoomed;
ofPath path;
path.setCircleResolution(100);
path.setFilled(true);
path.circle(mouseX,mouseY,radius-5);
path.close();
meshNormal=path.getTessellation();
path.clear();
path.setCircleResolution(100);
path.setFilled(true);
path.circle((mouseX-left)*zoomFactor,(mouseY-top)*zoomFactor,radius-5);
path.close();
meshZoomed=path.getTessellation();
for (int i=0;i<meshNormal.getNumVertices();i++)
meshNormal.addTexCoord(meshZoomed.getVertex(i));
zoomedImage.bind();
meshNormal.draw();
zoomedImage.unbind();
Thanks in advance for your help.