PDA

View Full Version : Shape Transformation Issue



wedroptozero
11-06-2009, 09:00 AM
So I am currently trying to build a simple piece of code to modify a shape so that when the mouse is clicked and dragged, the shape moves about in perspective mode. However, my code appears correct to me but when I click and drag, the shape simply vanishes. This is what I have...



glPushMatrix();
glTranslatef(cone->getTx(), cone->getTy(), cone->getTz());
glRotatef(1.0, cone->getRx(), cone->getRy(), cone->getRz());
glPopMatrix();


From what I understand this should pop the original matrix, then move the cube (getTx, getTy, etc. return the current x y and z from the shape and were provided, as were the Rx, etc. which return the roll for x y and z). I am unsure as to why the shape vanishes here since a good portion of the code was provided and I am using that to move the shape.

Any suggestions/help would be greatly appreciated, thanks!

-SD

[EDIT]

I also tried:


glTranslatef(0.0, 0.75, 0.0);
glScalef(0.15, 0.15, 1.0);


So I don't think the issue is with the cone. Also I want to add that this gets called by a provided draw() function.

DmitryM
11-06-2009, 09:29 AM
You don't seem to draw anything before doing PopMatrix, so all these transformations are ignored.