#LyX 1.1 created this file. For more info see http://www.lyx.org/
\lyxformat 218
\textclass report
\language english
\inputencoding latin1
\fontscheme default
\graphics default
\float_placement h!p!b
\paperfontsize default
\spacing onehalf 
\papersize Default
\paperpackage a4
\use_geometry 1
\use_amsmath 0
\paperorientation portrait
\leftmargin 0.5in
\topmargin 0.5in
\rightmargin 0.5in
\bottommargin 0.5in
\secnumdepth 2
\tocdepth 2
\paragraph_separation indent
\defskip medskip
\quotes_language swedish
\quotes_times 2
\papercolumns 1
\papersides 1
\paperpagestyle default

\layout Title

Cryptic Allusion KallistiGL / Programmer's Manual
\layout Author


\family roman 
\series medium 
\shape up 
\emph off 
\bar no 
\noun off 
\latex no_latex 
\color none
©
\family default 
\series default 
\shape default 
\emph default 
\bar default 
\noun default 
\latex default 
\color default
2002 Paul Boese
\layout Standard


\begin_inset LatexCommand \tableofcontents{}

\end_inset 


\layout Chapter*

Legal
\layout Standard


\begin_inset Quotes eld
\end_inset 

Sega
\begin_inset Quotes erd
\end_inset 

 and 
\begin_inset Quotes eld
\end_inset 

Dreamcast
\begin_inset Quotes erd
\end_inset 

 are registered trademarks of Sega Enterprises, Ltd.
 This package has no association with Sega or any of its affiliates, besides
 working on their hardware.
\layout Standard


\begin_inset Quotes eld
\end_inset 

Gameboy Advance
\begin_inset Quotes erd
\end_inset 

 is a registered trademark of Nintendo, Inc.
 This package has no association with Nintendo or any of its affiliates,
 besides working on some of their hardware.
\layout Standard


\begin_inset Quotes eld
\end_inset 

OpenGL
\begin_inset Quotes erd
\end_inset 

 is a registered trademark owned by Silicon Graphics, Inc.
 This package has no association with Silicon Graphics or any of its affiliates.
 This product is based on the published OpenGL
\family roman 
\series medium 
\shape up 
\emph off 
\bar no 
\noun off 
\latex no_latex 
\color none
®
\family default 
\series default 
\shape default 
\emph default 
\bar default 
\noun default 
\latex default 
\color default
\SpecialChar ~
API, but is not an implementation which is certified or licensed by Silicon
 Graphics, Inc.
 under the OpenGL
\family roman 
\series medium 
\shape up 
\emph off 
\bar no 
\noun off 
\latex no_latex 
\color none
®
\family default 
\series default 
\shape default 
\emph default 
\bar default 
\noun default 
\latex default 
\color default
\SpecialChar ~
API.
\layout Standard

All other trademarks are owned by their respective trademark holders.
\layout Standard

KallistiOS 
\family roman 
\series medium 
\shape up 
\emph off 
\bar no 
\noun off 
\latex no_latex 
\color none
©
\family default 
\series default 
\shape default 
\emph default 
\bar default 
\noun default 
\latex default 
\color default
2000-2002 Dan Potter.
 Other portions 
\family roman 
\series medium 
\shape up 
\emph off 
\bar no 
\noun off 
\latex no_latex 
\color none
©
\family default 
\series default 
\shape default 
\emph default 
\bar default 
\noun default 
\latex default 
\color default
 their individual authors; please contact the authors for information on
 using and/or distriburing their code.
\layout Standard

KallistiGL 
\family roman 
\series medium 
\shape up 
\emph off 
\bar no 
\noun off 
\latex no_latex 
\color none
©
\family default 
\series default 
\shape default 
\emph default 
\bar default 
\noun default 
\latex default 
\color default
2000-2002 Dan Potter, Benoit Miller, and others.
 Other portions 
\family roman 
\series medium 
\shape up 
\emph off 
\bar no 
\noun off 
\latex no_latex 
\color none
©
\family default 
\series default 
\shape default 
\emph default 
\bar default 
\noun default 
\latex default 
\color default
 their individual authors; please contact the authors for information on
 using and/or distriburing their code.
\layout Standard

Redistribution and use in source and binary forms, with or without modification,
 are permitted provided that the following conditions are met:
\layout Enumerate

Redistributions of source code must retain the above copyright notice, this
 list of conditions and the following disclaimer.
 
\layout Enumerate

Redistributions in binary form must reproduce the above copyright notice,
 this list of conditions and the following disclaimer in the documentation
 and/or other materials provided with the distribution.
 
\layout Enumerate

Neither the name of Cryptic Allusion nor the names of its contributors may
 be used to endorse or promote products derived from this software without
 specific prior written permission.
\layout Standard

THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 DISCLAIMED.
 IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\layout Chapter

Overview
\layout Standard

