PDA

View Full Version : Changing a viewpoint of an object without cam move



heavenssake007
01-18-2009, 06:50 AM
Hello all,

I am quite new to opengl programming. I have one scene in which I render a cube at the right bottom side. Now I want to move the cube to the center without changing my view. I know it's possible to change the camera view and also the position of the object. But is it also possible to put somehow the object(cube,rectangle,sphere) from one place to another without changing the perspective?

Here is one example explaining my problem maybe in a more detailed way:

If I am sitting in a room on the right bottom side is a paper bin. From this position I am able to look inside the bin. Now I want to move this bin to the center, but keep the perspective that I still can look a little bit inside the bin.

Is there any possibility to do this with openGL?

I am thankfull for a little help.

heavenssake007

dletozeun
01-18-2009, 10:10 AM
...without changing the perspective?


What do you mean here? I don't understand your problem, are you looking for something like glTranslate?

heavenssake007
01-18-2009, 10:59 AM
Hello,

glTranslate is moving the object completely and the perspective will be changed. Correct me if i am wrong.
So what i am looking for is a way to move the object, but don't change the angle you watch to the object. This is what i mean by keeping the perspective.

dletozeun
01-18-2009, 03:23 PM
Pardon my ignorance but I still can't visualizing what you need to do... perhaps, some pics would help?
Re-reading your illustration with the paper bin, it comes to my mind this thing: Do you want something like billboard, something to keep the object facing a particular target like the camera? Sorry if I am thousand miles from your idea, I am sure a drawing of your idea would help! :)

James A.
01-18-2009, 07:59 PM
I think heavenssake07 means the image of the bin stays exactly the same as it was when rendered in the corner, it is just shifted in 2D screen space from it's corner to the center; As if done after the 3d rendering is finished.

right?

heavenssake007
01-19-2009, 01:25 AM
Yes,
this is exactly what I mean.
So is there a possibility to do this?

James A.
01-20-2009, 12:20 AM
It is possible :)

One method is done perhaps by rendering your cube/bin as it is in the corner to a Frame Buffer Object or render it to screen and copy it out to a texture using glCopyTexSubImage (i think this is the right function).

Then render the texture you created to a screen aligned polygon, shifting either the texture coordinates or the actual polygon to align your image to the centre.

heavenssake007
01-21-2009, 01:21 AM
Thanks for your answer I will try this and post my result.