Click here to Skip to main content
15,917,709 members
Home / Discussions / Graphics
   

Graphics

 
AnswerRe: How To use DirectX 9.0 for displaying video from devices and capturing frames Pin
LoneInvader200727-Aug-08 19:53
LoneInvader200727-Aug-08 19:53 
AnswerRe: How To use DirectX 9.0 for displaying video from devices and capturing frames Pin
Mark Salsbery26-Aug-08 6:17
Mark Salsbery26-Aug-08 6:17 
QuestionNoobie Direct3D Help Pin
Paul Zaczkowski25-Aug-08 6:07
Paul Zaczkowski25-Aug-08 6:07 
Questionhow to draw line dynamically using OpenGL Pin
King Tran25-Aug-08 4:11
King Tran25-Aug-08 4:11 
AnswerRe: how to draw line dynamically using OpenGL Pin
Cedric Moonen26-Aug-08 2:09
Cedric Moonen26-Aug-08 2:09 
QuestionVirtual camera control/DLL Pin
tjschilling22-Aug-08 5:43
tjschilling22-Aug-08 5:43 
QuestionVideo Standard Changing in Crossbar device [modified] Pin
bhanu_850922-Aug-08 3:40
bhanu_850922-Aug-08 3:40 
QuestionOpenGL orbit camera problems Pin
cmos20-Aug-08 6:43
cmos20-Aug-08 6:43 
Hello, i have some problems with my camera class. I need to rotate around a point, especially in my
case the origin (0,0,0).
I have a camera class that holds the up,view and right vector.

This is, how i zoom in and out.

void CCamera::ZoomCamera(float fMag)
{	
	m_vPosition = m_vPosition  + (m_vViewVector * fMag);	
}


Well im posting the code i used for rotation around the origin

void CCamera::RotateCameraX(float fArgument)
{	
        // first i hvae tried this

	//Vector3f vDistance = m_vTargetPos - m_vPosition;
	//// rotate camera X
	//m_mRotationMatrix.SetXRotationMatrix(fArgument);	
	//m_vViewVector = (m_mRotationMatrix * m_vViewVector).Normalize();	
	//m_vUpVector   = (m_mRotationMatrix * m_vUpVector).Normalize();

	//// set camera to origin
	//m_vPosition.SetAll(0.0f, 0.0f, 0.0f);

	//// compute direction vector from Null position to view vector
	//Vector3f vDirection = m_vViewVector - m_vPosition;
	//
	//// translate cameraposition in direction-vector direction
	//m_vPosition = m_vPosition + (vDirection * -vDistance.Magnitude());



        // Then I tried this, both with the same result
	// rotate camera position around origin,
	m_mRotationMatrix.SetXRotationMatrix(fArgument);
	m_vPosition = m_mRotationMatrix * m_vPosition;

	
}


next method sets the current camera position and is called by the timer from my dialog.

void CCamera::SetCameraPosition()
{
        //compute new viewpoint
        // m_vTargetPos is the position of the origin (0,0,0)
	Vector3f vViewPoint = m_vTargetPos - m_vPosition;

	gluLookAt(m_vPosition.X(),m_vPosition.Y(),m_vPosition.Z(),
			  vViewPoint.X(),vViewPoint.Y(),vViewPoint.Z(),
			  m_vUpVector.X(),m_vUpVector.Y(),m_vUpVector.Z()
			 );
}


SO, first ill explain what will work correctly.
When I start the application and rotate only on one axis. for instance x then it rotates perfectly
around. Same for y and z. But if i mix the rotations like at first a little bit x rotation then y
and then z i can see strange rotations.

For instance when i first rotate x and then y. Y wont rotate fully 360 degrees. It looks like when
you skater drives through a half pipe. Hope you understand what im trying to explain Big Grin | :-D

And sometimes it happens, when i mix the rotations that at the x rotation, the rotation stops at a
certain degree and then it rotates the opposite direction.

Some words about the idea i had solving this problem.
My first idea was to compute the distance vector from camera position to origin and then move the
camera position to 0,0,0, then rotate the camera vectors and then
normalize the view vector and move back the camera along this vector with the magnitude of the
distance vector multiplied.

second idea was almost similar. I rotate the camera position around the origin and then compute the
new view direction for setting in the gluLookAt function.
So the camera should rotate arount the origin and everytime gluLookAt has been called i compute the
new view point. With view point i mean the 2n parameter in gluLookAt
The main idea behind was, the the up and view vector are realtive to the camera position.


gluLookAt(eye,eye,eye,view,view,view,up,up,up)

the origin along the x axis.


Any suggestions to solve this problem ?

greetings,
cmos
QuestionHow to measure high refresh rates? Pin
higil19-Aug-08 20:10
higil19-Aug-08 20:10 
QuestionFastest way to capture screen? Pin
Daniel Jansson19-Aug-08 8:11
Daniel Jansson19-Aug-08 8:11 
AnswerRe: Fastest way to capture screen? Pin
Mark Salsbery19-Aug-08 9:05
Mark Salsbery19-Aug-08 9:05 
GeneralRe: Fastest way to capture screen? Pin
Daniel Jansson20-Aug-08 3:48
Daniel Jansson20-Aug-08 3:48 
GeneralRe: Fastest way to capture screen? Pin
Mark Salsbery20-Aug-08 5:05
Mark Salsbery20-Aug-08 5:05 
Questionneed suggestion Pin
ulucky19-Aug-08 2:11
ulucky19-Aug-08 2:11 
Questionerror code: S1001 for directx sdk June 2008 Pin
JoshTheMan18-Aug-08 20:22
JoshTheMan18-Aug-08 20:22 
AnswerRe: error code: S1001 for directx sdk June 2008 Pin
Tim Craig19-Aug-08 17:58
Tim Craig19-Aug-08 17:58 
QuestionRe: error code: S1001 for directx sdk June 2008 Pin
Jack_Voltaire10-Sep-08 1:07
Jack_Voltaire10-Sep-08 1:07 
QuestionSetPixel() too slow? Pin
Naturality18-Aug-08 10:49
Naturality18-Aug-08 10:49 
AnswerRe: SetPixel() too slow? Pin
Matthew Butler18-Aug-08 12:35
Matthew Butler18-Aug-08 12:35 
GeneralRe: SetPixel() too slow? Pin
Naturality18-Aug-08 13:01
Naturality18-Aug-08 13:01 
GeneralRe: SetPixel() too slow? Pin
Mark Salsbery18-Aug-08 14:38
Mark Salsbery18-Aug-08 14:38 
GeneralRe: SetPixel() too slow? Pin
Naturality19-Aug-08 11:28
Naturality19-Aug-08 11:28 
Questioncan rotation be performed using translation itself? Pin
ashishsagarwal18-Aug-08 6:22
ashishsagarwal18-Aug-08 6:22 
QuestionXNA 3d model formats Pin
MikeMarq17-Aug-08 6:12
MikeMarq17-Aug-08 6:12 
QuestionDirectX9 novice help Pin
Dave_BHGF16-Aug-08 7:43
Dave_BHGF16-Aug-08 7:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.