本文整理汇总了C++中GLMatrix::getMatrix方法的典型用法代码示例。如果您正苦于以下问题:C++ GLMatrix::getMatrix方法的具体用法?C++ GLMatrix::getMatrix怎么用?C++ GLMatrix::getMatrix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLMatrix
的用法示例。
在下文中一共展示了GLMatrix::getMatrix方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fabs
void
GLScreen::glEnableOutputClipping (const GLMatrix &transform,
const CompRegion ®ion,
CompOutput *output)
{
WRAPABLE_HND_FUNCTN (glEnableOutputClipping, transform, region, output)
// Bottom-left corner of the output:
const GLint x = output->x1 ();
const GLint y = screen->height () - output->y2 ();
const GLsizei w = output->width ();
const GLsizei h = output->height ();
// Transformed (only scale and translation is supported!)
const float *t = transform.getMatrix ();
const GLfloat scalex = t[0], scaley = t[5], transx = t[12], transy = t[13];
const GLfloat centrex = x + w / 2.0f;
const GLfloat centrey = y + h / 2.0f;
GLfloat scaledw = fabs (w * scalex);
GLfloat scaledh = fabs (h * scaley);
GLfloat tx = centrex - (scaledw / 2.0f) + transx * w;
GLfloat ty = centrey - (scaledh / 2.0f) + transy * h;
glScissor (tx, ty, roundf (scaledw), roundf (scaledh));
glEnable (GL_SCISSOR_TEST);
}
示例2: setUniform
bool GLProgram::setUniform (const char *name, const GLMatrix &value)
{
GLint location = (*GL::getUniformLocation) (priv->program, name);
if (location == -1)
return false;
(*GL::uniformMatrix4fv) (location, 1, GL_FALSE, value.getMatrix ());
return true;
}
示例3: optionGetIntensity
bool
ShowrepaintScreen::glPaintOutput (const GLScreenPaintAttrib &attrib,
const GLMatrix &transform,
const CompRegion ®ion,
CompOutput *output,
unsigned int mask)
{
bool status;
GLMatrix sTransform; // initially identity matrix
unsigned short color[4];
status = gScreen->glPaintOutput (attrib, transform, region, output, mask);
tmpRegion = region.intersected (*output);
if (tmpRegion.isEmpty ())
return status;
sTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA);
color[3] = optionGetIntensity () * 0xffff / 100;
color[0] = (rand () & 7) * color[3] / 8;
color[1] = (rand () & 7) * color[3] / 8;
color[2] = (rand () & 7) * color[3] / 8;
glColor4usv (color);
glPushMatrix ();
glLoadMatrixf (sTransform.getMatrix ());
glEnable (GL_BLEND);
glBegin (GL_QUADS);
foreach (const CompRect &box, tmpRegion.rects ())
{
glVertex2i (box.x1 (), box.y1 ());
glVertex2i (box.x1 (), box.y2 ());
glVertex2i (box.x2 (), box.y2 ());
glVertex2i (box.x2 (), box.y1 ());
}
glEnd ();
glDisable (GL_BLEND);
glPopMatrix();
glColor4usv (defaultColor);
return status;
}
示例4: anything
// transformIsSimple tells you if it's simple enough to use scissoring
static bool
transformIsSimple (const GLMatrix &transform)
{
const float *t = transform.getMatrix ();
return // t[0] can be anything (x scale)
t[1] == 0.0f &&
t[2] == 0.0f &&
t[3] == 0.0f &&
t[4] == 0.0f &&
// t[5] can be anything (y scale)
t[6] == 0.0f &&
t[7] == 0.0f &&
t[8] == 0.0f &&
t[9] == 0.0f &&
// t[10] can be anything (z scale)
t[11] == 0.0f &&
// t[12]..t[14] can be anything (translation)
t[15] == 1.0f;
}
示例5: cubePaintInside
void GearsScreen::cubePaintInside (const GLScreenPaintAttrib &sAttrib,
const GLMatrix &transform,
CompOutput *output,
int size,
const GLVector &normal)
{
// CUBE_SCREEN (screen);
static GLfloat white[4] = { 1.0, 1.0, 1.0, 1.0 };
GLScreenPaintAttrib sA = sAttrib;
sA.yRotate += csScreen->invert () * (360.0f / size) *
(csScreen->xRotations () - (screen->vp ().x () * csScreen->nOutput ()));
//CompTransform mT = *transform;
GLMatrix mT = transform;
gScreen->glApplyTransform (sA, output, &mT);
// (*s->applyScreenTransform) (s, &sA, output, &mT);
glPushMatrix();
glLoadMatrixf (mT.getMatrix ());
glTranslatef (csScreen->outputXOffset (), -csScreen->outputYOffset (), 0.0f);
glScalef (csScreen->outputXScale (), csScreen->outputYScale (), 1.0f);
bool enabledCull = false;
glPushAttrib (GL_COLOR_BUFFER_BIT | GL_TEXTURE_BIT);
glDisable (GL_BLEND);
if (!glIsEnabled (GL_CULL_FACE) )
{
enabledCull = true;
glEnable (GL_CULL_FACE);
}
glPushMatrix();
glRotatef (contentRotation, 0.0, 1.0, 0.0);
glScalef (0.05, 0.05, 0.05);
glColor4usv (defaultColor);
glEnable (GL_NORMALIZE);
glEnable (GL_LIGHTING);
glEnable (GL_LIGHT1);
glDisable (GL_COLOR_MATERIAL);
glEnable (GL_DEPTH_TEST);
glDepthMask (GL_TRUE);
glDepthFunc (GL_LESS);
glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glPushMatrix();
glTranslatef (-3.0, -2.0, 0.0);
glRotatef (angle, 0.0, 0.0, 1.0);
glCallList (gear1);
glPopMatrix();
glPushMatrix();
glTranslatef (3.1, -2.0, 0.0);
glRotatef (-2.0 * angle - 9.0, 0.0, 0.0, 1.0);
glCallList (gear2);
glPopMatrix();
glPushMatrix();
glTranslatef (-3.1, 4.2, 0.0);
glRotatef (-2.0 * angle - 25.0, 0.0, 0.0, 1.0);
glCallList (gear3);
glPopMatrix();
glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, white);
glPopMatrix();
glDisable (GL_LIGHT1);
glDisable (GL_NORMALIZE);
glEnable (GL_COLOR_MATERIAL);
if (!gScreen->lighting ())
glDisable (GL_LIGHTING);
glDisable (GL_DEPTH_TEST);
if (enabledCull)
glDisable (GL_CULL_FACE);
glPopMatrix();
glPopAttrib();
damage = true;
csScreen->cubePaintInside (sAttrib, transform, output, size, normal);
}