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); }
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); }
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); }