The KallistiGL (KGL) name is not intended to infringe on the OpenGL
\family roman 
\series medium 
\shape up 
\emph off 
\bar no 
\noun off 
\latex no_latex 
\color none
®
\family default 
\series default 
\shape default 
\emph default 
\bar default 
\noun default 
\latex default 
\color default
\SpecialChar ~
trademark owned by Silicon Graphics Inc.
 It stands for KallistiOS Graphics Library.
 Please note the following quote (in case you didn't read the legal stuff)
 from the trademark.pdf published at the SGI website
\newline 

\begin_inset LatexCommand \url{http://www.sgi.com/software/opengl/license.html}

\end_inset 


\layout Quote


\begin_inset Quotes eld
\end_inset 

This product is based on the published OpenGL
\family roman 
\series medium 
\shape up 
\emph off 
\bar no 
\noun off 
\latex no_latex 
\color none
®
\family default 
\series default 
\shape default 
\emph default 
\bar default 
\noun default 
\latex default 
\color default
\SpecialChar ~
API, but is not an implementation which is certified or licensed by Silicon
 Graphics, Inc.
 under the OpenGL
\family roman 
\series medium 
\shape up 
\emph off 
\bar no 
\noun off 
\latex no_latex 
\color none
®
\family default 
\series default 
\shape default 
\emph default 
\bar default 
\noun default 
\latex default 
\color default
\SpecialChar ~
API.
\begin_inset Quotes erd
\end_inset 


\layout Standard

We are not making this a library that is going to be 100% OpenGL
\family roman 
\series medium 
\shape up 
\emph off 
\bar no 
\noun off 
\latex no_latex 
\color none
®
\family default 
\series default 
\shape default 
\emph default 
\bar default 
\noun default 
\latex default 
\color default
 complient, nor are we planning get it conformance tested and licensed.
 It is our goal to make a library that is fast and provides enough features
 that it will be possible to port some OpenGL
\family roman 
\series medium 
\shape up 
\emph off 
\bar no 
\noun off 
\latex no_latex 
\color none
®
\family default 
\series default 
\shape default 
\emph default 
\bar default 
\noun default 
\latex default 
\color default
 games, and also make it easier for homebrew developers to create new and
 original works for the Dreamcast.
 We are striving for a certain level of OpenGL
\family roman 
\series medium 
\shape up 
\emph off 
\bar no 
\noun off 
\latex no_latex 
\color none
®
\family default 
\series default 
\shape default 
\emph default 
\bar default 
\noun default 
\latex default 
\color default
 conformance but do not intend to add features that we believe are either
 incompatible with an embedded system or don't map easily to the hardware.
 At the time of this writing KGL is a Dreamcast only API.
\layout Chapter

KGL API
\layout Standard

This is not an OpenGL
\family roman 
\series medium 
\shape up 
\emph off 
\bar no 
\noun off 
\latex no_latex 
\color none
®
\family default 
\series default 
\shape default 
\emph default 
\bar default 
\noun default 
\latex default 
\color default
 tutorial or complete reference.
 Those are available online or at a bookstore.
 This section describes the KGL API currently implemented, the GL_XXX enums
 supported, and any known non-conformance issues, or DC features for each
 API function.
 The API includes non-working stubs for some functions to ease porting.
 These stubs will be clearly noted.
 If you think KGL is doing something weird or wrong please refer to this
 document to determine if the functions in question are supported.
\layout Standard

Some of the glKos functions were created to support the Direct Render method
 of sending polygons to the hardware.
 Those functions are marker with 
\begin_inset Quotes eld
\end_inset 

(DR).
\begin_inset Quotes erd
\end_inset 


\layout Section

KGL DC-specific APIs
\layout Subsection

int glKosInit()
\begin_inset LatexCommand \label{subsec:glkosinit}

\end_inset 


\layout Standard

The function to intialize KGL.
 This must be called after KOS and the PVR are intialized.
 KGL will inherit the active lists specified as parameters to pvr_init.
 Currently KGL supports the 
\emph on 
opaque
\emph default 
, 
\emph on 
transparent
\emph default 
 and 
\emph on 
punchthru
\emph default 
 polygon lists.
 Returns 0 if successful, -1 if no lists are found to be active.
\layout Standard

\begin_float alg 
\layout Caption

DC specific API exmaple
\begin_inset LatexCommand \label{code:glkosfunc}

\end_inset 


\layout Standard

pvr_init_params_t params = {
\layout LyX-Code

  /* Enable opaque, translucent and punchthru polygons with size 16 */
\layout LyX-Code

  { PVR_BINSIZE_16,
\layout LyX-Code

    PVR_BINSIZE_0,
\layout LyX-Code

    PVR_BINSIZE_16,
\layout LyX-Code

    PVR_BINSIZE_0,
\layout LyX-Code

    PVR_BINSIZE_16 },
\layout LyX-Code

  /* Vertex buffer size 512K */
\layout LyX-Code

    512*1024
\layout LyX-Code

};
\layout LyX-Code

\layout LyX-Code

extern uint8 romdisk[];
\layout LyX-Code

KOS_INIT_ROMDISK(romdisk);
\layout LyX-Code

\layout LyX-Code

int main(int argc, char **argv) {
\layout LyX-Code

...
\layout LyX-Code

    /* Initialize PVR */
\layout LyX-Code

    pvr_init(&params);
\layout LyX-Code

\layout LyX-Code

    /* Call before using KGL */
\layout LyX-Code

    glKosInit();
\layout LyX-Code

...
\layout LyX-Code

    while(foo) {
\layout LyX-Code

        ...
\layout LyX-Code

        /* Begin frame sequence         */
\layout LyX-Code

        glKosBeginFrame();
\layout LyX-Code

        draw_op(); /* opaque polys      */
\layout LyX-Code

        glKosFinishList();
\layout LyX-Code

        draw_tr(); /* transparent polys */
\layout LyX-Code

        glKosFinishList();
\layout LyX-Code

        draw_pt(); /* punchthru polys   */
\layout LyX-Code

        glKosFinishFrame();
\layout LyX-Code

        ...
\layout LyX-Code

    } /* while */
\layout LyX-Code

    ...
\layout LyX-Code

    glKosShutdown();
\layout LyX-Code

    return 0;
\layout LyX-Code

}
\end_float 
\layout Subsection

void glKosShutdown()
\layout Standard

Call after finishing with KGL.
 See code example 
\begin_inset LatexCommand \ref{code:glkosfunc}

\end_inset 

, page 
\begin_inset LatexCommand \pageref{code:glkosfunc}

\end_inset 

.
\layout Subsection

void glKosGetScreenSize(GLfloat *x, GLfloat *y)
\layout Standard

Get the current video screen size.
\layout Subsection

void glKosBeginFrame();
\layout Standard

Begin frame sequence.
 See code example 
\begin_inset LatexCommand \ref{code:glkosfunc}

\end_inset 

, page 
\begin_inset LatexCommand \pageref{code:glkosfunc}

\end_inset 

.
\layout Subsection

void glKosFinishFrame()
\layout Standard

Finish frame sequence.
 See code example 
\begin_inset LatexCommand \ref{code:glkosfunc}

\end_inset 

, page 
\begin_inset LatexCommand \pageref{code:glkosfunc}

\end_inset 

.
\layout Subsection

void glKosFinishList()
\layout Standard

Finish with the current list.
 See code example 
\begin_inset LatexCommand \ref{code:glkosfunc}

\end_inset 

, page 
\begin_inset LatexCommand \pageref{code:glkosfunc}

\end_inset 

.
 XXX - describe lists.
\layout Subsection

void glKosMatrixIdent()
\hfill 
(DR)
\layout Standard

Set the DC's matrix regs to identity.
\layout Subsection

void glKosMatrixDirty()
\hfill 
(DR)
\layout Standard

Set matrix regs as dirtied.
 You should do this if you've done any tinkering with the DC's matrix registers
 outside of using GL calls.
\layout Subsection

void glKosPolyHdrDirty()
\hfill 
(DR)
\layout Standard

Set poly header context as dirtied.
 Similar to the matrix call above, but this one is for the case where you've
 sent your own primitive headers to the DCPVR2's TA.
\layout Subsection

void glKosMatrixApply(GLenum mode)
\hfill 
(DR)
\layout Standard

Apply one of the GL matrices to the DC's matrix regs.
\newline 

\layout Standard


\begin_inset  Tabular
<lyxtabular version="2" rows="4" columns="1">
<features rotate="false" islongtable="false" endhead="0" endfirsthead="0" endfoot="0" endlastfoot="0">
<column alignment="left" valignment="top" leftline="true" rightline="true" width="" special="">
<row topline="true" bottomline="true" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

mode
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_KOS_SCREENVIEW
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_MODELVIEW
\end_inset 
</cell>
</row>
<row topline="true" bottomline="true" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_PROJECTION
\end_inset 
</cell>
</row>
</lyxtabular>

\end_inset 


\layout Subsection

void glKosSendPolyHdr()
\hfill 
(DR)
\layout Standard

This function bypasses the normal glBegin( ) / glEnd( ) paradigm and sends
 the currently 
\emph on 
defined
\emph default 
 
\emph on 
polygon header
\emph default 
 to the hardware.
 Where 
\emph on 
defined polygon header
\emph default 
 is simply the current GL states encapsulated in a 
\emph on 
pvr_poly_hdr_t
\emph default 
 structure that apply to the object about to be rendered.
 e.g.: fog, culling, blend functions, texture, current polygon list, etc.
 Your optimized drawing function is responsible for filling and sending
 the verticies (pvr_vertex_t) for the object to be rendered by the DCPVR2
 hardware.
\layout Section

Per Fragment Operations
\layout Subsection

void glBlendFunc(GLenum sfactor, GLenum dfactor)
\layout Standard

Only applies when the transparent/punchthru polygon list is active.
\newline 

\layout Standard


\begin_inset  Tabular
<lyxtabular version="2" rows="16" columns="4">
<features rotate="false" islongtable="false" endhead="0" endfirsthead="0" endfoot="0" endlastfoot="0">
<column alignment="left" valignment="top" leftline="true" rightline="false" width="" special="">
<column alignment="left" valignment="top" leftline="true" rightline="false" width="" special="">
<column alignment="left" valignment="top" leftline="true" rightline="false" width="" special="">
<column alignment="left" valignment="top" leftline="true" rightline="true" width="" special="">
<row topline="true" bottomline="true" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

Constant
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

sfactor
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

dfactor
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

Computed Blend Factor
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_ZERO
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

X
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

X
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

(0, 0, 0, 0)
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_ONE
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

X
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

X
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

(1, 1, 1, 1)
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_DST_COLOR
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

X
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

(R
\begin_inset Formula \( _{d} \)
\end_inset 

, G
\begin_inset Formula \( _{d} \)
\end_inset 

, B
\begin_inset Formula \( _{d} \)
\end_inset 

, A
\begin_inset Formula \( _{d} \)
\end_inset 

)
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_SRC_COLOR
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

X
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

(R
\begin_inset Formula \( _{s} \)
\end_inset 

, G
\begin_inset Formula \( _{s} \)
\end_inset 

, B
\begin_inset Formula \( _{s} \)
\end_inset 

, A
\begin_inset Formula \( _{s} \)
\end_inset 

)
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_ONE_MINUS_DST_COLOR
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

X
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

(1, 1, 1, 1) - (R
\begin_inset Formula \( _{d} \)
\end_inset 

, G
\begin_inset Formula \( _{d} \)
\end_inset 

, B
\begin_inset Formula \( _{d} \)
\end_inset 

, A
\begin_inset Formula \( _{d} \)
\end_inset 

)
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_ONE_MINUS_SRC_COLOR
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

X
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

(1, 1, 1, 1) - (R
\begin_inset Formula \( _{s} \)
\end_inset 

, G
\begin_inset Formula \( _{s} \)
\end_inset 

, B
\begin_inset Formula \( _{s} \)
\end_inset 

, A
\begin_inset Formula \( _{s} \)
\end_inset 

)
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_SRC_ALPHA
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

X
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

X
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

(A
\begin_inset Formula \( _{s} \)
\end_inset 

, A
\begin_inset Formula \( _{s} \)
\end_inset 

, A
\begin_inset Formula \( _{s} \)
\end_inset 

, A
\begin_inset Formula \( _{s} \)
\end_inset 

)
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_ONE_MINUS_SRC_ALPHA
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

X
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

X
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

(1, 1, 1, 1) - (A
\begin_inset Formula \( _{s} \)
\end_inset 

, A
\begin_inset Formula \( _{s} \)
\end_inset 

, A
\begin_inset Formula \( _{s} \)
\end_inset 

, A
\begin_inset Formula \( _{s} \)
\end_inset 

)
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_DST_ALPHA
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

X
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

X
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

(A
\begin_inset Formula \( _{d} \)
\end_inset 

, A
\begin_inset Formula \( _{d} \)
\end_inset 

, A
\begin_inset Formula \( _{d} \)
\end_inset 

, A
\begin_inset Formula \( _{d} \)
\end_inset 

)
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_ONE_MINUS_DST_ALPHA
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

X
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

X
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

(1, 1, 1, 1) - (A
\begin_inset Formula \( _{d} \)
\end_inset 

, A
\begin_inset Formula \( _{d} \)
\end_inset 

, A
\begin_inset Formula \( _{d} \)
\end_inset 

, A
\begin_inset Formula \( _{d} \)
\end_inset 

)
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_SRC_ALPHA_SATURATE
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

not available
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_CONSTANT_COLOR
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

not available
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_ONE_MINUS_CONSTANT_COLOR
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

not available
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_CONSTANT_ALPHA
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

not available
\end_inset 
</cell>
</row>
<row topline="true" bottomline="true" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_ONE_MINUS_CONSTANT_ALPHA
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

not available
\end_inset 
</cell>
</row>
</lyxtabular>

\end_inset 


\layout Subsection

void glClearDepth(GLclampd depth)
\layout Standard


\series bold 
NOP
\series default 
: non-functional.
 To ease porting.
\layout Subsection

void glDepthFunc(GLenum func)
\layout Standard

The DC supports a number of depth functions.
\newline 

\layout Standard


\begin_inset  Tabular
<lyxtabular version="2" rows="9" columns="1">
<features rotate="false" islongtable="false" endhead="0" endfirsthead="0" endfoot="0" endlastfoot="0">
<column alignment="left" valignment="top" leftline="true" rightline="true" width="" special="">
<row topline="true" bottomline="true" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

Supported Depth Functions
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_NEVER
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_LESS (default)
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_EQUAL
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_LEQUAL
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_GREATER
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_NOTEQUAL
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_GEQUAL
\end_inset 
</cell>
</row>
<row topline="true" bottomline="true" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_ALWAYS
\end_inset 
</cell>
</row>
</lyxtabular>

\end_inset 


\layout Subsection

void glDepthMask(GLboolean flag)
\layout Standard

Valid state is GL_TRUE or GL_FALSE.
 Default state is GL_TRUE.
 Controls blending of opaque and transparent objects.
\layout Subsection

glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
\layout Standard

The DC uses the PVR USER_CLIP functionality and does not allow fine-grain
 per-pixel control over the scissor box width, height and placement on the
 screen.
 The minimum clip rectangle is a 32x32 area which corresponds with the size
 of tiles used by the tile accelerator.
 The PVR swithes off rendering to tiles outside or inside the defined rectangle
 dependant upon the 'clipmode' bits in the polygon header.
 
\layout Standard

The specified scissor box will always have a size that is some multiple
 of 32.
 glScissor(0, 0, 32, 32) allows only the 'tile' in the lower left hand corner
 of the screen to be modified and glScissor(0, 0, 0, 0) disallows modification
 to all 'tiles' on the screen.
 Enabling GL_SCISSOR_TEST or GL_KOS_USERCLIP_OUTSIDE will cause rendered
 objects to be clipped to the inside or outside of the scissor box respectively.
\layout Section

Display lists
\layout Standard

Not available at this time.
\layout Section

Drawing functions
\layout Standard

Rasterization and per-fragment drawing functions.
\layout Subsection

void glBegin(GLenum mode)
\layout Standard

See the following table for the currently supported primatives.
 The maximum GL_TRIANGLE_STRIP length is currently limited to 64 vertices.
\newline 

\layout Standard


\begin_inset  Tabular
<lyxtabular version="2" rows="11" columns="2">
<features rotate="false" islongtable="false" endhead="0" endfirsthead="0" endfoot="0" endlastfoot="0">
<column alignment="left" valignment="top" leftline="true" rightline="false" width="" special="">
<column alignment="left" valignment="top" leftline="true" rightline="true" width="" special="">
<row topline="true" bottomline="true" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

Mode
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

Implemented
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_POINTS
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

X
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_LINES
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_LINE_LOOP
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_LINE_STRIP
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_TRIANGLES
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

X
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_TRIANGLE_STRIP
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

X
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_TRIANGLE_FAN
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_QUADS
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

X
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_QUAD_STRIP
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

\end_inset 
</cell>
</row>
<row topline="true" bottomline="true" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_POLYGON
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

\end_inset 
</cell>
</row>
</lyxtabular>

\end_inset 


\layout Subsection

void glColor3f(GLfloat red, GLfloat green, GLfloat blue)
\layout Subsection

void glColor3fv(GLfloat *v)
\layout Subsection

void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
\layout Subsection

void glColor4fv(GLfloat *v)
\layout Subsection

void glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
\layout Subsection

void glEnd(void)
\layout Subsection

void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz)
\layout Standard


\series bold 
NOP
\series default 
: Stub only.
\layout Subsection

void glPointSize(GLfloat size)
\layout Standard

GL_POINTS are emulated using quads.
 Points are therefore rendered square.
 Default size is 1.0 which is 2 pixels square on the DC.
 Maximum size is 100.0.
\layout Subsection

void glTexCoord2f(GLfloat s, GLfloat t)
\layout Subsection

void glTexCoord2fv(GLfloat *v)
\layout Subsection

void glVertex3f(GLfloat x, GLfloat y, GLfloat z)
\layout Subsection

void glVertex3fv(GLfloat *v)
\layout Section

Fog
\layout Standard

Uses the PVR2 hardware fog table.
 Care must be taken when changing fog values because there is only one fog
 table and any changes made while the PVR is rendering a scene may result
 in display artifacts.
 Most noteably if the changes made are large.
 When vertex fog is implemented this will not be an issue, however vertex
 fog will take more CPU time.
\newline 

\layout Standard


\begin_inset  Tabular
<lyxtabular version="2" rows="7" columns="3">
<features rotate="false" islongtable="false" endhead="0" endfirsthead="0" endfoot="0" endlastfoot="0">
<column alignment="left" valignment="top" leftline="true" rightline="false" width="" special="">
<column alignment="left" valignment="top" leftline="true" rightline="false" width="2.5cm" special="">
<column alignment="left" valignment="top" leftline="true" rightline="true" width="" special="">
<row topline="true" bottomline="true" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

Parameter name
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

parameter
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

default
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_FOG_MODE
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_EXP, GL_EXP2, GL_LINEAR
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_EXP
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_FOG_DENSITY
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

density >= 0.0
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

1.0
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_FOG_COLOR
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

float [4] color = {R, G, B, A}
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

{0.5, 0.5, 0.5, 1.0}
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_FOG_INDEX
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

Palletted modes not supported
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_FOG_START
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

0.0 - 259.0
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

0.0
\end_inset 
</cell>
</row>
<row topline="true" bottomline="true" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_FOG_END
\end_inset 
</cell>
<cell multicolumn="0" alignment="left" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

0.0 - 259.0
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

1.0
\end_inset 
</cell>
</row>
</lyxtabular>

\end_inset 


\layout LyX-Code

\layout Subsection

void glFogi(GLenum pname, GLint param)
\layout LyX-Code

glFogi(GL_FOG_MODE, GL_EXP2);
\layout Subsection

void glFogiv(GLenum pname, const GLint *params)
\layout Subsection

void glFogf(GLenum pname, GLfloat param)
\layout LyX-Code

glFogf(GL_FOG_DENSITY, 0.5f);
\layout Subsection

void glFogfv(GLenum pname, const GLfloat *params)
\layout LyX-Code

GLfloat fogcolor[4] = {0.5, 0.5, 0.5, 1.0};
\layout LyX-Code

glFogfv(GL_FOG_COLOR, fogcolor);
\layout Section

Lighting
\layout Standard

This is a decidedly lackluster section.
 Hopefully lighting will be supported at some point in the future.
\layout Subsection

void glShadeModel(GLenum mode)
\layout Standard

The available modes are GL_FLAT, and GL_SMOOTH.
 GL_FLAT is default.
\layout Section

Miscellaneous
\layout Subsection

void glClear(GLbitfield mask)
\layout Standard


\series bold 
NOP
\series default 
: there's nothing to clear on the PVR2.
 Provided to ease porting.
\layout Subsection

void glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf
 alpha)
