GIDForums  

Go Back   GIDForums > Computer Programming Forums > OpenGL Programming
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 15-Jul-2008, 13:25
sheree sheree is offline
Awaiting Email Confirmation
 
Join Date: Mar 2008
Posts: 15
sheree is on a distinguished road
Red face

Opengl camera problem


Hello everyone,
I had built my camera by only using the position of the camera and its reference point where they are the parameters of opengl function :


CPP / C++ / C Code:
glLookAt(eye_x,eye_y,eye_z,center_x,center_y,cente_z,up_x,up_y,up_z);

and I have my view domain represented by the position of the camera as the top of the pyramid and it far plane defined by four points, so my reshape function is :

CPP / C++ / C Code:
static void Reshape(int w, int h)
{	
    if(w ==0 || h == 0 ) return;
    glViewport (0, 0, w, h);
    glMatrixMode (GL_PROJECTION);
    glLoadIdentity ();
    gluPerspective(val,(float)w/h, zNear,zFar);
    glMatrixMode( GL_MODELVIEW );
    glLoadIdentity ();
    gluLookAt(eye_x,leye_y,eye_z,
            center_x,
            center_y,
            cente_z,
            0.0f,1.0f,0.0f);
}

so, the following function :

CPP / C++ / C Code:
gluPerspective(val,(float)w/h, zNear,zFar);


define my view frustum and I have computed the four points of the far plane.

and by key board function :

CPP / C++ / C Code:
case GLUT_KEY_F1:
            glGetDoublev(GL_MODELVIEW_MATRIX,rom);
            glRotated(1.5,m[0],m[4],m[8]);
            rotation_by_opengl();
            break;

I used this function:

CPP / C++ / C Code:
rotation_by_opengl();

which rotates the aforesaid initial points with respect to to the detected array m[16] and to move the camera poistion and reference point respectively rotate the reference point using the same m[16] and use the result poit in glLookAt() in display function.
So, I thought I will get the correct movement of my camera but actually it doesn't.
If you have some ideas or you may see some mistakes in my initializations, I will be appreciate any suggestions

Sheree
  #2  
Old 15-Jul-2008, 15:41
sheree sheree is offline
Awaiting Email Confirmation
 
Join Date: Mar 2008
Posts: 15
sheree is on a distinguished road

Re: Opengl camera problem


Alright, I think my problem is that I don't move my camera position respectively, but now could any one tell me how can I compute the correct new position of my camera
  #3  
Old 01-Aug-2008, 10:09
sheree sheree is offline
Awaiting Email Confirmation
 
Join Date: Mar 2008
Posts: 15
sheree is on a distinguished road

Re: Opengl camera problem


Okay gys,
I don't know, weather my question is difficult to answer or just naive :-(
well, simply I need to know how can I control the movement of the camera in my scenery and every time get new camera view with the possibility to get an appropriate view size of my scene.
Actually, I have looked at some examples for a similar thing and I have found this tutorial :
www.lighthouse3d.com
which simply contain explanation on how to deal with LookAt function, but it still simple example, and I want a more complicate example of dealing with LookAt function along with compatible view size and camera free motion.
So, again if you have any suggestions or may be other tutorial that could be more interest.
Thanks
  #4  
Old 26-Dec-2009, 06:27
generalchaoszzz generalchaoszzz is offline
New Member
 
Join Date: Dec 2009
Posts: 8
generalchaoszzz is on a distinguished road

Re: Opengl camera problem


use math.
and quees new position using math.
opengl do not hawe anything at hand
 
 

Recent GIDBlogProblems with the Navy (Enlisted) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with udating a function in opengl sheree OpenGL Programming 1 25-Jun-2008 11:33
Help!!! A Problem with Camera Resolution Melvin Lin C++ Forum 8 18-Jun-2004 21:36

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 19:38.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.