Archived

This topic is now archived and is closed to further replies.

nipon

Transform coordinate (please help me to fill in the blank)

Recommended Posts

nipon    122
please help me to fill code..... (xw, yw) is point in picture(test.bmp) (xw1, yw1) (0,0) (xw2, yw2) (50,0) (xw3, yw3) (50,50) (xw4, yw4) (0,50) - this picture is square. - (xw, yw) in pixels. - size of this picture is 150*150 i would like to plot this point in opengl Example code for understand more. please help me to fill code in the space. procedure Tform2.draw; var xw1,yw1,xw2,yw2,xw3,yw3,xw4,yw4:Glfloat; xv1,yv1,xv2,yv2,xv3,yv3,xv4,yv4:Glfloat; begin xw1:=0;yw1:=0; xw2:=50;yw2:=0; xw3:=50;yw3:=50; xw4:=0;yw4:=50; // hear! please fill code xv1 = ? xvw // how xv1 relate with xw1 such as xv1:=xw1*2/150; //i try to do this, but don''t work _ _ _ _ _ _ _ _ _ _ _ _ glBegin(GL_POLYGON); glColor3f(1,0,0); glVertex3f(xv1,yv1,-0.4); glVertex3f(xv2,yv2,-0.4); glVertex3f(xv3,yv3,-0.4); glVertex3f(xv4,yv4,-0.4); glEnd; end; i define viewport just like this. procedure TForm2.FormResize(Sender: TObject); begin glViewport(0,0,width,height); glMatrixMode(GL_PROJECTION); glLoadIdentity; gluPerspective(35,Width/Height,1,100); end; i hope that you may be understand me. thanks you for your sugestion

Share this post


Link to post
Share on other sites