Original Post
Hey guys, I've recently hit a huge bottleneck in my program where I didn't think there would be one. I narrowed it down to a simple scenario: * Create an OpenGL texture with the following pseudo-code:
(glTexEnvi GL_TEXTURE_ENV GL_TEXTURE_ENV_MODE GL_DECAL)
(glTexImage2D GL_TEXTURE_2D
0
GL_RGBA
width
height
0
GL_RGBA
GL_UNSIGNED_BYTE
data)
(glTexParameteri GL_TEXTURE_2D
GL_TEXTURE_MIN_FILTER
GL_LINEAR)
(glTexParameteri GL_TEXTURE_2D
GL_TEXTURE_MAG_FILTER
GL_LINEAR)
(glTexParameteri GL_TEXTURE_2D
GL_TEXTURE_WRAP_S
GL_REPEAT)
(glTexParameteri GL_TEXTURE_2D
GL_TEXTURE_WRAP_T
GL_REPEAT)
* Create a loop that simply renders a quad that fills the window with the above texture applied to it (so you just see the image rendered in the window). That's basically it. Surprisingly, for a 465x638 window, each loop iteration takes ~.55s! However, here's the kicker, if I change the texture wrap parameters to GL_CLAMP_TO_EDGE instead of GL_REPEAT, I get the expected faster speeds of ~.002s per iteration:
(glTexParameteri GL_TEXTURE_2D
GL_TEXTURE_WRAP_S
GL_CLAMP_TO_EDGE)
(glTexParameteri GL_TEXTURE_2D
GL_TEXTURE_WRAP_T
GL_CLAMP_TO_EDGE)
Is there a simple explanation for this, or is it something in my opengl initialization or drivers? I'm on OS X 10.5 and here's some of my driver information: OpenGL vendor string: ATI Technologies Inc. OpenGL renderer string: ATI Radeon X1600 OpenGL Engine OpenGL version string: 2.0 ATI-1.5.36