void _drawVideo(int x, int y, unsigned int textureId, theoraplayer::VideoClip* clip) { glBindTexture(GL_TEXTURE_2D, textureId); theoraplayer::VideoFrame* frame = clip->fetchNextFrame(); if (frame != NULL) { glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, clip->getWidth(), frame->getHeight(), uploadFormat, GL_UNSIGNED_BYTE, frame->getBuffer()); clip->popFrame(); } float w = clip->getSubFrameWidth(); float h = clip->getSubFrameHeight(); float sx = clip->getSubFrameX(); float sy = clip->getSubFrameY(); float tw = potCeil(w); float th = potCeil(h); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, textureId); if (shaderActive) { enableShader(); } drawTexturedQuad(textureId, x, y, 395.0f, 285.0f, w / tw, h / th, sx / tw, sy / th); if (shaderActive) { disableShader(); } glDisable(GL_TEXTURE_2D); drawColoredQuad(x, y + 285.0f, 395.0f, 15.0f, 0.0f, 0.0f, 0.0f, 1.0f); drawWiredQuad(x, y + 285.0f, 395.0f, 14.0f, 1.0f, 1.0f, 1.0f, 1.0f); float p = clip->getTimePosition() / clip->getDuration(); drawColoredQuad(x + 1.5f, y + 286.0f, 784.0f * p * 0.5f, 11.0f, 1.0f, 1.0f, 1.0f, 1.0f); }
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); }