running problem!
i use nehe basecode for my aps, but in my latest rts engine that i have been working on since this summer i have a weird problem.
Everything thats happening with my Camera class goes alot faster if i move my mouse, it''s very strange, and i can''t find the problem?
any ideas?
Nothing I can think of just from the problem alone. Try posting your camera class/input code.
_______________________________________Pixelante Game Studios - Fowl Language
here is the camera class.
Camera.cpp
Camera.h
[edited by - CondiS on December 18, 2002 5:40:31 PM]
Camera.cpp
#include "Include.h"#include "Camera.h"cCamera* cCamera::Instance = NULL;bool cCamera::Created = false;cCamera *cCamera::Create() { if(!Created) { Created = true; Instance = new cCamera; } return Instance;}cCamera::~cCamera() { Created = false;}void cCamera::LookAt() { gluLookAt(Pos.x, Pos.y, Pos.z, Look.x, Look.y, Look.z, UpV.x, UpV.y, UpV.z);}cVector cCamera::GetLookAt() { return Look;}cVector cCamera::GetPosition() { return Pos;}cVector cCamera::GetUpVector() { return UpV;}void cCamera::SetLookAt(cVector &LookAt) { Look.x = LookAt.x; Look.y = LookAt.y; Look.z = LookAt.z;}void cCamera::SetPosition(cVector &Position) { Pos.x = Position.x; Pos.y = Position.y; Pos.z = Position.z;}void cCamera::SetUpVector(cVector &UpVector) { UpV.x = UpVector.x; UpV.y = UpVector.y; UpV.z = UpVector.z;}void cCamera::Move(float move) { cVector vTemp = MakeVector(Pos, Look); //this is our view vector Normalize(vTemp); Pos.x += vTemp.x * move; Pos.z += vTemp.z * move; Look.x += vTemp.x * move; Look.z += vTemp.z * move;}void cCamera::Strafe(float Strafe) { cVector vView = MakeVector(Pos, Look); cVector vCrossProdukt = CrossProdukt(vView, UpV); Normalize(vCrossProdukt); Pos.x += vCrossProdukt.x * Strafe; Pos.z += vCrossProdukt.z * Strafe; Look.x += vCrossProdukt.x * Strafe; Look.z += vCrossProdukt.z * Strafe;}void cCamera::Zoom(float Zoom) { cVector vView=MakeVector(Pos, Look); Normalize(vView); Pos.x += vView.x * Zoom; Pos.y += vView.y * Zoom; Pos.z += vView.z * Zoom;}
Camera.h
#ifndef _CAMERA_H_#define _CAMERA_H_#include "Include.h"#include "Math.h"class cCamera {private: static cCamera *Instance; static bool Created; cCamera() { UpV.x = 0; UpV.y = 1; UpV.z = 0; } cCamera(const cCamera&) {} cCamera& operator =(const cCamera&) {}public: static cCamera *Create(); ~cCamera(); cVector Pos, Look, UpV; void LookAt(); cVector GetPosition(); cVector GetLookAt(); cVector GetUpVector(); void SetPosition(cVector &Position); void SetLookAt(cVector &LookAt); void SetUpVector(cVector &UpVector); void RotateView(float Angle, float x, float y, float z); void RotateViewAroundPoint(cVector vCenter, float Angle, float x, float y, float z); void Strafe(float Strafe); void Move(float Move); void Zoom(float Zoom);};#endif
[edited by - CondiS on December 18, 2002 5:40:31 PM]
It sounds as if you''re using the ''wait for message then do something'' type message loop. For example, the scene will only be rendered when the window gets a message ( your mouse cursor creates one for every pixel it moves ). The only doubt I have about this explination is that NeHe''s tutorials run in a non-delayed message mode.
thats the strange part =)
the fps is the same wether i move my mouse or not! =(
the fps is the same wether i move my mouse or not! =(
quote:
Original post by Hawkeye3
It sounds as if you''re using the ''wait for message then do something'' type message loop. For example, the scene will only be rendered when the window gets a message ( your mouse cursor creates one for every pixel it moves ). The only doubt I have about this explination is that NeHe''s tutorials run in a non-delayed message mode.
thnx mate =)
you led me to the error, i hade put the checkkeys in the messagehandler loop, so when i moved my mouse there was a message being handled and the keys checked again =)
thnx again..
Glad I could help 
Hmm while we are on the topic, would you happen to have any idea on how to switch between delayed and realtime message modes? For example, Unreal Ed has a realtime preview mode that constantly draws the scene, and if you cut it off, it only updates when your mouse moves, ect.

Hmm while we are on the topic, would you happen to have any idea on how to switch between delayed and realtime message modes? For example, Unreal Ed has a realtime preview mode that constantly draws the scene, and if you cut it off, it only updates when your mouse moves, ect.
quote:
Original post by Hawkeye3
Glad I could help
Hmm while we are on the topic, would you happen to have any idea on how to switch between delayed and realtime message modes? For example, Unreal Ed has a realtime preview mode that constantly draws the scene, and if you cut it off, it only updates when your mouse moves, ect.
no sorry, the only code i have that is "copied" is the window code =(
thats becouse i concentrate on opengl and c++ and not fucking ms!!!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement