How to get a textures 2d on screen area

do you know what i mean? im going to make a cross word application, the crossword surface will be at an angle and i want the user to be able to select any square from the grid. so i need to be able to grab the resulting area of a texture after its been translated and rotated in order to find out if a touch event is inside it.

ill probably be using an OfTexture

May be ofCamera.screenToWorld() and ofCamera.worldToScreen() what you are looking for?

sounds perfect, how can i find a point on an object that has been transformed and rotated? for example in the textureScreenGrab example program

ofPushMatrix();
	ofSetHexColor(0xffffff);
	ofTranslate(550,300,0);
	glRotatef(counter, 0.1f, 0.03f, 0);
	float width = 200 + 100 * sin(counter/200.0f);
	float height = 200 + 100 * sin(counter/200.0f);;
	texScreen.draw(-width/2,-height/2,width,height);
ofPopMatrix();

could i do the same transform and rotate then find out the camera coordinates using the points that were used to draw it in the textures draw function?

Hello,

if i understand correctly, your problem can be solved by using the inverse matrix of the transformation to find out if a point is inside. It is described here: http://forum.openframeworks.cc/t/how-to-detect-touch-area-of-rotated-rectangle/16232

Best,
V

ive tested that, it looks very promising, it works if im rotating around the z axis as though it were a 2d game, but if i rotate around the x or y axis then it doesn’t work. is this technique only intended for 2d objects?