-
September 29th, 2011, 11:25 AM
#1
Setting model in the middle of the screen.
Dear Friends
I have a profile...a curve of GL_LINES
How can I display my curve or model in the middle of the screen. Some parts of the curve is getting out of the visibility. While loading the curve I want to show them just in middle of the screen and fitting the size of the computer screen to the maximum possible size.
Please give me some idea.
Currently I calculating the xmin,xmax and ymin, ymax.
the calculating the middle point position like this.
double x_middle = xmin + (xmax-xmin)/2;
double y_middle = ymin + (ymax-ymin)/2;
Then using glTranslate(); like this
trans[0] = x_middle;
trans[0] = - y_middle;
glTranslatef(trans[0], trans[1], trans[2]);
Whats the best value for intial trans[2]...Currently I am using
trans[2] = -130.0f
Please give me some suggestions friends. Thanks Sujan
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|