473,387 Members | 3,750 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

pointer / deltaTime in OpenGL Game Programming book

Hello
I've a function like:

extern CModelMD3 *pModel;
gameCamera->MoveTo(* pModel);

which returns:
no matching function for call to `CCamera::MoveTo(CModelMD3&)

but in camera.h i've:
void MoveTo(CObject *object);

and in camera.cpp:
void CCamera::MoveTo(CObject *object)
{
....
}

The modelclass is like:
class CModelMD3 : public CObject

I might have missunderstood something here as I'm new to pointers?
Secondly in the book
OpenGL Game Programming there's in the engine example often deltaTime. I
can't find
any definition/declaration. It has random values like 286 but as far as
I've seen always
around 250-350. it's used like position = velocity + deltaTime
What is it? Where is deltaTime defined? How could i use / exchange
deltaTime in Linux/Mac.
THANKS and regards
Michael
Sep 9 '05 #1
4 2659

Michael Sgier wrote:
extern CModelMD3 *pModel;
gameCamera->MoveTo(* pModel);


The second line shoult be:
gameCamera->MoveTo(pModel);

The function takes a pointer as it's argument. Passing "*pModel" means
you're dereferencing the pointer first before passing it - meaning
you'll try to pass the actual object and not the pointer to it.

Cheers,
Andre

Sep 9 '05 #2
Michael Sgier wrote:

Hello
I've a function like:

extern CModelMD3 *pModel;
gameCamera->MoveTo(* pModel);

which returns:
no matching function for call to `CCamera::MoveTo(CModelMD3&)

but in camera.h i've:
void MoveTo(CObject *object);

and in camera.cpp:
void CCamera::MoveTo(CObject *object)
{
...
}


As the compiler tells you: There is no function taking an object or a reference
to an object. There is only a function taking a pointer.

If you have a pointer
extern CModelMD3 *pModel;

the applying the dereference operator on it, as in *pModel
lets you request the object where the pointer points to.

MoveTo wants a pointer, you have a pointer, thus:

gameCamera->MoveTo( pModel);
--
Karl Heinz Buchegger
kb******@gascad.at
Sep 9 '05 #3
Hello
thanks for you answers. Well if i do so:

extern CCamera* gameCamera;
extern CModelMD3 *pModel;
gameCamera->MoveTo(pModel);

i get:
undefined reference to `gameCamera'

which is defined/declared exactly like CModelMD3.
THANKS and regards
Michael
Sep 9 '05 #4

"Michael Sgier" <sg***@nospam.ch> wrote in message
news:43**********************@news.sunrise.ch...
Hello
thanks for you answers. Well if i do so:

extern CCamera* gameCamera;
extern CModelMD3 *pModel;
gameCamera->MoveTo(pModel);

i get:
undefined reference to `gameCamera'

which is defined/declared exactly like CModelMD3.


Changing the parameter to the function MoveTo wouldn't affect whether
gameCamera is defined or not, and that change was the correct thing to do.

Is the error a compile error, or a link error? Is gameCamera actually
defined somewhere else? (That's what the "extern" specifier says.) Do you
include camera.h in this file? (Also, is gameCamera initialized somewhere?)

I'm also wondering where this code you've shown resides. You've got an
extern declaration, and apparently follow it immediately with a function
call. That's pretty strange. Usually extern declarations are made in the
global scope, either before any functions in a cpp file, or in an included
header file. What's the _real_ code look like?

Perhaps you don't need pointers or extern declarations at all, but just
local object declarations, or member declarations? It's impossible to tell
with the little code you've shown, though.

-Howard


Sep 9 '05 #5

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

Similar topics

2
by: DaMan | last post by:
Can anyone recommend a good book that teaches how to program basic games in C++? I have some C and C++ experience, but not too much with graphics. The kind of game I want to write is a simple...
15
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
14
by: Jessica Weiner | last post by:
I am writing an application in C# which need to plot graphs and simple shapes (polygons, circles, squares etc). Which library is better for this purpose and why? Thanks.
22
by: MC felon | last post by:
hello. i have a Dev c++ compiler (version 4.0). i wish to start on openGL. How do i enable openGL programming in Dev c++? what exactly do i download? assume me to be a complete fresher and please...
14
by: Bushido Hacks | last post by:
My name is Bushido Hacks. I am a computer science major from the St. Louis, Missouri area. I wrote a new software installation tutorial for C and C++ programmer who want to create programs as...
9
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...
10
by: Max Kubierschky | last post by:
Hello, I'm planning to give a game programming course for kids of mixed age. For this, I am looking for an open source 2D game development kit. I am also willing to participate in the...
263
by: Malcolm McLean | last post by:
The webpages for my new book are now up and running. The book, Basic Algorithms, describes many of the fundamental algorithms used in practical programming, with a bias towards graphics. It...
3
by: Leon | last post by:
Hey, i am trying to develop a game, and I am using OpenGL and pthread. (on Ubuntu, so i also use the X library.) Now i have a problem. I have initialized OpenGL in the main thread, and i want to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...

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.