2 * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
3 * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice including the dates of first publication and
13 * either this permission notice or a reference to
14 * http://oss.sgi.com/projects/FreeB/
15 * shall be included in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
22 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 * Except as contained in this notice, the name of Silicon Graphics, Inc.
26 * shall not be used in advertising or otherwise to promote the sale, use or
27 * other dealings in this Software without prior written authorization from
28 * Silicon Graphics, Inc.
36 #ifndef __gluglrenderer_h_
37 #define __gluglrenderer_h_
41 #include "nurbstess.h"
42 #include "glsurfeval.h"
43 #include "glcurveval.h"
46 typedef void (APIENTRY
*errorCallbackType
)( GLenum
);
49 class GLUnurbs
: public NurbsTessellator
{
53 void loadGLMatrices( void );
54 void useGLMatrices( const GLfloat modelMatrix
[16],
55 const GLfloat projMatrix
[16],
56 const GLint viewport
[4] );
57 void setSamplingMatrixIdentity( void );
59 void errorHandler( int );
60 void bgnrender( void );
61 void endrender( void );
62 void setautoloadmode( INREAL value
)
65 if (value
) autoloadmode
= GL_TRUE
;
66 else autoloadmode
= GL_FALSE
;
69 GLboolean
getautoloadmode( void ) { return autoloadmode
; }
71 errorCallbackType errorCallback
;
72 void postError( int which
)
73 { if (errorCallback
) (errorCallback
)( (GLenum
)which
); }
75 void putSurfCallBack(GLenum which
, void (GLAPIENTRY
*fn
)() )
77 void putSurfCallBack(GLenum which
, _GLUfuncptr fn
)
80 curveEvaluator
.putCallBack(which
, fn
);
81 surfaceEvaluator
.putCallBack(which
, fn
);
84 int get_vertices_call_back()
86 return surfaceEvaluator
.get_vertices_call_back();
89 void put_vertices_call_back(int flag
)
91 surfaceEvaluator
.put_vertices_call_back(flag
);
94 int get_callback_auto_normal()
96 return surfaceEvaluator
.get_callback_auto_normal();
99 void put_callback_auto_normal(int flag
)
101 surfaceEvaluator
.put_callback_auto_normal(flag
);
104 void setNurbsCallbackData(void* userData
)
106 curveEvaluator
.set_callback_userData(userData
);
107 surfaceEvaluator
.set_callback_userData(userData
);
112 void LOD_eval_list(int level
)
114 surfaceEvaluator
.LOD_eval_list(level
);
122 void put_callbackFlag(int flag
)
125 surfaceEvaluator
.put_vertices_call_back(flag
);
126 curveEvaluator
.put_vertices_call_back(flag
);
130 GLboolean autoloadmode
;
131 OpenGLSurfaceEvaluator surfaceEvaluator
;
132 OpenGLCurveEvaluator curveEvaluator
;
134 void loadSamplingMatrix( const GLfloat vmat
[4][4],
135 const GLint viewport
[4] );
136 void loadCullingMatrix( GLfloat vmat
[4][4] );
137 static void grabGLMatrix( GLfloat vmat
[4][4] );
138 static void transform4d( GLfloat A
[4], GLfloat B
[4],
140 static void multmatrix4d( GLfloat n
[4][4], const GLfloat left
[4][4],
141 const GLfloat right
[4][4] );
146 #endif /* __gluglrenderer_h_ */