\layout Standard

Sets the background color.
 Alpha parameter has no effect.
\layout Subsection

void glCullFace(GLenum mode)
\layout Standard

Set face culling mode.
 Valid states are GL_FRONT and GL_BACK.
 Default state is GL_BACK.
\layout Subsection

void glDisable(GLenum cap)
\layout Standard

Disable GL states.
 See table in section 
\begin_inset LatexCommand \ref{tab:kgl:enabledisablestates}

\end_inset 

, on page 
\begin_inset LatexCommand \pageref{tab:kgl:enabledisablestates}

\end_inset 

.
\layout Subsection

void glEnable(GLenum cap)
\layout Standard

Enable GL states.
\newline 

\layout Standard


\begin_inset  Tabular
<lyxtabular version="2" rows="8" columns="3">
<features rotate="false" islongtable="false" endhead="0" endfirsthead="0" endfoot="0" endlastfoot="0">
<column alignment="left" valignment="top" leftline="true" rightline="false" width="" special="">
<column alignment="left" valignment="top" leftline="true" rightline="true" width="6cm" special="">
<column alignment="left" valignment="top" leftline="false" rightline="true" width="3cm" special="">
<row topline="true" bottomline="true" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

State
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

Description / Notes
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

Initial Value
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_BLEND
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard


