[MPlayer-users] gl/g2 don't work well with -wid in windows
Pepe
rvm3000 at ya.com
Sun Feb 18 23:52:36 CET 2007
El Domingo, 18 de Febrero de 2007 21:05, Reimar Döffinger escribió:
> Hello,
>
> On Sun, Feb 18, 2007 at 08:47:41PM +0100, Pepe wrote:
> > El Domingo, 18 de Febrero de 2007 20:15, Reimar Döffinger escribió:
> > > It does not for me, and not with MPUI either.
> > > Maybe you both do not call SetPixelFormat with a format that has
> > > PFD_SUPPORT_OPENGL before drawing into the hdc?
> >
> > No I don't. I didn't know I had to do this.
> > I'll try to fix it.
>
> Well, it's a bit unclear to me what exactly is needed, but
> PFD_SUPPORT_OPENGL is needed to allow OpenGl rendering on it.
> And the SetPixelFormat description says
> "If hdc references a window, calling the SetPixelFormat function also
> changes the pixel format of the window. Setting the pixel format of a
> window more than once can lead to significant complications for the
> Window Manager and for multithread applications, so it is not allowed.
> An application can only set the pixel format of a window one time. Once
> a window's pixel format is set, it cannot be changed."
> so I guess you might end up with a window that can't do OpenGL, at least
> that's my best explanation so far.
> It might also be related to this comment though:
> "an OpenGL window should be created with the WS_CLIPCHILDREN and
> WS_CLIPSIBLINGS styles. Additionally, the window class attribute should
> not include the CS_PARENTDC style."
Hi again.
I have no idea about Windows programming, but after searching in google I
copied this code in my application:
HDC hDC = GetDC( mplayerwindow->mplayerLayer()->winId() );
PIXELFORMATDESCRIPTOR pfd;
ZeroMemory( &pfd, sizeof( pfd ) );
pfd.nSize = sizeof( pfd );
pfd.nVersion = 1;
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL |
PFD_DOUBLEBUFFER;
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cColorBits = 24;
pfd.cDepthBits = 16;
pfd.iLayerType = PFD_MAIN_PLANE;
int iFormat = ChoosePixelFormat( hDC, &pfd );
bool b = SetPixelFormat( hDC, iFormat, &pfd );
qDebug("Gui: SetPixelFormat return: %d", b );
I don't know if I've done something wrong but I cannot see any difference at
all. gl/gl2 still show the corrupted video after resizing.
I've uploaded the binary just in case you want to try:
http://www.escomposlinux.org/rvm/temp/SMP/smplayer_gl.zip
But are you sure that this is the problem? I mean, if the window hadn't
permission to draw OpenGL then nothing would appear, but it does.
I've done another test. In smplayer I go to the preferences and set it to
never auto-resize the main window. Now I load a video and I maximize the
window. The video stays on the top left, the rest of the window is full of
strange blocks.
Now I select a filter (for example Audio-> Extrastereo) to force mplayer to
restart (the mplayer process is killed and started again but this time the
window for mplayer is bigger). The video is displayed correctly!
Screenshot: http://www.uploadfile.info/uploads/e8fc7a2db7.jpg
Now I resize the main window to make it smaller. This is the result:
http://www.uploadfile.info/uploads/5b50f9dee5.jpg
It seems to me that the problem is that mplayer is not resizing the video.
--
Pepe
More information about the MPlayer-users
mailing list