PDA

View Full Version : about glscale() -_-!

iux
02-03-2003, 12:17 PM
hi,
i want to render an object a bit smaller,then how can i use glScale()??
for example wanna it be the half,then how can i write with the attribute in this function?

thx for helping

nexusone
02-03-2003, 12:53 PM
Example:

glScale_(x_axis, y_axis, z_axis)

_ = f for float, d for double, i for int

//Draw object
//
glPushMatrix(); // We use this so Scale will not effect next objects, also use with translate and rotate of an object

glTranslatef(x, y, z);
glRotatef(angle, x, y ,z);
glScalef( 1.0, 1.0, 1.0); // 1.0 is no change to scale, 0.5 would be half size, 2.0 would be double.

draw_object();
glPopMatrix(); restore matrix

also look at some openGL tutors like at nehe.gamedev.net

Originally posted by iux:
hi,
i want to render an object a bit smaller,then how can i use glScale()??
for example wanna it be the half,then how can i write with the attribute in this function?

thx for helping

iux
02-03-2003, 10:39 PM
thx a lot
you r very friendly

http://www.opengl.org/discussion_boards/ubb/smile.gif

Originally posted by nexusone:
Example:

glScale_(x_axis, y_axis, z_axis)

_ = f for float, d for double, i for int

//Draw object
//
glPushMatrix(); // We use this so Scale will not effect next objects, also use with translate and rotate of an object

glTranslatef(x, y, z);
glRotatef(angle, x, y ,z);
glScalef( 1.0, 1.0, 1.0); // 1.0 is no change to scale, 0.5 would be half size, 2.0 would be double.

draw_object();
glPopMatrix(); restore matrix

also look at some openGL tutors like at nehe.gamedev.net

gvm
02-04-2003, 01:45 AM
don't forget glEnable(GL_NORMALIZE);
or the normals will be scaled to and you will get strange effect(when using lighting)

iux
02-05-2003, 03:22 AM
or thx,
its importent to me http://www.opengl.org/discussion_boards/ubb/smile.gif

Originally posted by gvm:
don't forget glEnable(GL_NORMALIZE);
or the normals will be scaled to and you will get strange effect(when using lighting)