\series bold 
NOP:
\series default 
 will be available once the PVR scene rendering API is completed.
 For now use glKosFinishList() to switch to the transparent polygon list.
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_FALSE
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_CULL_FACE
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

Polygon culling
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_FALSE
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_FOG
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

PVR table fog
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_FALSE
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_KOS_AUTO_UV
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

Automatically assign texture coordinates to GL_QUAD primatives.
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_FALSE
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_KOS_USERCLIP_OUTSIDE
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

Drawn polys are clipped to the outside of the scissor box.
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_FALSE
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_SCISSIOR_TEST
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

Drawn polys are clipped to the inside of the the scissor box.
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_FALSE
\end_inset 
</cell>
</row>
<row topline="true" bottomline="true" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_TEXTURE_2D
\end_inset 
</cell>
<cell multicolumn="0" alignment="left" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

2D texturing
\end_inset 
</cell>
<cell multicolumn="0" alignment="left" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_FALSE
\end_inset 
</cell>
</row>
</lyxtabular>

\end_inset 


\begin_inset LatexCommand \label{tab:kgl:enabledisablestates}

\end_inset 


\layout Subsection

void glFrontFace(GLenum mode)
\layout Standard

Set polygon front face.
 Valid modes are GL_CW and GL_CCW.
 Default mode is GL_CCW.

