<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.2//EN" "DTD/docbook/docbookx.dtd">
<!--
License Applicability. Except to the extent portions of this file are
made subject to an alternative license as permitted in the SGI Free
Software License B, Version 1.1 (the "License"), the contents of this
file are subject only to the provisions of the License. You may not use
this file except in compliance with the License. You may obtain a copy
of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
http://oss.sgi.com/projects/FreeB
Note that, as provided in the License, the Software is distributed on an
"AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
Original Code. The Original Code is: OpenGL ES Reference Manual,
Version 1.0, released September 2003, developed by Silicon Graphics,
Inc. The Original Code is Copyright (c) 2003 Silicon Graphics, Inc.
Copyright in any portions created by third parties is as indicated
elsewhere herein. All Rights Reserved.
-->
<refentry id="glScale">
<refmeta>
<refentrytitle>glScale</refentrytitle>
<manvolnum>3G</manvolnum>
</refmeta>
<refnamediv>
<refdescriptor>glScale</refdescriptor>
<refname>glScalef</refname>
<refname>glScalex</refname>
<refpurpose>multiply the current matrix by a general scaling
matrix</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>C Specification</title>
<funcsynopsis>
<funcprototype>
<funcdef>void <function>glScalef</function></funcdef>
<paramdef>GLfloat <parameter>x</parameter></paramdef>
<paramdef>GLfloat <parameter>y</parameter></paramdef>
<paramdef>GLfloat <parameter>z</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>void <function>glScalex</function></funcdef>
<paramdef>GLfixed <parameter>x</parameter></paramdef>
<paramdef>GLfixed <parameter>y</parameter></paramdef>
<paramdef>GLfixed <parameter>z</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>Parameters</title>
<variablelist>
<varlistentry>
<term>
<parameter>x</parameter>,
<parameter>y</parameter>,
<parameter>z</parameter>
</term>
<listitem>
<para>Specify scale factors along the
<parameter>x</parameter>,
<parameter>y</parameter>, and
<parameter>z</parameter> axes, respectively.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Description</title>
<para>
<function>glScale</function> produces a nonuniform scaling along the
<parameter>x</parameter>,
<parameter>y</parameter>, and
<parameter>z</parameter>
axes. The three parameters indicate the desired scale factor
along each of the three axes.</para>
<para>The current matrix (see
<citerefentry><refentrytitle>glMatrixMode</refentrytitle></citerefentry>)
is multiplied by this scale matrix, and the product replaces
the current matrix as if <function>glScale</function>
were called with the following matrix as its argument:</para>
<informalequation><math>
<mrow>
<mo>(</mo>
<mtable class="matrix">
<mtr>
<mtd><mi>x</mi></mtd>
<mtd><mn>0</mn></mtd>
<mtd><mn>0</mn></mtd>
<mtd><mn>0</mn></mtd>
</mtr>
<mtr>
<mtd><mn>0</mn></mtd>
<mtd><mi>y</mi></mtd>
<mtd><mn>0</mn></mtd>
<mtd><mn>0</mn></mtd>
</mtr>
<mtr>
<mtd><mn>0</mn></mtd>
<mtd><mn>0</mn></mtd>
<mtd><mi>z</mi></mtd>
<mtd><mn>0</mn></mtd>
</mtr>
<mtr>
<mtd><mn>0</mn></mtd>
<mtd><mn>0</mn></mtd>
<mtd><mn>0</mn></mtd>
<mtd><mn>1</mn></mtd>
</mtr>
</mtable>
<mo>)</mo>
</mrow>
</math></informalequation>
<para>If the matrix mode is either <constant>GL_MODELVIEW</constant> or
<constant>GL_PROJECTION</constant>, all objects drawn after
<function>glScale</function> is called are scaled.</para>
<para>Use
<citerefentry><refentrytitle>glPushMatrix</refentrytitle></citerefentry>
and
<citerefentry><refentrytitle>glPopMatrix</refentrytitle></citerefentry>
to save and restore the unscaled coordinate system.</para>
</refsect1>
<refsect1>
<title>Notes</title>
<para>If scale factors other than 1 are applied to the
modelview matrix and lighting is enabled, lighting often
appears wrong. In that case, enable automatic normalization of
normals by calling
<citerefentry><refentrytitle>glEnable</refentrytitle></citerefentry>
with the argument <constant>GL_NORMALIZE</constant>.</para>
</refsect1>
<refsect1>
<title>See Also</title>
<para>
<citerefentry><refentrytitle>glEnable</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glMatrixMode</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glMultMatrix</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glPushMatrix</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glRotate</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glTranslate</refentrytitle></citerefentry>
</para>
</refsect1>
</refentry>