Will throw a segmentation fault about 50% of the time. However, if I do something as simple as changing the height to ‘25’, then it doesnt segfault at all.
This is just a simple snippet, as I would get the error with my loaded textures, but I just did a gray chunk here for demonstration.
texformat may either be GL_RGBA8 or GL_ALPHA8. rw and rh are the correct dimensions of a texture (power of 2 normally except when non-power of 2 textures are supported.)
When I allocate buffer to the exact size of rw*rh I get regular crashes inside the OpenGL code. When I allocate one line more than needed it works on NVidia cards but on some ATIs it still crashes on occasion.
Originally posted by Ketracel White:
[b]Since this thread already exists I might as easily ask here. I have a strange problem with glTexImage2D that also creates some crashes on occasion.
texformat may either be GL_RGBA8 or GL_ALPHA8. rw and rh are the correct dimensions of a texture (power of 2 normally except when non-power of 2 textures are supported.)
When I allocate buffer to the exact size of rw*rh I get regular crashes inside the OpenGL code. When I allocate one line more than needed it works on NVidia cards but on some ATIs it still crashes on occasion.[/b]
There has to be some error in your code. But from this one line its not clear where it is. Maybe you should show more ( especialy memory allocation of your buffer )
Originally posted by Ketracel White:
[b]Since this thread already exists I might as easily ask here. I have a strange problem with glTexImage2D that also creates some crashes on occasion.
texformat may either be GL_RGBA8 or GL_ALPHA8. rw and rh are the correct dimensions of a texture (power of 2 normally except when non-power of 2 textures are supported.)
When I allocate buffer to the exact size of rwrh I get regular crashes inside the OpenGL code. When I allocate one line more than needed it works on NVidia cards but on some ATIs it still crashes on occasion.[/b]
Are you making sure that you always allocate rwrh*4 bytes for your buffer? You are specifying GL_RGBA for your clientside format.
You mention that the buffer is allocated in “Several places,” are you sure that when it is allocated prior to a glTexImage2D call that the values of rh and rw do not change?