\emph on 
 Note: In KGL prior to KOS-1.1.7 the default was GL_CW and could not be changed.
\layout Subsection

void glFlush()
\layout Standard


\series bold 
NOP
\series default 
: There is no rendering pipeline.
\layout Subsection

void glHint(GLenum target, GLenum mode)
\layout Standard


\series bold 
NOP
\series default 
: It's our way or no way.
 KGL_DONT_CARE\SpecialChar ~
=D Provided to ease porting.
\newline 

\layout Standard


\begin_inset  Tabular
<lyxtabular version="2" rows="6" columns="2">
<features rotate="false" islongtable="false" endhead="0" endfirsthead="0" endfoot="0" endlastfoot="0">
<column alignment="left" valignment="top" leftline="true" rightline="true" width="" special="">
<column alignment="left" valignment="top" leftline="true" rightline="true" width="" special="">
<row topline="true" bottomline="true" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

Valid target values
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

Valid modes
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_PERSPECTIVE_CORRECTION_HINT
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_DONT_CARE
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_POINT_SMOOTH_HINT
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_FASTEST
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_LINE_SMOOTH_HINT
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_NICEST
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_POLYGON_SMOOTH_HINT
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

\end_inset 
</cell>
</row>
<row topline="true" bottomline="true" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_FOG_HINT
\begin_inset Info
We may one day use this to toggle between
PVR table and vertex fog modes. Once we
figure out how vertex fog works that is!
\end_inset 


