473,796 Members | 2,632 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

OpenGL Transforming coordinate frames

Hi,

I've having a *small* problem with a small simulation/game I'm trying
to write in C++ using OpenGL. I'm not sure if I need to include code
yet, as it might just make things more complicated, but I can do so if
necessary.

Basically what I'm writing involves a simple sprite fielder trying to
catch a thrown ball. The ball and the fielder are each in their
respective coordinate frames, and I'm using the matrix stack to keep
track of these. I'm also using a camera with gluLookAt(). The user
picks some initial settings like power and release angle, and the balls
trajectory and landing position is calculated. I can plot this landing
spot correctly as long as I stay within the ball's coordinate frame.

What I would like to do is have my fielder go to the position that the
ball will land to catch it. However, I can't seem to get this to work
right. I have the coordinates that the ball is going to land, and I
need to somehow transform them into coordinates that the fielder "can
understand". I would like the fielder to be able to calculate a path
to the ball using several different algorithms. So basically I just
want to make sense of the ball's landings coordinates. I try saving
the model_view matrix of the ball and then loading it back, but somehow
when I plot the point it's not int he right location. It seems to me
to be just simple matrix multiplication, but I'm having a problem
somewhere. Does the camera need to be considered in these
calculations? I've also had a couple of futile efforts at using
gluUnproject + project, but to no avail. Can anyone give me any info,
or refer me some where where I can see some examples? Any help or
advice is welcomed. Thanks.

-Matt

Nov 16 '06 #1
2 2148

ma**********@gm ail.com wrote:
Hi,

I've having a *small* problem with a small simulation/game I'm trying
to write in C++ using OpenGL. I'm not sure if I need to include code
yet, as it might just make things more complicated, but I can do so if
necessary.

Basically what I'm writing involves a simple sprite fielder trying to
catch a thrown ball. The ball and the fielder are each in their
respective coordinate frames, and I'm using the matrix stack to keep
track of these. I'm also using a camera with gluLookAt(). The user
picks some initial settings like power and release angle, and the balls
trajectory and landing position is calculated. I can plot this landing
spot correctly as long as I stay within the ball's coordinate frame.

What I would like to do is have my fielder go to the position that the
ball will land to catch it. However, I can't seem to get this to work
right. I have the coordinates that the ball is going to land, and I
need to somehow transform them into coordinates that the fielder "can
understand". I would like the fielder to be able to calculate a path
to the ball using several different algorithms. So basically I just
want to make sense of the ball's landings coordinates. I try saving
the model_view matrix of the ball and then loading it back, but somehow
when I plot the point it's not int he right location. It seems to me
to be just simple matrix multiplication, but I'm having a problem
somewhere. Does the camera need to be considered in these
calculations? I've also had a couple of futile efforts at using
gluUnproject + project, but to no avail. Can anyone give me any info,
or refer me some where where I can see some examples? Any help or
advice is welcomed. Thanks.

-Matt
You should ask in a relevent news group.
Are you sure you are reversing the projection coordinates? as in z = -z
axis?

Nov 16 '06 #2
ma**********@gm ail.com wrote:
Hi,

I've having a *small* problem with a small simulation/game I'm trying
to write in C++ using OpenGL.
It's really hard to help much here except to tell you how I would do it.

To go from one co-ordinate space to another you need to peform the
reverse which usually means multiplication by the inverse matrix. I you
have an unit orthonormal 3x3 matrix, this is just the matrix transpose.
If you have a homogenous 4x4 matrix then I would do a real matrix
invert (which can be quite efficiently done in for a 4x4).

It's mean many many years since I did much opengl so I don't know what
the latest API advances look like but if I were on the opengl committee
I would have added some apis like a 4x4 invert for example.

G
Nov 16 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
3197
by: Rick Muller | last post by:
I have a problem that I would like to get some advice on from other Pythonistas. I currently manage a (soon to be) open source project for displaying molecular graphics for a variety of different programs. To do this I need to draw pictures of the molecules, typically using OpenGL, and do some basic control, using some widget set. The code currently uses GTK, and runs on Macintosh OS X under Fink, and Linux. I would like to support the...
15
4546
by: oracle411 | last post by:
Hi I'm new to OpenGL, but have an OpenGL application written in CPP that I would like to display on a web browser. Was wondering how this could be done? Thank you very much
10
5223
by: Bad_Kid | last post by:
which is better for what?
6
4676
by: Adam Clauss | last post by:
I have a list of points (their coming in as decimal types, I can convert to PointF) that I am trying to draw to a form. Unfortunately, the coordinate system these points are coming from is not like Windows Forms use. Instead of (0,0) being the top left, (0,0) is in the "standard" graph position in the center of the coordinate plane. (So we have positive and negative values on both the x- and y- axis). Is there a "good" way to convert...
4
4126
by: tobfon | last post by:
I'm creating a scientific visualization application with rather high demands on performance. I've created a nice rendering engine for it in C++/OpenGL and a python interface to the rendering engine. Now I'm looking to build a GUI in python with the rendering engine as an integrated window. I will most likely use wxPython for the GUI and I know it has support for adding an OpenGL canvas. After looking around in these groups and others it...
3
9994
by: jg.campbell.ng | last post by:
I'm beginning learning Python and OpenGL in Python. Python fine. But difficulties with OpenGL; presumably with the installation of OpenGL. OS = Linux FC5. Python program gl_test.py: from OpenGL.GLUT import *
9
7507
by: Achim Domma | last post by:
Hi, I'm developing a GUI app in Python/C++ to visualize numerical results. Currently I'm using Python 2.4 with wx and PyOpenGLContext, but there are no windows binaries for Python 2.5 for quite some time now. I need a OpenGL context without restrictions and some settings dialogs. Is wx + PyOpenGL the way to go? Or could somebody recommend a better set of tools/libs?
5
1821
by: psbasha | last post by:
Hi, I have a Point and Transfoirmation matrix.How to translate the Point from one Coordinate system to other using list . Point1 = #Transformation Matrix T = , ,
3
7443
by: saadkhan | last post by:
hey guys, plz tell me how can i measure fps (frames per second) in C++ using openGL?
0
9533
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10461
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10239
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10019
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7555
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5447
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4122
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2928
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.