I recently read some physx things. I wanted to write a demo trainer and I encountered a very strange problem.
When I was excited to use Wizard to create a project, compile and run it, it turned out to be a black one?
Strange, this Wizard program should be okay, or how can I release it?
Switch to release, and the compilation... results are normal!
I tracked it with the PIX and found that the transformation matrices of the two versions are different!
At that time, I was at a loss... I used the testviewer compiler provided by the SDK to compile and run it. The debug version turned out to be like this:
Only two feet can be seen, and the mouse operation does not respond!
Too bad ~
The Code has not been modified, because I have set up SVN on my local machine and all the modifications are recorded.
Reinstall arip2009 and the result is still the same!
Then QQ asked friends who are also studying nebula. Their results are correct!
I sent the compiled testviewer.debug.exe, and the result is also normal on their side...
Then, I naturally ruled out the possibility of code errors.
First, I doubt whether my software environment is in conflict, because I am used to installing a lot of software .....
Just happened to catch up with windows out of RTM, and I found the activation bios of my motherboard on the super-frequency Forum (I spent money to get a dedicated super-frequency, but I didn't buy it back too much -_-), so we upgraded...
Although it is shameful to use pirated software as a software developer, I cannot wait until I start selling Windows 7 to solve the current problem.
XP-> win7, dx sdk March 2008-> March 2009, vs2005-> vs2008, 9800gt driver, SVN, etc, updated, too ......
Then I compiled it again with hope in the new environment... the result is still incorrect.
I was depressed at the time. Is there a hardware problem? No, release is normal -_-
Go to the previous version of the N3 SDK and compile it. It is normal...
Is it a compilation option problem? All changed back, compilation, still not good
I found another guy who is almost the same as my software and hardware environment and tested it. He is also normal!
I found another buddy, and finally he had the same symptoms, but he couldn't check it together without 3D -_-
I had a debate with the second-to-last buddy. He said: Why can't I operate?
In a word, I woke up with a dream: I 've always been focusing on the transformation matrix. Why is it incorrect? I thought the matrix was incorrect, so I couldn't operate it.
Find the processing code of the operation and see the following section:
// Process gamepad input <br/> float zoomin = 0.0f; <br/> float zoomout = 0.0f; <br/> float2 panning (0.0f, 0.0f ); <br/> float2 orbiting (0.0f, 0.0f); <br/> If (gamepad-> isconnected () <br/>{< br/> const float gamepadzoomspeed = 50366f; <br/> const float gamepadorbitspeed = 10.0f; <br/> const float gamepadpanspeed = 10.0f; <br/> If (gamepad-> buttondown (gamepad: abutton )) <br/>{< br/> This-> mayacamerautil. reset (); <br/>}< br/> If (gamepad-> buttondown (gamepad: startbutton) | <br/> gamepad-> buttondown (gamepad :: backbutton) <br/>{< br/> This-> setquitrequested (true); <br/>}< br/> float frametime = (float) this-> getframetime (); <br/> zoomin + = gamepad-> getaxisvalue (gamepad: righttriggeraxis) * frametime * gamepadzoomspeed; <br/> zoomout + = gamepad-> getaxisvalue (gamepad: lefttriggeraxis) * frametime * gamepadzoomspeed; <br/> panning. X () + = gamepad-> getaxisvalue (gamepad: rightthumbxaxis) * frametime * gamepadpanspeed; <br/> panning. Y () + = gamepad-> getaxisvalue (gamepad: rightthumbyaxis) * frametime * gamepadpanspeed; <br/> orbiting. X () + = gamepad-> getaxisvalue (gamepad: leftthumbxaxis) * frametime * gamepadorbitspeed; <br/> orbiting. Y () + = gamepad-> getaxisvalue (gamepad: leftthumbyaxis) * frametime * gamepadorbitspeed; <br/>}< br/>
Well, I have installed a 360 handle. If I don't move it there, it will also affect the operation, right? Comment out, compile, and debug results are finally normal!
Next breakpoint observation, found float frametime = (float) This-> getframetime (); returned is an invalid value ...... Khan
Go to the old nest of frametime and find such a thing:
// Expiration <br/>/** <br/> */<br/> renderapplication: renderapplication (): <br/> // time (0.0 ), <br/> // frametime (0.0), <br/> quitrequested (false) <br/>{< br/> // empty <br/>}
Are these two variables not initialized? Crazy... I also thought about why variables are not initialized at the beginning, because this is the most common cause for different debug/release results.
However, running normally on other machines makes me eliminate the possibility of code errors and keep searching for running environment problems.
Asked the same-person buddy, he also inserted a 360 controller to play mgs, and crashed.
The final solution is to remove the annotator of the above two variables and compile them. OK .........