\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

\end_inset 
</cell>
</row>
</lyxtabular>

\end_inset 


\layout Section

Query functions
\layout Subsection

const GLubyte *glGetString(GLenum name)
\layout Standard

Returns a pointer to a descriptive string.
\newline 

\layout Standard


\begin_inset  Tabular
<lyxtabular version="2" rows="5" columns="1">
<features rotate="false" islongtable="false" endhead="0" endfirsthead="0" endfoot="0" endlastfoot="0">
<column alignment="left" valignment="top" leftline="true" rightline="true" width="" special="">
<row topline="true" bottomline="true" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

String name
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_VENDOR
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_RENDERER
\end_inset 
</cell>
</row>
<row topline="true" bottomline="true" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_VERSION
\end_inset 
</cell>
</row>
<row topline="true" bottomline="true" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_EXTENSIONS
\end_inset 
</cell>
</row>
</lyxtabular>

\end_inset 


\layout Section

Texture functions
\layout Standard

Allowable texture size height and width in pixels are 8, 16, 32, 64, 128,
 256, 512, and 1024.
 You can load a texture using any combination of the previous values.
 Only 2D textures are supported.
 Textures are loaded upside down in keeping with the sprit of OpenGL.
 Be aware of this when mixing KGL and the PVR API.
 You may have to flip the V texture coordinates (V = 1 - V) depending upon
 your application.
\layout Subsection

void glBindTexture(GLenum target, GLuint texture)
\layout Standard

The only supported target is GL_TEXTURE_2D.
\layout Subsection

void glDeleteTextures(GLsizei n, const GLuint *textures)
\layout Subsection

void glGenTextures(GLsizei n, GLuint *textures)
\layout Subsection

void glKosTex2D(GLint internal_fmt, GLsizei width, GLsizei height, pvr_ptr_t
 txr_address, )
\layout Standard

If you have already allocated and loaded a texture you can use this shortcut
 function to make it available to KGL.
 The 
\emph on 
internal_fmt
\emph default 
 varies from from the OpenGL spec.
 The table shows the internal formats supported by the PVR2.
\newline 

\layout Standard


\begin_inset  Tabular
<lyxtabular version="2" rows="11" columns="1">
<features rotate="false" islongtable="false" endhead="0" endfirsthead="0" endfoot="0" endlastfoot="0">
<column alignment="left" valignment="top" leftline="true" rightline="true" width="" special="">
<row topline="true" bottomline="true" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

internal_fmt
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_ARGB1555
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_RGB565
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_ARGB4444
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_YUV422
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_BUMP
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_ARGB1555_TWID
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_RGB565_TWID
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_ARGB4444_TWID
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_YUV422_TWID
\end_inset 
</cell>
</row>
<row topline="true" bottomline="true" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_BUMP_TWID
\end_inset 
</cell>
</row>
</lyxtabular>

\end_inset 


\begin_inset LatexCommand \label{tbl:kgl:internaltextureformat}

\end_inset 


\layout Subsection

void glTexEnvi(GLenum target, GLenum pname, GLint param)
\layout Standard

Setup the texture environment.
 See the following table for valid arguments to this function.
\newline 

\layout Standard


\begin_inset  Tabular
<lyxtabular version="2" rows="5" columns="3">
<features rotate="false" islongtable="false" endhead="0" endfirsthead="0" endfoot="0" endlastfoot="0">
<column alignment="left" valignment="top" leftline="true" rightline="false" width="" special="">
<column alignment="left" valignment="top" leftline="true" rightline="false" width="" special="">
<column alignment="left" valignment="top" leftline="true" rightline="true" width="" special="">
<row topline="true" bottomline="true" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

target
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

pname
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

param
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_TEXTURE_2D
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_TEXTURE_ENV_MODE
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_REPLACE
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_MODULATE (default)
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_DECAL
\end_inset 
</cell>
</row>
<row topline="true" bottomline="true" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_MODULATEALPHA
\end_inset 
</cell>
</row>
</lyxtabular>

\end_inset 


\layout Subsection

void glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei
 width, GLsizei height, GLint border, GLenum format, GLenum type, const
 GLvoid *pixels)
\layout Standard

Defines a two-dimensional texture.
 The only supported 
\emph on 
target
\emph default 
 is GL_TEXTURE_2D.
 
\emph on 
Border
\emph default 
, 
\emph on 
level
\emph default 
, and pixel conversion (
\emph on 
type
\emph default 
) are not supported.
 The 
\emph on 
internalFormat
\emph default 
 and 
\emph on 
format
\emph default 
 arguments must be the same.
 See the table in section 
\begin_inset LatexCommand \ref{tbl:kgl:internaltextureformat}

\end_inset 

, on page 
\begin_inset LatexCommand \pageref{tbl:kgl:internaltextureformat}

\end_inset 

.
\layout Subsection

void glTexParameteri(GLenum target, GLenum pname, GLint param)
\layout Standard

Allows specification of additional texture attributes.
\newline 

\layout Standard


