September 29th, 2011, 11:25 AM
Setting model in the middle of the screen.
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 = x_middle;
trans = - y_middle;
glTranslatef(trans, trans, trans);
Whats the best value for intial trans...Currently I am using
trans = -130.0f
Please give me some suggestions friends. Thanks Sujan
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.