GLTexImage2D crash

BlitzMax Forums/OpenGL Module/GLTexImage2D crash

JoshK(Posted 2006) [#1]
Simple code for generating mipmap levels, plus some debug info:
For buffer:tbank=EachIn mipmaps
	programlog "Mipmap "+n+" ( "+mw+" x "+mh+" )"+" ( "+buffer.size()+" )"
	glTexImage2D GL_TEXTURE_2D,n,glinternalformat,mw,mh,0,format,GL_UNSIGNED_BYTE,BankBuf(buffer)
	n=n+1
	mw=mw/2
	mh=mh/2
Next


Program log records this:
Loading texture "D:\Projects\engine\Textures\ldd\walls\sidewalk1.stf"...
Mipmap 0 ( 512 x 512 ) ( 786432 )
Mipmap 1 ( 256 x 256 ) ( 196608 )

A crash occurs when I attempt to set the second mipmap level. All the data seems in correct order. The formats are both GL_RGB.

I have no idea what is wrong. This is very simple, and should not be crashing.


Defoc8(Posted 2006) [#2]
looks fine to me..assuming

n is a valid mipindex, 0..n - GLint level
glinternalformat=3 - GLint components
mw&mh are power of 2 + square.
format=GL_RGB - GLenum format.

yup..i dont see how this could fail....are you sure your banks
are sized correctly? - i can only think your having memory
access problems..


JoshK(Posted 2006) [#3]
I had to fix that glpixelstore setting. I have never even had to use that one before blitzmax.