Hi people, I have a problem that i dont understand why it happen. I set on my listener a player object and when i create the listener i pass the main player pointer to the attribute player from my listenner, and in the listener i check key press and change player position. But the bug is that when i try get player information or other information about objects that i pass after listener ...
No way I am going to waste my time debugging your code. Do yourself a huge favour and learn how to debug . The way you do it, is to get real close to where it fails, by using Step in, Step over, etc. And by setting a breakpoint closer and closer to where it fails. Learn how to use your debugger. Make it your best programming friend.
Man im a programmer for 7 years. Im using visual studio a long time and know how to debug. The problem is not with debug, the problem is to debug OGRE APPLICATIONS. The problem on debug only happen on OGRE!!!! If i play the OGRE APP appear a message that i dont know to solve and dont know why it apper, but the application start normal if executed direct by EXE. You can read my message before...
Take code out of your program, block by block, and see when it stops crashing. Then you can start adding code back, and see which line causes the crash.
Haven't used VS in a while, but as far as I remember, you probably have to fix your working directory in the debugger settings to the directory where the .exe resides. Also, posting the message that you get can help.
Im already do it man!!! Im saying that i dont know what happen. To me its ok, only move a node!! The code only initialize the Ogre and put the 3 meshes on scene. After this the listener verifiy if W is pressed, and call player->update(evt.timeSinceLastFrame, mKeyboard). But the error happen in the class player, when i use this->node->setPosition or anything on this->node crash the program....
You are lucky, because you know where it happens. Put a breakpoint right where you detect that key-press, and look at the stack. You may have to walk the stack a bit to reach your own code, but it will show you what's going on. You might need to add additional breakpoints, and use the debugging stepper to slowly move towards where it all fails.
I think yes, because if i change the code: Code: Select all if (input->isKeyDown(OIS::KC_W)) { Vector3 pos = node->getPosition(); //<- bug on try access node? but it create sucefully before pos.y += 1; node->setPosition(pos); } to Code: Select all if (input->isKeyDown(OIS::KC_W)) { exit(EXIT_SUCCESS); } It run OK and exit. The problem is when i try access the ...
This code of yours is really really evil. Try to name your variables a little bit more ... variously. Code: Select all class EngineFrameListener : public FrameListener , public WindowEventListener { // ... void setPlayer(Player *player) { player = player; } // ... //player Player* player; }; BTW, I couldn't really debug your code (sorry!!), because ...
Bug solved, the problem is the default option of config screen: RTT Prefered Mode of OpenGL. If i change from FBO to other, it run normal and now i can debug. Thanks ppl.
prchakal wrote: Oh man...thanks very much! I forgot the 'this->' on method 'setPlayer'. The real solution is to name your member variables differently from local variables so that they don't get shadowed. A common idiom used is to prefix with 'm' or 'm_' or '_' to keep them seperate, like mPlayer. Doing 'this->' every time is not really a solution IMHO.
Here's a handy reference on magic debug values: http://en.wikipedia.org/wiki/Magic_debug_values All programmers (using visual studio) should memorise the meaning of at least cdcdcdcd, cccccccc and feeefeee, they are the most common ones. Your error message says "Access violation reading location 0xfeeeff63". feeeff63 is an invalid memory location, so visual studio is stopping you from reading it. The fact that the bad...
This code of yours is really really evil. Try to name your variables a little bit more ... variously. Code: Select all class EngineFrameListener : public FrameListener , public WindowEventListener { // ... void setPlayer(Player *player) { player = player; } // ... ...
It's trying to access 0xfeeeff63, which is probably a debugger-set memory address for an initialized pointer. Are you sure your "node" point is valid?
Take code out of your program, block by block, and see when it stops crashing. Then you can start adding code back, and see which line causes the crash.
What version of Ogre? If it's trunk, I also had a problem with random crashes at initialisation. If not, then you're doing something wrong. Instead of screenshots, how about you post your code in [code ][/code ] tags?
Thread profile page for "Controlling the player bug! plz urgent" on http://www.ogre3d.org.
This report page is a snippet summary view from a single thread "Controlling the player bug! plz urgent", located on the Message Board at http://www.ogre3d.org.
This thread profile page shows the thread statistics for: Total Authors, Total Thread Posts, and Thread Activity