本文整理汇总了C++中UNCLAMPED_FLOAT_TO_UBYTE函数的典型用法代码示例。如果您正苦于以下问题:C++ UNCLAMPED_FLOAT_TO_UBYTE函数的具体用法?C++ UNCLAMPED_FLOAT_TO_UBYTE怎么用?C++ UNCLAMPED_FLOAT_TO_UBYTE使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了UNCLAMPED_FLOAT_TO_UBYTE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: clear_rgba_buffer_with_masking
/**
* Clear the color buffer when glColorMask is in effect.
*/
static void
clear_rgba_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb)
{
const GLint x = ctx->DrawBuffer->_Xmin;
const GLint y = ctx->DrawBuffer->_Ymin;
const GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
const GLint width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin;
SWspan span;
GLint i;
ASSERT(ctx->Visual.rgbMode);
ASSERT(rb->PutRow);
/* Initialize color span with clear color */
/* XXX optimize for clearcolor == black/zero (bzero) */
INIT_SPAN(span, GL_BITMAP, width, 0, SPAN_RGBA);
span.array->ChanType = rb->DataType;
if (span.array->ChanType == GL_UNSIGNED_BYTE) {
GLubyte clearColor[4];
UNCLAMPED_FLOAT_TO_UBYTE(clearColor[RCOMP], ctx->Color.ClearColor[0]);
UNCLAMPED_FLOAT_TO_UBYTE(clearColor[GCOMP], ctx->Color.ClearColor[1]);
UNCLAMPED_FLOAT_TO_UBYTE(clearColor[BCOMP], ctx->Color.ClearColor[2]);
UNCLAMPED_FLOAT_TO_UBYTE(clearColor[ACOMP], ctx->Color.ClearColor[3]);
for (i = 0; i < width; i++) {
COPY_4UBV(span.array->rgba[i], clearColor);
}
}
else if (span.array->ChanType == GL_UNSIGNED_SHORT) {
GLushort clearColor[4];
UNCLAMPED_FLOAT_TO_USHORT(clearColor[RCOMP], ctx->Color.ClearColor[0]);
UNCLAMPED_FLOAT_TO_USHORT(clearColor[GCOMP], ctx->Color.ClearColor[1]);
UNCLAMPED_FLOAT_TO_USHORT(clearColor[BCOMP], ctx->Color.ClearColor[2]);
UNCLAMPED_FLOAT_TO_USHORT(clearColor[ACOMP], ctx->Color.ClearColor[3]);
for (i = 0; i < width; i++) {
COPY_4V(span.array->rgba[i], clearColor);
}
}
else {
ASSERT(span.array->ChanType == GL_FLOAT);
for (i = 0; i < width; i++) {
CLAMPED_FLOAT_TO_CHAN(span.array->rgba[i][0], ctx->Color.ClearColor[0]);
CLAMPED_FLOAT_TO_CHAN(span.array->rgba[i][1], ctx->Color.ClearColor[1]);
CLAMPED_FLOAT_TO_CHAN(span.array->rgba[i][2], ctx->Color.ClearColor[2]);
CLAMPED_FLOAT_TO_CHAN(span.array->rgba[i][3], ctx->Color.ClearColor[3]);
}
}
/* Note that masking will change the color values, but only the
* channels for which the write mask is GL_FALSE. The channels
* which which are write-enabled won't get modified.
*/
for (i = 0; i < height; i++) {
span.x = x;
span.y = y + i;
_swrast_mask_rgba_span(ctx, rb, &span);
/* write masked row */
rb->PutRow(ctx, rb, width, x, y + i, span.array->rgba, NULL);
}
}
示例2: radeon_Color4fv_ub
static void radeon_Color4fv_ub( const GLfloat *v )
{
radeon_color_t *dest = vb.colorptr;
UNCLAMPED_FLOAT_TO_UBYTE( dest->red, v[0] );
UNCLAMPED_FLOAT_TO_UBYTE( dest->green, v[1] );
UNCLAMPED_FLOAT_TO_UBYTE( dest->blue, v[2] );
UNCLAMPED_FLOAT_TO_UBYTE( dest->alpha, v[3] );
}
示例3: radeon_SecondaryColor3fEXT_ub
static void radeon_SecondaryColor3fEXT_ub( GLfloat r, GLfloat g, GLfloat b )
{
radeon_color_t *dest = vb.specptr;
UNCLAMPED_FLOAT_TO_UBYTE( dest->red, r );
UNCLAMPED_FLOAT_TO_UBYTE( dest->green, g );
UNCLAMPED_FLOAT_TO_UBYTE( dest->blue, b );
dest->alpha = 255;
}
示例4: radeon_SecondaryColor3fvEXT_ub
static void radeon_SecondaryColor3fvEXT_ub( const GLfloat *v )
{
radeon_color_t *dest = vb.specptr;
UNCLAMPED_FLOAT_TO_UBYTE( dest->red, v[0] );
UNCLAMPED_FLOAT_TO_UBYTE( dest->green, v[1] );
UNCLAMPED_FLOAT_TO_UBYTE( dest->blue, v[2] );
dest->alpha = 255;
}
示例5: insert_3ub_3f_bgr_2
static void insert_3ub_3f_bgr_2( const struct tnl_clipspace_attr *a, GLubyte *v,
const GLfloat *in )
{
(void) a;
UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[0]);
UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[1]);
v[0] = 0;
}
示例6: radeon_Color4f_ub
static void radeon_Color4f_ub( GLfloat r, GLfloat g, GLfloat b, GLfloat a )
{
radeon_color_t *dest = vb.colorptr;
UNCLAMPED_FLOAT_TO_UBYTE( dest->red, r );
UNCLAMPED_FLOAT_TO_UBYTE( dest->green, g );
UNCLAMPED_FLOAT_TO_UBYTE( dest->blue, b );
UNCLAMPED_FLOAT_TO_UBYTE( dest->alpha, a );
}
示例7: insert_3ub_3f_bgr_3
static inline void insert_3ub_3f_bgr_3( const struct tnl_clipspace_attr *a, GLubyte *v,
const GLfloat *in )
{
DEBUG_INSERT;
(void) a;
UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[0]);
UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[1]);
UNCLAMPED_FLOAT_TO_UBYTE(v[0], in[2]);
}
示例8: insert_4ub_4f_abgr_2
static void insert_4ub_4f_abgr_2( const struct tnl_clipspace_attr *a, GLubyte *v,
const GLfloat *in )
{
(void) a;
UNCLAMPED_FLOAT_TO_UBYTE(v[3], in[0]);
UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[1]);
v[1] = 0x00;
v[0] = 0xff;
}
示例9: insert_4ub_4f_argb_4
static void insert_4ub_4f_argb_4( const struct tnl_clipspace_attr *a, GLubyte *v,
const GLfloat *in )
{
(void) a;
UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[0]);
UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[1]);
UNCLAMPED_FLOAT_TO_UBYTE(v[3], in[2]);
UNCLAMPED_FLOAT_TO_UBYTE(v[0], in[3]);
}
示例10: r200_SecondaryColor3fvEXT_ub
static void r200_SecondaryColor3fvEXT_ub( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
r200ContextPtr rmesa = R200_CONTEXT(ctx);
r200_color_t *dest = rmesa->vb.specptr;
UNCLAMPED_FLOAT_TO_UBYTE( dest->red, v[0] );
UNCLAMPED_FLOAT_TO_UBYTE( dest->green, v[1] );
UNCLAMPED_FLOAT_TO_UBYTE( dest->blue, v[2] );
dest->alpha = 255;
}
示例11: radeon_Color3f_ub
static void radeon_Color3f_ub( GLfloat r, GLfloat g, GLfloat b )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
radeon_color_t *dest = rmesa->vb.colorptr;
UNCLAMPED_FLOAT_TO_UBYTE( dest->red, r );
UNCLAMPED_FLOAT_TO_UBYTE( dest->green, g );
UNCLAMPED_FLOAT_TO_UBYTE( dest->blue, b );
dest->alpha = 255;
}
示例12: r200_Color4f_ub
static void r200_Color4f_ub( GLfloat r, GLfloat g, GLfloat b, GLfloat a )
{
GET_CURRENT_CONTEXT(ctx);
r200ContextPtr rmesa = R200_CONTEXT(ctx);
r200_color_t *dest = rmesa->vb.colorptr;
UNCLAMPED_FLOAT_TO_UBYTE( dest->red, r );
UNCLAMPED_FLOAT_TO_UBYTE( dest->green, g );
UNCLAMPED_FLOAT_TO_UBYTE( dest->blue, b );
UNCLAMPED_FLOAT_TO_UBYTE( dest->alpha, a );
}
示例13: radeon_Color3fv_ub
static void radeon_Color3fv_ub( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
radeon_color_t *dest = rmesa->vb.colorptr;
UNCLAMPED_FLOAT_TO_UBYTE( dest->red, v[0] );
UNCLAMPED_FLOAT_TO_UBYTE( dest->green, v[1] );
UNCLAMPED_FLOAT_TO_UBYTE( dest->blue, v[2] );
dest->alpha = 255;
}
示例14: r200_SecondaryColor3fEXT_ub
static void r200_SecondaryColor3fEXT_ub( GLfloat r, GLfloat g, GLfloat b )
{
GET_CURRENT_CONTEXT(ctx);
r200ContextPtr rmesa = R200_CONTEXT(ctx);
r200_color_t *dest = rmesa->vb.specptr;
UNCLAMPED_FLOAT_TO_UBYTE( dest->red, r );
UNCLAMPED_FLOAT_TO_UBYTE( dest->green, g );
UNCLAMPED_FLOAT_TO_UBYTE( dest->blue, b );
dest->alpha = 255;
}
示例15: r200_Color4fv_ub
static void r200_Color4fv_ub( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
r200ContextPtr rmesa = R200_CONTEXT(ctx);
r200_color_t *dest = rmesa->vb.colorptr;
UNCLAMPED_FLOAT_TO_UBYTE( dest->red, v[0] );
UNCLAMPED_FLOAT_TO_UBYTE( dest->green, v[1] );
UNCLAMPED_FLOAT_TO_UBYTE( dest->blue, v[2] );
UNCLAMPED_FLOAT_TO_UBYTE( dest->alpha, v[3] );
}