\begin_inset  Tabular
<lyxtabular version="2" rows="4" columns="3">
<features rotate="false" islongtable="false" endhead="0" endfirsthead="0" endfoot="0" endlastfoot="0">
<column alignment="left" valignment="top" leftline="true" rightline="false" width="" special="">
<column alignment="left" valignment="top" leftline="true" rightline="false" width="" special="">
<column alignment="left" valignment="top" leftline="true" rightline="true" width="" special="">
<row topline="true" bottomline="true" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

target
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

pname
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

param
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_TEXTURE_2D
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_TEXTURE_FILTER
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard


\begin_inset  Tabular
<lyxtabular version="2" rows="2" columns="1">
<features rotate="false" islongtable="false" endhead="0" endfirsthead="0" endfoot="0" endlastfoot="0">
<column alignment="left" valignment="top" leftline="false" rightline="false" width="" special="">
<row topline="false" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_FILTER_NONE (default)
\end_inset 
</cell>
</row>
<row topline="false" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_FILTER_BILINEAR
\end_inset 
</cell>
</row>
</lyxtabular>

\end_inset 


\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_TEXTURE_WRAP_S
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard


\begin_inset  Tabular
<lyxtabular version="2" rows="2" columns="1">
<features rotate="false" islongtable="false" endhead="0" endfirsthead="0" endfoot="0" endlastfoot="0">
<column alignment="left" valignment="top" leftline="false" rightline="false" width="" special="">
<row topline="false" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_REPEAT (default)
\end_inset 
</cell>
</row>
<row topline="false" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_CLAMP
\end_inset 
</cell>
</row>
</lyxtabular>

\end_inset 


\end_inset 
</cell>
</row>
<row topline="true" bottomline="true" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_TEXTURE_WRAP_T
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard


\begin_inset  Tabular
<lyxtabular version="2" rows="2" columns="1">
<features rotate="false" islongtable="false" endhead="0" endfirsthead="0" endfoot="0" endlastfoot="0">
<column alignment="left" valignment="top" leftline="false" rightline="false" width="" special="">
<row topline="false" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_REPEAT (default)
\end_inset 
</cell>
</row>
<row topline="false" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_CLAMP
\end_inset 
</cell>
</row>
</lyxtabular>

\end_inset 


\end_inset 
</cell>
</row>
</lyxtabular>

\end_inset 


\layout Section

Transformation functions
\layout Subsection

void glDepthRange(GLclampf n, GLclampf f)
\layout Standard

We can't access the PVR's depth buffer directly, but the values are used
 during viewport transformation.
\layout Subsection

void glFrustum(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top,
 GLfloat znear, GLfloat zfar)
\layout Subsection

void glLoadIdentity(void)
\layout Subsection

void glLoadMatrixf(const GLfloat *m)
\layout Standard

Load an arbitrary matrix into the current matrix.
\layout Subsection

void glLoadTransposeMatrixf(const GLfloat *m)
\layout Subsection

void glMatrixMode(GLenum mode)
\layout Standard


\begin_inset  Tabular
<lyxtabular version="2" rows="4" columns="2">
<features rotate="false" islongtable="false" endhead="0" endfirsthead="0" endfoot="0" endlastfoot="0">
<column alignment="left" valignment="top" leftline="true" rightline="false" width="" special="">
<column alignment="center" valignment="top" leftline="true" rightline="true" width="" special="">
<row topline="true" bottomline="true" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

Stack mode
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

Stack size
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_MODELVIEW
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

32
\end_inset 
</cell>
</row>
<row topline="true" bottomline="false" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_PROJECTION
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

2
\end_inset 
</cell>
</row>
<row topline="true" bottomline="true" newpage="false">
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

GL_TEXTURE
\end_inset 
</cell>
<cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special="">
\begin_inset Text

\layout Standard

2
\end_inset 
</cell>
</row>
</lyxtabular>

\end_inset 


\layout Subsection

void glMultMatrixf(const GLfloat *m)
\layout Standard

Mulitply the current matrix by an arbitrary matrix.
\layout Subsection

void glMultTransposeMatrixf(const GLfloat *m)
\layout Subsection

void glOrtho(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat
 znear, GLfloat zfar)
\layout Subsection

void glPopMatrix(void)
\layout Subsection

void glPushMatrix(void)
\layout Subsection

void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
\layout Standard

As of KOS-1.1.7 the 
\emph on 
angle
\emph default 
 is in degrees.
 In prior versions the 
\emph on 
angle
\emph default 
 was expressed in radians.
\layout Subsection

void glScalef(GLfloat x, GLfloat y, GLfloat z)
\layout Subsection

void glTranslatef(GLfloat x, GLfloat y, GLfloat z)
\layout Subsection

void glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
\layout Standard

The default values are automatically set during glKosInit( ) and are determined
 by the current video mode.
 You can of course choose your own values and KGL will render to the defined
 rectangle.
 The defined area will not be clipped.
 To clip the defined rectangle you will need to use glScissors( ).
\layout Subsection

void gluLookAt(GLfloat eyex, GLfloat eyey, GLfloat eyez, GLfloat centerx,
 GLfloat centery, GLfloat centerz, GLfloat upx, GLfloat upy, GLfloat upz)
\layout Subsection

void gluPerspective(GLfloat fovy, GLfloat aspect, GLfloat zNear, GLfloat
 zFar)
\layout Chapter

Direct Render
\layout Standard

When standard KGL just isn't fast enough for your needs it's time to summon
 the forces of Direct Render.
 Direct Render, from this point forward referred to as DR, lets you mix
 the convenience features of KGL with a number of macros and glKOS functions.
 When used properly you can expect get 3 to 4 times more polys per frame
 than KGL alone.
\layout Standard

