void draw() { glBindTexture(GL_TEXTURE_2D,tex_id); TheoraVideoFrame* f=clip->getNextFrame(); if (f) { glTexSubImage2D(GL_TEXTURE_2D,0,0,0,clip->getWidth(),f->getHeight(),GL_RGB,GL_UNSIGNED_BYTE,f->getBuffer()); clip->popFrame(); } float w=clip->getWidth(),h=clip->getHeight(); float tw=nextPow2(w),th=nextPow2(h); glEnable(GL_TEXTURE_2D); if (shader_on) enable_shader(); drawTexturedQuad(0,0,800,600,w/tw,h/th); if (shader_on) disable_shader(); glDisable(GL_TEXTURE_2D); drawColoredQuad(0,570,800,30,0,0,0,1); drawWiredQuad(0,570,800,30,1,1,1,1); float x=clip->getTimePosition()/clip->getDuration(); drawColoredQuad(3,573,794*x,24,1,1,1,1); }
/** * \brief Draws the vertices in the case where there are textures. */ void bear::visual::gl_state::draw_textured() const { if ( m_vertices.empty() ) return; enable_shader(); set_colors(); set_vertices(); set_texture_coordinates(); for ( element_range_list::const_iterator it(m_elements.begin()); it!=m_elements.end(); ++it ) { glBindTexture( GL_TEXTURE_2D, it->texture_id ); VISUAL_GL_ERROR_THROW(); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); VISUAL_GL_ERROR_THROW(); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); VISUAL_GL_ERROR_THROW(); glDrawArrays( get_gl_render_mode(), it->vertex_index, it->count ); VISUAL_GL_ERROR_THROW(); } disable_states(); } // gl_state::draw_textured()
void drawVideo(int x,int y,unsigned int tex_id,TheoraVideoClip* clip) { //glLoadIdentity(); //glTranslatef(x,y,0); glBindTexture(GL_TEXTURE_2D,tex_id); TheoraVideoFrame* f=clip->getNextFrame(); if (f) { glTexSubImage2D(GL_TEXTURE_2D,0,0,0,clip->getWidth(),f->getHeight(),uploadFormat,GL_UNSIGNED_BYTE,f->getBuffer()); clip->popFrame(); } float w=clip->getWidth(),h=clip->getHeight(); float tw=nextPow2(w),th=nextPow2(h); glEnable(GL_TEXTURE_2D); if (shader_on) enable_shader(); drawTexturedQuad(tex_id, x,y,395,285,w/tw,h/th); if (shader_on) disable_shader(); glDisable(GL_TEXTURE_2D); drawColoredQuad(x,y+285,395,15,0,0,0,1); drawWiredQuad(x,y+285,395,14,1,1,1,1); float p=clip->getTimePosition()/clip->getDuration(); drawColoredQuad(x+1.5f,y+574/2,784*p/2,11,1,1,1,1); }
/** * \brief Draws the vertices in the case where there is no texture. */ void bear::visual::gl_state::draw_shape() const { if ( m_vertices.empty() ) return; enable_shader(); if ( m_line_width > 0 ) { glLineWidth( m_line_width ); VISUAL_GL_ERROR_THROW(); } set_colors(); set_vertices(); glBindTexture( GL_TEXTURE_2D, 0 ); VISUAL_GL_ERROR_THROW(); glDrawArrays( get_gl_render_mode(), 0, get_vertex_count() ); disable_states(); } // gl_state::draw_shape()
void draw() { glBindTexture(GL_TEXTURE_2D,tex_id); if (!needsSeek) { TheoraVideoFrame* f=clip->getNextFrame(); if (f) { glTexSubImage2D(GL_TEXTURE_2D,0,0,0,clip->getWidth(),f->getHeight(),GL_RGB,GL_UNSIGNED_BYTE,f->getBuffer()); needsSeek = 1; if (f->getFrameNumber() != cFrame) nWrongSeeks++; cFrame++; if (cFrame >= clip->getNumFrames()) cFrame = 0; printf("Displayed frame %d\n", f->getFrameNumber()); clip->popFrame(); } } float w=clip->getWidth(),h=clip->getHeight(); float tw=nextPow2(w),th=nextPow2(h); glEnable(GL_TEXTURE_2D); if (shader_on) enable_shader(); drawTexturedQuad(tex_id,0,0,800,600,w/tw,h/th); if (shader_on) disable_shader(); glDisable(GL_TEXTURE_2D); drawColoredQuad(0,570,800,30,0,0,0,1); drawWiredQuad(0,570,800,30,1,1,1,1); float x=clip->getTimePosition()/clip->getDuration(); drawColoredQuad(3,573,794*x,24,1,1,1,1); }