[Solved] Camera view messed up?
[Solved] Camera view messed up?
I'm trying to create a camera by writing this before the main loop.
ICameraSceneNode *cam;
cam = sceneManager->addCameraSceneNode();
It does create the camera.. however, the camera only displays half of the screen. The upper half is completely gray. Why is this so?
ICameraSceneNode *cam;
cam = sceneManager->addCameraSceneNode();
It does create the camera.. however, the camera only displays half of the screen. The upper half is completely gray. Why is this so?
Last edited by panto on Sun Mar 20, 2011 9:47 pm, edited 1 time in total.
-
- Posts: 1215
- Joined: Tue Jan 09, 2007 7:03 pm
- Location: Leuven, Belgium
I've traced the error to these lines:
If I uncomment those lines of codes, then there's no graphical glitches. Btw, even if "camera" is not the actual active camera, the output is glitched.. I can't see anything wrong with those lines?
Code: Select all
vector3df rootPos = rootNode->getPosition();
camera->setTarget( rootPos );
camera->setPosition( rootPos + offset );
rootNode->setRotation( vector3df( 0, cameraDirection, 0 ) );
-
- Posts: 1215
- Joined: Tue Jan 09, 2007 7:03 pm
- Location: Leuven, Belgium
This is called 'background'
The grey area is just the color you specify in beginScene(). If you don't want it to be grey you either have to use a different color for clearing the color buffer or draw something into it like a skybox.
The grey area is just the color you specify in beginScene(). If you don't want it to be grey you either have to use a different color for clearing the color buffer or draw something into it like a skybox.
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.
When I comment that snippet of code, then it renders fine...
This is what I exactly do.
1) Create "Player" class before main loop.
2) In the main loop, I call player->Rotate(), which is basically this:
Now.. even if the "camera" which is in player->Rotate() function ISN'T the currently active camera, I still get those glitches.
After some rotation.
This is what I exactly do.
1) Create "Player" class before main loop.
2) In the main loop, I call player->Rotate(), which is basically this:
Code: Select all
//offset is a vector3df.
//cameraDirection is f32.
vector3df rootPos = rootNode->getPosition();
camera->setTarget( rootPos );
camera->setPosition( rootPos + offset );
rootNode->setRotation( vector3df( 0, cameraDirection, 0 ) );
After some rotation.
-
- Posts: 1215
- Joined: Tue Jan 09, 2007 7:03 pm
- Location: Leuven, Belgium
I tried to reproduce it, but I can't. It seems the problems root is deeper within my code.. :/
Here's what I'm basically doing, though. (pastebin links).
main.cpp
BugCulprit.h
BugCulprit.cpp
Here's what I'm basically doing, though. (pastebin links).
main.cpp
BugCulprit.h
BugCulprit.cpp
-
- Posts: 1215
- Joined: Tue Jan 09, 2007 7:03 pm
- Location: Leuven, Belgium
-
- Posts: 1215
- Joined: Tue Jan 09, 2007 7:03 pm
- Location: Leuven, Belgium