示例#1
0
/** \ingroup transform
 *  This command produces a general scaling along the \b x and \b y
 *  axes, that is, it assigns the value [a b c d] to the floating point
 *  vector variable \b GLC_BITMAP_MATRIX, where \n
 *  \f$ \left [ \begin {array}{ll} a & b \\ c & d \\ \end {array} \right ]
 *      = \left [ \begin {array}{ll} GLC\_BITMAP\_MATRIX[0] & GLC\_BITMAP\_MATRIX[2]
 *		  \\ GLC\_BITMAP\_MATRIX[1] & GLC\_BITMAP\_MATRIX[3] \\ \end{array}
 *	  \right ]
 *	  \left [ \begin {array}{ll} inX & 0 \\
 *		  0 & inY \\ \end{array} \right ]
 *  \f$
 *  \param inX The scale factor along the \b x axis
 *  \param inY The scale factor along the \b y axis
 *  \sa glcGetfv() with argument \b GLC_BITMAP_MATRIX
 *  \sa glcLoadIdentity()
 *  \sa glcLoadMatrix()
 *  \sa glcMultMatrix()
 *  \sa glcRotate()
 */
void APIENTRY glcScale(GLfloat inX, GLfloat inY)
{
  GLfloat tempMatrix[4];

  tempMatrix[0] = inX;
  tempMatrix[1] = 0.;
  tempMatrix[2] = 0.;
  tempMatrix[3] = inY;

  glcMultMatrix(tempMatrix);
}
示例#2
0
/** \ingroup transform
 *  This command assigns the value [a b c d] to the floating point vector
 *  variable \b GLC_BITMAP_MATRIX, where \e inAngle is measured in degrees,
 *  \f$ \theta = inAngle * \pi / 180 \f$ and \n
 *  \f$ \left [ \begin {array}{ll} a & b \\ c & d \\ \end {array} \right ]
 *      = \left [ \begin {array}{ll} GLC\_BITMAP\_MATRIX[0] & GLC\_BITMAP\_MATRIX[2]
 *		  \\ GLC\_BITMAP\_MATRIX[1] & GLC\_BITMAP\_MATRIX[3] \\ \end{array}
 *	  \right ]
 *	  \left [ \begin {array}{ll} cos \theta & sin \theta \\
 *		  -sin \theta & cos\theta \\ \end{array} \right ]
 *  \f$
 *  \param inAngle The angle of rotation around the Z axis, in degrees.
 *  \sa glcGetfv() with argument \b GLC_BITMAP_MATRIX
 *  \sa glcLoadIdentity()
 *  \sa glcLoadMatrix()
 *  \sa glcMultMatrix()
 *  \sa glcScale()
 */
void APIENTRY glcRotate(GLfloat inAngle)
{
  GLfloat tempMatrix[4];
  GLfloat radian = inAngle * GLC_PI / 180.;
  GLfloat sine = sin(radian);
  GLfloat cosine = cos(radian);

  tempMatrix[0] = cosine;
  tempMatrix[1] = sine;
  tempMatrix[2] = -sine;
  tempMatrix[3] = cosine;

  glcMultMatrix(tempMatrix);
}
示例#3
0
文件: glc.c 项目: cout/mglc
/* Rotate the bitmap matrix by angle, which is in degrees.  We must be careful
 * that no change in scale occurs, as a change in scale decreases speed.
 */
void glcRotate(GLfloat angle) {
	GLfloat m[4];
	GLboolean t;
	if(currentGlcContext == 0) {
		last_error = GLC_STATE_ERROR;
		return;
	}
	m[0] = cos(2*M_PI*angle/360.0);
	m[1] = sin(2*M_PI*angle/360.0);
	m[2] = -m[1];
	m[3] = m[0];
	t = g->scale_change;
	glcMultMatrix(m);
	g->reload_font = TRUE;
	g->scale_change = t;
}
示例#4
0
文件: glc.c 项目: cout/mglc
/* Scale the bitmap matrix by x and y and reload the current font when it is
 * next rendered.
 */
void glcScale(GLfloat x, GLfloat y) {
	GLfloat m[4];
	if(currentGlcContext == 0) {
		last_error = GLC_STATE_ERROR;
		return;
	}
	/* the GLC spec says [x 1 1 y], but that can't be right? */
	m[0] = x;
	m[1] = 0;
	m[2] = 0;
	m[3] = y;
	glcMultMatrix(m);
	g->reload_font = TRUE;
	g->scale_change = TRUE;
	g->bitmap_scale[0] *= x;
	g->bitmap_scale[1] *= y;
}
示例#5
0
void GLC_Context::glcOrtho(double left, double right, double bottom, double top, double nearVal, double farVal)
{
	GLC_Matrix4x4 orthoMatrix;
	double* m= orthoMatrix.setData();

	const double tx= - (right + left) / (right - left);
	const double ty= - (top + bottom) / (top - bottom);
	const double tz= - (farVal + nearVal) / (farVal - nearVal);
	m[0]= 2.0 / (right - left);
	m[5]= 2.0 / (top - bottom);
	m[10]= -2.0 / (farVal - nearVal);
	m[12]= tx;
	m[13]= ty;
	m[14]= tz;

	glcMultMatrix(orthoMatrix);
}
示例#6
0
void GLC_Context::glcFrustum(double left, double right, double bottom, double top, double nearVal, double farVal)
{
	GLC_Matrix4x4 perspMatrix;
	double* m= perspMatrix.setData();

	const double a= (right + left) / (right - left);
	const double b= (top + bottom) / (top - bottom);
	const double c= - (farVal + nearVal) / (farVal - nearVal);
	const double d= - (2.0 * farVal * nearVal) / (farVal - nearVal);

	m[0]= (2.0 * nearVal) / (right - left);
	m[5]= (2.0 * nearVal) / (top - bottom);
	m[8]= a;
	m[9]= b;
	m[10]= c;
	m[11]= -1.0;
	m[14]= d;
	m[15]= 0.0;

	glcMultMatrix(perspMatrix);
}
示例#7
0
void GLC_Context::glcScaled(double x, double y, double z)
{
	GLC_Matrix4x4 scale;
	scale.setMatScaling(x, y, z);
	glcMultMatrix(scale);
}
void GLC_ContextSharedData::glcFrustum(double left, double right, double bottom, double top, double nearVal, double farVal)
{
    GLC_Matrix4x4 perspMatrix(GLC_Matrix4x4::frustumMatrix(left, right, bottom, top, nearVal, farVal));

    glcMultMatrix(perspMatrix);
}
void GLC_ContextSharedData::glcOrtho(double left, double right, double bottom, double top, double nearVal, double farVal)
{
    const GLC_Matrix4x4 orthoMatrix(GLC_Matrix4x4::orthonormalMatrix(left, right, bottom, top, nearVal, farVal));

    glcMultMatrix(orthoMatrix);
}