Stack overflow in glTexImage2D

Hi,

I’m trying to load a texture and to generate a texture object with it, but my code stops execution and says during runtime that I have a stack overflow. The debugger tells that the problem is in the line in which I call glTexImage2D with the texture.

Does somebody know what can it be?

Miguel

A snippet of code would make it easier to tell what was wrong. At least show us the problem line.

Hi,

Here is the part of the code which generates the texture object. Previously I have loaded into the pBMP pointer the texture.

call glGenTextures(1_glsizei, instruments_textures)
call glBindTexture(GL_TEXTURE_2D, instruments_textures(1))

call glPixelStorei(GL_UNPACK_ALIGNMENT, 1)
call glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT)
call glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT)
call glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
call glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)

call glTexImage2D(GL_TEXTURE_2D, 0_glint, GL_RGB, int(BMPInfo%IWidth,glsizei), &
int(BMPInfo%IHeight,glsizei), 0_glint, GL_RGB, &
GL_UNSIGNED_BYTE, pBMP)

call glBindTexture(GL_TEXTURE_2D, 0_gluint)

As you can see it is written in Fortran90, not in C.

Thanks in advance for your help

Miguel

It has been nearly 20 years since I last programmed in Fortran (Fortran77) so I’m not up to speed with the syntax anymore, but it looks like your problem may be the texture width and height. Those must always be a power of 2, and I can’t tell that they always are from what is shown.

Hi,

I also thought that it could be the width and height of the texture, but both are powers of 2. It is very strange because I have also written other codes with textures and I allways have the same problem <?>.

Miguel