Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Unexpected Issues with dbScaleObject()

Author
Message
Terrorist Zero
18
Years of Service
User Offline
Joined: 29th Aug 2006
Location: Teh YouKai
Posted: 4th Dec 2008 19:13 Edited at: 4th Dec 2008 19:19
Hey all, after the convention I've been busy with my work at uni, but as I've settled down a bit I've got some free time to write some games. Yesterday I started up a new 3D game, but have managed to somehow fall over at the first hurdle whilst using the dbScaleObject() command.

I'd written a "player" class to also include object pos/rotation/scale variables and the respective functions to get/set them, and to include an "update" function which effectively retrieves all those variables and update the object accordingly. Example:



When adding the dbScaleObject() to the "update object" function the object would disappear although the xScale,yScale,zScale were set to 100.

Commenting out the command would still make the object disappear, and for some reason the xScale,yScale,zScale variables would have to be commented out too, even thought they are only variables and have no effect on the object (i.e. no functions use them). Even wierder uncommenting the variables afterward would make no difference, the object was still there, leaving me to believe it was a memory leak or something to do with the memory locations.

Combinations of commenting out commands give different results, and I can't pinpoint where I'm going wrong. I'm not a complete noob with C++ and the GDK but I'm still refering to my C++ books to help me, and I just know it's something trivial that I'm doing wrong, so if anyone can help it would be much appreciated:

Player.h:


Player.cpp:


Main.cpp:



AMD X2 6400+ (3.2GHz) // K9A2 Platinum 790FX Mobo // 2GB Corsair RAM 1066MHz // Powercolor HD4870 512MB OC'ed
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 4th Dec 2008 22:37
O.K
first of all define your Human before gdk loop
then:
in your constructor, change
float xPosition = 0;
float yPosition = 0;
float zPosition = 0;
float xRotation = 0;
float yRotation = 0;
float zRotation = 0;
float xScale = 100;
float yScale = 100;
float zScale = 100;
to
xPosition = 0;
yPosition = 0;
zPosition = 0;
xRotation = 0;
yRotation = 0;
zRotation = 0;
xScale = 100;
yScale = 100;
zScale = 100;

I think you were declaring them again.
Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 4th Dec 2008 22:58
I don't think you need to rescale it every frame.
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 4th Dec 2008 23:12
forget the move Human thing, it seemed to help before I found the real problem but is not necessery.
Terrorist Zero
18
Years of Service
User Offline
Joined: 29th Aug 2006
Location: Teh YouKai
Posted: 5th Dec 2008 00:13
Yeah it's very inefficient, and I'll change that once the basics are nailed into place, but aside from that it's very odd that even calling the scale function once will mess up the same:

This wont work:


(Creating an object of Player has a constructor requiring "ObjectNum" to be set (i.e. in this case it's 1))

This will work:


And it's making me tear my hair out


AMD X2 6400+ (3.2GHz) // K9A2 Platinum 790FX Mobo // 2GB Corsair RAM 1066MHz // Powercolor HD4870 512MB OC'ed

Login to post a reply

Server time is: 2024-11-25 07:23:56
Your offset time is: 2024-11-25 07:23:56