void glw_wirecube(glw_root_t *gr, const glw_rctx_t *rc) { glw_backend_root_t *gbr = &gr->gr_be; if(gbr->gbr_delayed_rendering) return; glw_load_program(gbr, gbr->gbr_renderer_flat); glw_program_set_modelview(gbr, rc); glw_program_set_uniform_color(gbr, 1,1,1,1); glBegin(GL_LINE_LOOP); glVertex3f(-1.0, -1.0, -1.0); glVertex3f( 1.0, -1.0, -1.0); glVertex3f( 1.0, 1.0, -1.0); glVertex3f(-1.0, 1.0, -1.0); glEnd(); glBegin(GL_LINE_LOOP); glVertex3f(-1.0, -1.0, 1.0); glVertex3f( 1.0, -1.0, 1.0); glVertex3f( 1.0, 1.0, 1.0); glVertex3f(-1.0, 1.0, 1.0); glEnd(); glBegin(GL_LINE_LOOP); glVertex3f(-1.0, -1.0, 1.0); glVertex3f(-1.0, -1.0, -1.0); glVertex3f(-1.0, 1.0, -1.0); glVertex3f(-1.0, 1.0, 1.0); glEnd(); glBegin(GL_LINE_LOOP); glVertex3f( 1.0, -1.0, 1.0); glVertex3f( 1.0, -1.0, -1.0); glVertex3f( 1.0, 1.0, -1.0); glVertex3f( 1.0, 1.0, 1.0); glEnd(); glBegin(GL_LINE_LOOP); glVertex3f( 1.0, -1.0, 1.0); glVertex3f( 1.0, -1.0, -1.0); glVertex3f(-1.0, -1.0, -1.0); glVertex3f(-1.0, -1.0, 1.0); glEnd(); glBegin(GL_LINE_LOOP); glVertex3f( 1.0, 1.0, 1.0); glVertex3f( 1.0, 1.0, -1.0); glVertex3f(-1.0, 1.0, -1.0); glVertex3f(-1.0, 1.0, 1.0); glEnd(); }
/** * Video widget render */ void glw_render_video_quad(int interlace, int rectmode, int width, int height, int bob1, int bob2, glw_backend_root_t *gbr, glw_program_t *gp, const glw_video_t *gv, glw_rctx_t *rc) { float x1, x2, y1, y2; float b1 = 0, b2 = 0; static const float vertices[8] = {-1, -1, 1, -1, 1, 1, -1, 1}; const uint8_t elements[6] = {0,1,2,0,2,3}; float tc[12]; x1 = 0; y1 = 0; if(rectmode) { x2 = width; y2 = height; } else { x2 = 1; y2 = 1; if(interlace) { b1 = (0.5 * bob1) / (float)height; b2 = (0.5 * bob2) / (float)height; } } tc[0] = x1; tc[1] = y2 - b1; tc[2] = y2 - b2; tc[3] = x2; tc[4] = y2 - b1; tc[5] = y2 - b2; tc[6] = x2; tc[7] = y1 - b1; tc[8] = y1 - b2; tc[9] = x1; tc[10] = y1 - b1; tc[11] = y1 - b2; glw_load_program(gbr, gp); glw_program_set_uniform_color(gbr, 1, 1, 1, rc->rc_alpha); glw_program_set_modelview(gbr, rc); if(gp->gp_uniform_blend != -1) glUniform1f(gp->gp_uniform_blend, gv->gv_blend); if(gp->gp_uniform_colormtx != -1) glUniformMatrix4fv(gp->gp_uniform_colormtx, 1, GL_FALSE, gv->gv_cmatrix_cur); glVertexAttribPointer(gp->gp_attribute_texcoord, 3, GL_FLOAT, 0, 0, tc); glVertexAttribPointer(gp->gp_attribute_position, 2, GL_FLOAT, 0, 0, vertices); glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, elements); }