Beispiel #1
0
void GeomRenderer::sendColor(GLuint colorIndex)
{
    assert(colorData.size == 3 || colorData.size == 4);

    switch(colorData.type)
    {
        case GL_BYTE:
            if (colorData.size == 3) glColor3bv((const GLbyte*)((const char*)colorData.pointer + colorIndex*colorData.stride));
            if (colorData.size == 4) glColor4bv((const GLbyte*)((const char*)colorData.pointer + colorIndex*colorData.stride));
            break;

        case GL_UNSIGNED_BYTE:
            if (colorData.size == 3) glColor3ubv((const GLubyte*)((const char*)colorData.pointer + colorIndex*colorData.stride));
            if (colorData.size == 4) glColor4ubv((const GLubyte*)((const char*)colorData.pointer + colorIndex*colorData.stride));
            break;

        case GL_SHORT:
            if (colorData.size == 3) glColor3sv((const GLshort*)((const char*)colorData.pointer + colorIndex*colorData.stride));
            if (colorData.size == 4) glColor4sv((const GLshort*)((const char*)colorData.pointer + colorIndex*colorData.stride));
            break;

        case GL_UNSIGNED_SHORT:
            if (colorData.size == 3) glColor3usv((const GLushort*)((const char*)colorData.pointer + colorIndex*colorData.stride));
            if (colorData.size == 4) glColor4usv((const GLushort*)((const char*)colorData.pointer + colorIndex*colorData.stride));
            break;

        case GL_INT:
            if (colorData.size == 3) glColor3iv((const GLint*)((const char*)colorData.pointer + colorIndex*colorData.stride));
            if (colorData.size == 4) glColor4iv((const GLint*)((const char*)colorData.pointer + colorIndex*colorData.stride));
            break;

        case GL_UNSIGNED_INT:
            if (colorData.size == 3) glColor3uiv((const GLuint*)((const char*)colorData.pointer + colorIndex*colorData.stride));
            if (colorData.size == 4) glColor4uiv((const GLuint*)((const char*)colorData.pointer + colorIndex*colorData.stride));
            break;

        case GL_FLOAT:
            if (colorData.size == 3) glColor3fv((const GLfloat*)((const char*)colorData.pointer + colorIndex*colorData.stride));
            if (colorData.size == 4) glColor4fv((const GLfloat*)((const char*)colorData.pointer + colorIndex*colorData.stride));
            break;

        case GL_DOUBLE:
            if (colorData.size == 3) glColor3dv((const GLdouble*)((const char*)colorData.pointer + colorIndex*colorData.stride));
            if (colorData.size == 4) glColor4dv((const GLdouble*)((const char*)colorData.pointer + colorIndex*colorData.stride));
            break;
    }
}
static Bool
tilePaintOutput (CompScreen              *s,
		 const ScreenPaintAttrib *sa,
		 const CompTransform	 *transform,
		 Region                  region,
		 CompOutput              *output,
		 unsigned int            mask)
{
    Bool status;

    TILE_SCREEN (s);

    if (ts->grabIndex)
	mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK;

    UNWRAP (ts, s, paintOutput);
    status = (*s->paintOutput) (s, sa, transform, region, output, mask);
    WRAP (ts, s, paintOutput, tilePaintOutput);

    /* Check if animation is enabled, there is resizing
       on screen and only outline should be drawn */

    if (ts->grabIndex && (output->id == ~0) &&
	(tileGetAnimateType (s->display) == AnimateTypeFilledOutline))
    {
	CompWindow    *w;
	CompTransform sTransform = *transform;
	float         animationDuration = tileGetAnimationDuration (s->display);
	int           x, y, width, height;

	transformToScreenSpace (s, output, -DEFAULT_Z_CAMERA, &sTransform);
	glPushMatrix ();
	glLoadMatrixf (sTransform.m);

	glLineWidth (4.0f);

	for (w = s->windows; w; w = w->next)
	{
	    TILE_WINDOW (w);

	    if (tw->animationType == Animating)
	    {
		/* Coordinate = start +            speed          * elapsedTime
		   Coordinate = start + (target - start)/interval * elapsedTime
		   Draw outline */

		x      = tw->prevCoords.x - w->input.left +
		         (((float)(w->attrib.x - tw->prevCoords.x)) *
			  ts->msResizing / animationDuration);
		y      = tw->prevCoords.y - w->input.top +
		         (((float)(w->attrib.y - tw->prevCoords.y)) *
			  ts->msResizing / animationDuration);
		width  = tw->prevCoords.width + w->input.left + w->input.right +
		         (((float)(w->attrib.width - tw->prevCoords.width)) *
			  ts->msResizing / animationDuration);
		height = tw->prevCoords.height +
		         w->input.top + w->input.bottom +
			 (((float)(w->attrib.height - tw->prevCoords.height)) *
			  ts->msResizing / animationDuration);

		glColor3us (tw->outlineColor[0] * 0.66,
			    tw->outlineColor[1] * 0.66,
			    tw->outlineColor[2] * 0.66);
		glRecti (x, y + height, x + width, y);

		glColor3usv (tw->outlineColor);

		glBegin (GL_LINE_LOOP);
		glVertex3f (x, y, 0.0f);
		glVertex3f (x + width, y, 0.0f);
		glVertex3f (x + width, y + height, 0.0f);
		glVertex3f (x, y + height, 0.0f);
		glEnd ();

		glColor4usv (defaultColor);
	    }
	}

	glPopMatrix ();
	glColor4usv (defaultColor);
	glLineWidth (1.0f);
    }

    return status;
}
Beispiel #3
0
M(void, glColor3usv, jobject v) {
	glColor3usv(BUFF(GLushort, v));
}
inline void glColor3v( const GLushort * v )	{ glColor3usv( v ); }
Beispiel #5
0
void __glXDisp_Color3usv(GLbyte *pc)
{
	glColor3usv( 
		(GLushort *)(pc + 0)
	);
}