The peformace impact of DR methods are so great that the techniques have
 been applied to the core KGL drawing functions for a nice performance boost.
 Some benchmarks taken before and after the conversion are posted below.
 GL_TRIANGLES were used since they are easy to draw and are the least efficient
 way draw objects, so any improvements in terms of polygons per second (pps)
 are pretty impressive.
 The raw PVR benckmarks are even more impressive.
\layout Quotation

KGL GL_TRIANGLES (trimark): Before conversion to DR
\newline 
Beginning new test: 1013 polys per frame (60780 per second at 60fps)
\newline 
Average Frame Rate: ~59.356900 fps (60128 pps)
\newline 
Entering PHASE_FINAL
\newline 
Average Frame Rate: ~60.924400 fps (61716 pps)
\newline 
Average Frame Rate: ~59.356900 fps (60128 pps)
\newline 
Average Frame Rate: ~61.187100 fps (61982 pps)
\newline 
Average Frame Rate: ~59.875900 fps (60654 pps)
\newline 
Average Frame Rate: ~61.186900 fps (61982 pps)
\newline 

\layout Quotation

KGL GL_TRIANGLES (trimark): After conversion to DR
\newline 
Beginning new test: 3125 polys per frame (187500 per second at 60fps)
\newline 
Average Frame Rate: ~59.873900 fps (187106 pps)
\newline 
Entering PHASE_FINAL
\newline 
Average Frame Rate: ~60.928600 fps (190401 pps)
\newline 
Average Frame Rate: ~60.924800 fps (190390 pps)
\newline 
Average Frame Rate: ~59.349700 fps (185468 pps)
\newline 
Average Frame Rate: ~59.995800 fps (187487 pps)
\newline 
Average Frame Rate: ~59.875900 fps (187112 pps)
\layout Standard

The raw PVR benchmarks for triangles are even more impressive.
 These benchmarks are from the pvrmark and pvrmark_strip test programs.
\layout Quote

PVR pvrmark test:
\newline 
Beginning new test: 6466 polys per frame (387960 per second at 60fps)
\newline 
Average Frame Rate: ~59.890300 fps (387251 pps)
\newline 
Entering PHASE_FINAL
\newline 
Average Frame Rate: ~61.187100 fps (395635 pps)
\newline 
Average Frame Rate: ~59.875900 fps (387158 pps)
\newline 
Average Frame Rate: ~59.873900 fps (387145 pps)
\newline 
Average Frame Rate: ~60.927500 fps (393957 pps)
\newline 
Average Frame Rate: ~59.414400 fps (384173 pps)
\layout Standard

The DCPVR2 can draw long triangles strips even more efficiently.
\layout Quote

PVR pvrmark_strips test:
\newline 
Beginning new test: 12433 polys per frame (745980 per second at 60fps)
\newline 
Average Frame Rate: ~57.953400 fps (720535 pps)
\newline 
Entering PHASE_FINAL
\newline 
Average Frame Rate: ~55.270300 fps (687176 pps)
\newline 
Average Frame Rate: ~59.290100 fps (737154 pps)
\newline 
Average Frame Rate: ~59.004700 fps (733606 pps)
\newline 
Average Frame Rate: ~60.719300 fps (754923 pps)
\newline 
Average Frame Rate: ~58.388400 fps (725943 pps)
\layout Standard

You're probably sick of benchmarks but I have to show you the results of
 the pure PVR API in action.
 This is the output of the pvrmark_strips_direct program:
\layout Quote

PVR pvrmark_strips_direct test:
\newline 
Beginning new test: 40233 polys per frame (2413980 per second at 60fps)
\newline 
Average Frame Rate: ~59.414300 fps (2390419 pps)
\newline 
Entering PHASE_FINAL
\newline 
Average Frame Rate: ~60.924800 fps (2451190 pps
\newline 
Average Frame Rate: ~59.414300 fps (2390419 pps)
\newline 
Average Frame Rate: ~59.348800 fps (2387782 pps)
\newline 
Average Frame Rate: ~59.890300 fps (2409568 pps)
\newline 
Average Frame Rate: ~59.348800 fps (2387782 pps)
\layout Standard

These PVR benchmark test programs were used in the development of the Direct
 Render methods, macros, and glKos functions described in this chapter.
 We owe this all the Dan Potters' desire to put 6 transparent spheres on
 the screen at once.
 DR can do far more then that.
 In the words of the wizard himself in response to a question about the
 GL_TRIANGLE benchmarks:
\layout Quotation

1) Every extra amount of time that you spend transmitting polygons to the
 TA for rendering is less time you have available for doing things like
 playing background music, updating AI, etc.
 So the faster we can make this, the better.
 That's why I started the whole DR thing anyway -- I could have made my
 graphics stuff fast enough without it, but wouldn't have had any time left
 over for anything else.
 Plus if you have extra polys left over then you can go about improving
 the visual quality of the effects.
\newline 

\layout Quotation

2) It's a lot easier to rack up tons of polygons than you might think.
 For example, if you have a spaceship with 100 quads in it (not very many,
 let me tell you! =) and you have 10 of them on screen, that's about a fifth
 of the available time there if you did nothing else.
\layout Section

Direct Render sample code
\layout Standard

Rather than enumerate all the DR macros and functions right away we'll toss
 out a couple pieces of sample code so you can see the differences between
 plain old KGL and KGL using DR.
 Note these are not complete functional programs, for those I strongly urge
 you to review the 
\emph on 
bubbles demo
\emph default 
 under the Dreamcast KGL examples.
\layout Standard

XXX KGL sphere quads
\layout Standard

XXX KGL/DR sphere DR
\layout Section

Direct Render API
\layout Standard

XXX stuff from matrix.h, pvr.h, gl.h XXX
\layout Chapter

About this document
\layout Standard

This document was written in a stock LyX 1.1.6fix4 distribution, using no
 fancy add-ons (so it ought to load ok for you if you want to try it).
 The PostScript, PDF, HTML, and text versions were generated using the export
 options in LyX.
\the_end
