What OS are you using?

Shai

On 3/7/07, jack3 <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I met a problem with GLWindow. My aim is to use GLWindow to rendering Video( 
> a serial image). the problem is redraw looks doesn't work as I thought. it 
> became very slow and noneupdated.
>
> Basically, my way is inherit a class glCanvas from GLWindow and override the 
> function of draw_overlay and draw.
>
> then, I have a thread to continuely read image from network and call 
> redraw_overlay.
>
> Finally,draw_overlay should be called to refresh the image on the window.
>
> But I just noticed that window refreshed only when window has focus and mouse 
> event on them. And the performance looks really bad.
>
> Can anyone give me a clue?
>
> Thanks first.
>
> ==================my code ==================
>
> #include <stdlib.h>
> #include <assert.h>
> #include "VTGLCanvas.h"
> #include <fltk/gl.h>
> #include <fltk/draw.h>
> using namespace fltk;
> VTGLCanvas::VTGLCanvas(int w,int h,const char *l)
> :GlWindow(0,0,w,h,l)
> {       //mode(mode()|fltk::RGB|fltk::NO_AUTO_SWAP|fltk::NO_ERASE_OVERLAY);
>         m_nWidth=nWidth;
>         m_nHeight=nHeight;
>         m_nBitCount=nBitCount;
>         m_pFrameData=new char[nFrameSize+1280+1024];
> }
> VTGLCanvas::~VTGLCanvas()
> {
> }
>
>
> void VTGLCanvas::ThreadProcMain(void)
> {
>         while (!m_bWantToStop)
>         {
>                 mySleep(30);
>                 ////////////////////
>                 {
>                         CAVAutoLock lock(&m_CritSecList);
>                         m_pFrameData=readfromnetwork();
>                         redraw_overlay();
>                 }
>         }
> }
>
> void VTGLCanvas::draw()
> {
> }
> void VTGLCanvas::draw_overlay()
> {
>         // the valid() property may be used to avoid reinitializing your
>         // GL transformation for each redraw:
>         if (!valid())
>         {
>                 valid(1);
>                 glLoadIdentity();
>                 glViewport(0,0,w(),h());
>         }
> //      glBegin();
>         glClearColor(0,0,0,0);
>         glClear(GL_COLOR_BUFFER_BIT);
>         CAVAutoLock lock(&m_CritSecData);
>         
> glDrawPixels(m_nWidth,m_nHeight,GL_BGR_EXT,GL_UNSIGNED_BYTE,m_pFrameData);
>         swap_buffers();
> //      glEnd();
>         /*
>         
> glTexSubImage2D(GL_TEXTURE_2D,0,0,0,m_nWidth,m_nHeight,GL_RGB,GL_UNSIGNED_BYTE,m_pFrameData);
>         */
>
>
> }
>
> _______________________________________________
> fltk-opengl mailing list
> [email protected]
> http://lists.easysw.com/mailman/listinfo/fltk-opengl
>

_______________________________________________
fltk-opengl mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-opengl

Reply via email to