Advertisement

06.15.2008 at 04:30AM PDT, ID: 23486057
[x]
Attachment Details

Calculate Position of an Object after Performing Tranlations (OpenGL)

Asked by Jamsb in OpenGL Graphics & Game Programming, Graphics & Game Programming, 3D Game Programming

Tags: C++, OPengl 3d Graphics Math

Basically I have written a Cube class. It has a member variable that determines the location it should be drawn in. I set the coordinates then call its Draw method. This Pushes the current matrix onto the stack, moves to correct position (glTranslatef) draws the cube, then pops the matrix back off the stack.

This all works fine, but elsewhere in my code I have done other translations (a rotate) and I could like to  calculate what the co-ordinate of the cube would be after the translation.

So..:
1. Am i doing this the wrong way? Should I not be using glTranslatef and manuallycalculate the position of the cube using a custom matrix and redraw it?
2. Could I multiply the coordintes of the cube by somthing to get its new position? Is there a function for this.

I'm terribly confused! Hope i have explained things OK. Start Free Trial
Attachments:
 
 
[+][-]06.15.2008 at 04:53AM PDT, ID: 21788231

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.15.2008 at 06:38AM PDT, ID: 21788564

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: OpenGL Graphics & Game Programming, Graphics & Game Programming, 3D Game Programming
Tags: C++, OPengl 3d Graphics Math
Sign Up Now!
Solution Provided By: ikework
Participating Experts: 1
Solution Grade: A
 
 
[+][-]06.15.2008 at 07:18AM PDT, ID: 21788649

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.15.2008 at 07:55AM PDT, ID: 21788720

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628