当前位置: 首页>>代码示例>>C++>>正文


C++ GGLContext类代码示例

本文整理汇总了C++中GGLContext的典型用法代码示例。如果您正苦于以下问题:C++ GGLContext类的具体用法?C++ GGLContext怎么用?C++ GGLContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了GGLContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: gr_fill

void gr_fill(int x, int y, int w, int h)
{
    GGLContext *gl = gr_context;

    if(gr_is_curr_clr_opaque)
        gl->disable(gl, GGL_BLEND);

    gl->recti(gl, x, y, x + w, y + h);

    if(gr_is_curr_clr_opaque)
        gl->enable(gl, GGL_BLEND);
}
开发者ID:TheSSJ,项目名称:TWRPmod,代码行数:12,代码来源:graphics.c

示例2: gr_color

void gr_color(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
{
    GGLContext *gl = gr_context;
    GGLint color[4];
    color[0] = ((r << 8) | r) + 1;
    color[1] = ((g << 8) | g) + 1;
    color[2] = ((b << 8) | b) + 1;
    color[3] = ((a << 8) | a) + 1;
    gl->color4xv(gl, color);

    gr_is_curr_clr_opaque = (a == 255);
}
开发者ID:TheSSJ,项目名称:TWRPmod,代码行数:12,代码来源:graphics.c

示例3: gr_fill

void gr_fill(int x1, int y1, int x2, int y2)
{
    x1 += overscan_offset_x;
    y1 += overscan_offset_y;

    x2 += overscan_offset_x;
    y2 += overscan_offset_y;

    GGLContext *gl = gr_context;
    gl->disable(gl, GGL_TEXTURE_2D);
    gl->recti(gl, x1, y1, x2, y2);
}
开发者ID:alexadapter,项目名称:Recovery,代码行数:12,代码来源:graphics_cn.c

示例4: gr_flip

void gr_flip(void)
{
    GGLContext *gl = gr_context;
    
        /* currently active buffer becomes the backbuffer */
    gl->colorBuffer(gl, gr_framebuffer + gr_active_fb);

        /* swap front and back buffers */
    gr_active_fb = (gr_active_fb + 1) & 1;

        /* inform the display driver */
    set_active_framebuffer(gr_active_fb);
}
开发者ID:Jib-BAOSP,项目名称:platform_recovery,代码行数:13,代码来源:graphics.c

示例5: gr_line

void gr_line(int x0, int y0, int x1, int y1, int width)
{
    GGLContext *gl = gr_context;

    if(gr_is_curr_clr_opaque)
        gl->disable(gl, GGL_BLEND);

    const int coords0[2] = { x0 << 4, y0 << 4 };
    const int coords1[2] = { x1 << 4, y1 << 4 };
    gl->linex(gl, coords0, coords1, width << 4);

    if(gr_is_curr_clr_opaque)
        gl->enable(gl, GGL_BLEND);
}
开发者ID:Arasthel,项目名称:device_motorola_kinzie,代码行数:14,代码来源:graphics.c

示例6: gr_fill

void gr_fill(int x, int y, int w, int h)
{
    GGLContext *gl = gr_context;
    x += overscan_offset_x;
    y += overscan_offset_y;

    w += overscan_offset_x;
    h += overscan_offset_y;
    //fprintf(stderr, "gr_fill: x=%d,y=%d,w=%d,h=%d\n", x, y, w, h);

    gl->disable(gl, GGL_TEXTURE_2D);
    gl->recti(gl, x, y, w, h);

}
开发者ID:84506232,项目名称:android_bootable_recovery_cn,代码行数:14,代码来源:graphics.c

示例7: gr_init

int gr_init(void)
{
    gglInit(&gr_context);
    GGLContext *gl = gr_context;

    gr_init_font();
    gr_vt_fd = open("/dev/tty0", O_RDWR | O_SYNC);
    if (gr_vt_fd < 0) {
        // This is non-fatal; post-Cupcake kernels don't have tty0.
    } else if (ioctl(gr_vt_fd, KDSETMODE, (void*) KD_GRAPHICS)) {
        // However, if we do open tty0, we expect the ioctl to work.
        perror("failed KDSETMODE to KD_GRAPHICS on tty0");
        gr_exit();
        return -1;
    }

    gr_fb_fd = get_framebuffer(gr_framebuffer);
    if (gr_fb_fd < 0) {
        perror("Unable to get framebuffer.\n");
        gr_exit();
        return -1;
    }

    get_memory_surface(&gr_mem_surface);

    fprintf(stderr, "framebuffer: fd %d (%d x %d)\n",
            gr_fb_fd, gr_framebuffer[0].width, gr_framebuffer[0].height);

    /* start with 0 as front (displayed) and 1 as back (drawing) */
    gr_active_fb = 0;
    if (!has_overlay)
        set_active_framebuffer(0);
    gl->colorBuffer(gl, &gr_mem_surface);

    gl->activeTexture(gl, 0);
    gl->enable(gl, GGL_BLEND);
    gl->blendFunc(gl, GGL_SRC_ALPHA, GGL_ONE_MINUS_SRC_ALPHA);

#ifdef TW_SCREEN_BLANK_ON_BOOT
    printf("TW_SCREEN_BLANK_ON_BOOT := true\n");
    gr_fb_blank(true);
    gr_fb_blank(false);
#endif

    if (!alloc_ion_mem(fi.line_length * vi.yres))
        allocate_overlay(gr_fb_fd, gr_framebuffer);

    return 0;
}
开发者ID:bju2000,项目名称:device_zopo_zp999,代码行数:49,代码来源:graphics.twrp.c

示例8: gr_text

int gr_text(int x, int y, const char *s, int bold)
{
    GGLContext *gl = gr_context;
    GRFont *font = gr_font;
    unsigned off;

    x += overscan_offset_x;
    y += overscan_offset_y;

    y -= font->ascent;

    gl->bindTexture(gl, &font->texture);
    gl->texEnvi(gl, GGL_TEXTURE_ENV, GGL_TEXTURE_ENV_MODE, GGL_REPLACE);
    gl->texGeni(gl, GGL_S, GGL_TEXTURE_GEN_MODE, GGL_ONE_TO_ONE);
    gl->texGeni(gl, GGL_T, GGL_TEXTURE_GEN_MODE, GGL_ONE_TO_ONE);
    gl->enable(gl, GGL_TEXTURE_2D);

    while((off = *s++)) {
        off -= 32;
        if (off < 96) {
            gl->texCoord2i(gl, (off * font->cwidth) - x, 0 - y);
            gl->recti(gl, x, y, x + font->cwidth, y + font->cheight);
        }
        x += font->cwidth;
    }

    return x;
}
开发者ID:qinzuoze,项目名称:recovery-philz-changyu,代码行数:28,代码来源:graphics.c

示例9: gr_text_l

int gr_text_l(int x, int y, const char *s)
{
	GGLContext *gl = gr_context;
	GRFont *font = gr_font_l;
	unsigned off;

	y -= font->ascent;

	gl->bindTexture(gl, &font->texture);
	gl->texEnvi(gl, GGL_TEXTURE_ENV, GGL_TEXTURE_ENV_MODE, GGL_REPLACE);
	gl->texGeni(gl, GGL_S, GGL_TEXTURE_GEN_MODE, GGL_ONE_TO_ONE);
	gl->texGeni(gl, GGL_T, GGL_TEXTURE_GEN_MODE, GGL_ONE_TO_ONE);
	gl->enable(gl, GGL_TEXTURE_2D);
	
	while((off = *s++)) 
	{
		off -= 32;
		if (off < 96) 
		{
		  gl->texCoord2i(gl, 0 - (gr_fb_width() - y), (off * font->cwidth) - x + 1);
		  gl->recti(gl, gr_fb_width() - y - font->cheight, x, gr_fb_width() - 1 - y, x + font->cwidth);
		}
		x += font->cwidth;
	}

	return x;
}
开发者ID:Mioze7Ae,项目名称:openrecovery,代码行数:27,代码来源:graphics.c

示例10: gr_textEx

int gr_textEx(int x, int y, const char *s, void* pFont)
{
    GGLContext *gl = gr_context;
    GRFont *font = (GRFont*) pFont;
    unsigned off;
    unsigned cwidth;

    /* Handle default font */
    if (!font)  font = gr_font;

    gl->bindTexture(gl, &font->texture);
    gl->texEnvi(gl, GGL_TEXTURE_ENV, GGL_TEXTURE_ENV_MODE, GGL_REPLACE);
    gl->texGeni(gl, GGL_S, GGL_TEXTURE_GEN_MODE, GGL_ONE_TO_ONE);
    gl->texGeni(gl, GGL_T, GGL_TEXTURE_GEN_MODE, GGL_ONE_TO_ONE);
    gl->enable(gl, GGL_TEXTURE_2D);

    while((off = *s++)) {
        off -= 32;
        cwidth = 0;
        if (off < 96) {
            cwidth = font->offset[off+1] - font->offset[off];
			gl->texCoord2i(gl, (font->offset[off]) - x, 0 - y);
			gl->recti(gl, x, y, x + cwidth, y + font->cheight);
			x += cwidth;
        }
    }

    return x;
}
开发者ID:ajrulez,项目名称:Team-Win-Recovery-Project,代码行数:29,代码来源:graphics.c

示例11: twgr_text

int twgr_text(int x, int y, const char *s)
{
    GGLContext *gl = gr_context;
    GRFont *font = gr_font;
    unsigned off;
    unsigned cwidth = 0;

    y -= font->ascent;

    gl->bindTexture(gl, &font->texture);
    gl->texEnvi(gl, GGL_TEXTURE_ENV, GGL_TEXTURE_ENV_MODE, GGL_REPLACE);
    gl->texGeni(gl, GGL_S, GGL_TEXTURE_GEN_MODE, GGL_ONE_TO_ONE);
    gl->texGeni(gl, GGL_T, GGL_TEXTURE_GEN_MODE, GGL_ONE_TO_ONE);
    gl->enable(gl, GGL_TEXTURE_2D);

    while((off = *s++)) {
        off -= 32;
        if (off < 96) {
            cwidth = font->offset[off+1] - font->offset[off];
            gl->texCoord2i(gl, (off * cwidth) - x, 0 - y);
            gl->recti(gl, x, y, x + cwidth, y + font->cheight);
        }
        x += cwidth;
    }

    return x;
}
开发者ID:ajrulez,项目名称:Team-Win-Recovery-Project,代码行数:27,代码来源:graphics.c

示例12: gr_textExW

int gr_textExW(int x, int y, const char *s, void* pFont, int max_width)
{
    GGLContext *gl = gr_context;
    GRFont *font = (GRFont*) pFont;
    unsigned off;
    unsigned cwidth;

    /* Handle default font */
    if (!font)  font = gr_font;

#ifndef TW_DISABLE_TTF
    if(font->type == FONT_TYPE_TTF)
        return gr_ttf_textExWH(gl, x, y, s, pFont, max_width, -1);
#endif

    gl->bindTexture(gl, &font->texture);
    gl->texEnvi(gl, GGL_TEXTURE_ENV, GGL_TEXTURE_ENV_MODE, GGL_REPLACE);
    gl->texGeni(gl, GGL_S, GGL_TEXTURE_GEN_MODE, GGL_ONE_TO_ONE);
    gl->texGeni(gl, GGL_T, GGL_TEXTURE_GEN_MODE, GGL_ONE_TO_ONE);
    gl->enable(gl, GGL_TEXTURE_2D);

    while((off = *s++)) {
        off -= 32;
        cwidth = 0;
        if (off < 96) {
            cwidth = font->offset[off+1] - font->offset[off];
			if ((x + (int)cwidth) < max_width) {
				gl->texCoord2i(gl, (font->offset[off]) - x, 0 - y);
				gl->recti(gl, x, y, x + cwidth, y + font->cheight);
				x += cwidth;
			} else {
				gl->texCoord2i(gl, (font->offset[off]) - x, 0 - y);
				gl->recti(gl, x, y, max_width, y + font->cheight);
				x = max_width;
				return x;
			}
        }
    }

    gl->disable(gl, GGL_TEXTURE_2D);

    return x;
}
开发者ID:Arasthel,项目名称:device_motorola_kinzie,代码行数:43,代码来源:graphics.c

示例13: gr_update_surface_dimensions

void gr_update_surface_dimensions()
{
    if(gr_rotation%180 == 0)
    {
        gr_mem_surface.width = vi.xres;
        gr_mem_surface.height = vi.yres;
        if(gr_rotation == 0)
            gr_mem_surface.stride = vi.xres_virtual;
        else
            gr_mem_surface.stride = vi.xres;
    }
    else
    {
        gr_mem_surface.width = vi.yres;
        gr_mem_surface.height = vi.xres;
        gr_mem_surface.stride = vi.yres;
    }
    GGLContext *gl = gr_context;
    gl->colorBuffer(gl, &gr_mem_surface);
}
开发者ID:ajrulez,项目名称:Team-Win-Recovery-Project,代码行数:20,代码来源:graphics.c

示例14: gr_init

int gr_init(void)
{
    GGLContext *gl;
    int fd;

    gglInit(&gr_context);
    gl = gr_context;

    gr_init_font();

    fd = open("/dev/tty0", O_RDWR | O_SYNC);
    if(fd < 0) return -1;

    if(ioctl(fd, KDSETMODE, (void*) KD_GRAPHICS)) {
        close(fd);
        return -1;
    }

    gr_fb_fd = get_framebuffer(gr_framebuffer);
    
    if(gr_fb_fd < 0) {
        ioctl(fd, KDSETMODE, (void*) KD_TEXT);
        close(fd);
        return -1;
    }

    gr_vt_fd = fd;

        /* start with 0 as front (displayed) and 1 as back (drawing) */
    gr_active_fb = 0;
    set_active_framebuffer(0);
    gl->colorBuffer(gl, gr_framebuffer + 1);

    gl->activeTexture(gl, 0);
    gl->enable(gl, GGL_BLEND);
    gl->blendFunc(gl, GGL_SRC_ALPHA, GGL_ONE_MINUS_SRC_ALPHA);

    return 0;
}
开发者ID:Jib-BAOSP,项目名称:platform_recovery,代码行数:39,代码来源:graphics.c

示例15: gr_textExW

int gr_textExW(int x, int y, const char *s, void* pFont, int max_width)
{
    GGLContext *gl = gr_context;
    GRFont *gfont = (GRFont*) pFont;
    unsigned off, width, height, n;
    wchar_t ch;

    /* Handle default font */
    if (!gfont)  gfont = gr_font;

    y -= gfont->ascent;

    gl->texEnvi(gl, GGL_TEXTURE_ENV, GGL_TEXTURE_ENV_MODE, GGL_REPLACE);
    gl->texGeni(gl, GGL_S, GGL_TEXTURE_GEN_MODE, GGL_ONE_TO_ONE);
    gl->texGeni(gl, GGL_T, GGL_TEXTURE_GEN_MODE, GGL_ONE_TO_ONE);
    gl->enable(gl, GGL_TEXTURE_2D);

    while(*s) {
        if(*((unsigned char*)(s)) < 0x20) {
            s++;
            continue;
        }
		off = getCharID(s,pFont);
        n = utf8_mbtowc(&ch, s, strlen(s));
        if(n <= 0)
            break;
        s += n;
		width = gfont->cwidth[off];
		height = gfont->cheight[off];
        memcpy(&font_ftex, &gfont->texture, sizeof(font_ftex));
        font_ftex.width = width;
        font_ftex.height = height;
        font_ftex.stride = width;
        font_ftex.data = gfont->fontdata[off];
        gl->bindTexture(gl, &font_ftex);
	    gl->texCoord2i(gl, 0 - x, 0 - y);
		if ((x + (int)width) < max_width) {
			gl->recti(gl, x, y, x + width, y + height);
			x += width;
		}
		else {
			gl->recti(gl, x, y, max_width, y + height);
			x += max_width;
			return x;
		}
    }
    return x;
}
开发者ID:Solitarily,项目名称:TWRP_cn,代码行数:48,代码来源:graphics.c


注:本文中的GGLContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。