Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: about glscale() -_-!

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2003
    Posts
    20

    about glscale() -_-!

    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

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Jun 2000
    Location
    Gastonia, NC, USA
    Posts
    2,096

    Re: about glscale() -_-!

    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

  3. #3
    Junior Member Newbie
    Join Date
    Jan 2003
    Posts
    20

    Re: about glscale() -_-!

    thx a lot
    you r very friendly




    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


  4. #4
    Intern Contributor
    Join Date
    Feb 2003
    Location
    Mitishy
    Posts
    59

    Re: about glscale() -_-!

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

  5. #5
    Junior Member Newbie
    Join Date
    Jan 2003
    Posts
    20

    Re: about glscale() -_-!

    or thx,
    its importent to me

    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)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •