[PyQt] max texture size for QGLWidget.bindTexture?

Brian Parma freecode at cox.net
Tue Sep 9 00:28:49 BST 2008

David Boddie wrote:
> On Tue, 02 Sep 2008 12:49:54 -0700, Brian Parma wrote:
>> I've noticed that If I try to use bindTexture on QPixmaps that are large
>> (the size of the screen), and then display them on a quad, only a
>> portion of the texture actually shows.  The rest of the surface is
>> either black or a scrambled jumble of other textures.  If I use a
>> smaller image there is no problem, but I can't find any references to a
>> max texture size in the documentation.  I tried increasing the texture
>> cache size but that had no effect.  Is there a limit on texture size,
>> and if so, how do you determine it?
> Some slight experience with OpenGL told me that it had to be possible to get
> this information from the OpenGL implementation on my machine.
> The following function call (using the GL module of the PyOpenGL package)
> returns the value you are looking for:
>     GL.glGetIntegerv(GL.GL_MAX_TEXTURE_SIZE)
> Strangely, in an interactive Python session, it returned 0, but I modified
> an example to print the value it returns, and my machine's implementation
> apparently supports textures up to 2048 pixels in size. However, it's an
> implementation-dependent value.
> Only a minimum of 64 pixels is guaranteed in OpenGL 1.2, as far as I can
> tell. Perhaps later versions increased this, but you may have to cater for
> hardware that only supports small texture sizes, anyway.
> David
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
> ------------------------------------------------------------------------
> No virus found in this incoming message.
> Checked by AVG - http://www.avg.com 
> Version: 8.0.169 / Virus Database: 270.6.17/1655 - Release Date: 9/5/2008 7:05 PM
Thanks for the response, that's a good find, although I'm trying to 
figure out how to interpret the result.  On my laptop it returns 2048, 
but how does that translate into resolution?  I thought it was memory 
size at first, but changing formats from RGB8 to RGB4 doesn't let me use 
larger textures.  Right now I take a screen cap which is 1024 x 768, and 
I then scale it down with QPixmap.scaledToWidth.  I've been playing with 
the width to try and find the limit, and it seems to be between 650 and 
700 pixels wide.

More information about the PyQt mailing list