[PyQt] max texture size for QGLWidget.bindTexture?

David Boddie david at boddie.org.uk
Sun Sep 7 03:02:10 BST 2008


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



More information about the PyQt mailing list