[PyQt] Overpainting example does not work

Phil Thompson phil at riverbankcomputing.com
Tue Apr 20 09:47:33 BST 2010


On Tue, 20 Apr 2010 09:50:53 +0200, Mads Ipsen <madsipsen at gmail.com> wrote:
> 1. The output from glxinfo yields:
> 
> name of display: :0.0
> display: :0  screen: 0
> direct rendering: Yes
> server glx vendor string: NVIDIA Corporation
> server glx version string: 1.4
> server glx extensions:
>     GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_SGIX_fbconfig,
>     GLX_SGIX_pbuffer, GLX_SGI_video_sync, GLX_SGI_swap_control,
>     GLX_EXT_swap_control, GLX_EXT_texture_from_pixmap, 
> GLX_ARB_create_context,
>     GLX_ARB_create_context_profile, GLX_ARB_multisample, 
> GLX_NV_float_buffer,
>     GLX_ARB_fbconfig_float, GLX_EXT_framebuffer_sRGB
> 
> 2. In fact I can make the example work by adding the lines
> 
>   glShadeModel(GL_FLAT)
>   glDisable(GL_CULL_FACE)
>   glDisable(GL_DEPTH_TEST)
>   glDisable(GL_LIGHTING)
> 
> just after the line        
> 
>   glCallList(self.object)
> 
> in the method paintEvent().

Using this as a clue, just removing the earlier call to...

    glEnable(GL_CULL_FACE)

...seems to work.

> 3. BTW - Isn't the second call to painter.fillRect() in 
> drawInstructions() method redundant?
> 
>         painter.setRenderHint(QtGui.QPainter.TextAntialiasing)
>         painter.fillRect(QtCore.QRect(0, 0, self.width(), rect.height() 
> + 2*border), QtGui.QColor(0, 0, 0, 127))
>         painter.setPen(QtCore.Qt.white)
>         painter.fillRect(QtCore.QRect(0, 0, self.width(), rect.height() 
> + 2*border), QtGui.QColor(0, 0, 0, 127))
> 
> Best regards,
> 
> Mads

The C++ version now looks quite different as far as the logo is concerned. 
I'll get round to re-porting to PyQt at some point.

Thanks,
Phil


More information about the PyQt mailing list