cheers mate.
im trying somthing like this now to create a normals map.
sub GenNormalizationCubeMap( byval size as integer, byval texid as GLuint )
dim ImageData as ubyte ptr
dim as single offset = 0.5f , halfSize = size * 0.5f
dim as double temp(0 to 2) , d
dim as integer bytePtr = 0
ImageData = allocate( size*size*3 )
glGenTextures( 1 , @texid )
glBindTexture( GL_TEXTURE_CUBE_MAP , texid )
for j=0 to size
for i=0 to size
temp(0) = halfSize
temp(1) = j+offset-halfSize
temp(2) = -(i+offset-halfSize)
d=1.0/sqr(temp(0)^2+temp(1)^2+temp(2)^2)
temp(0)*=d
temp(1)*=d
temp(2)*=d
ImageData[bytePtr] = (temp(0)+1.0) * 127.0f
ImageData[bytePtr+1] = (temp(1)+1.0) * 127.0f
ImageData[bytePtr+2] = (temp(2)+1.0) * 127.0f
bytePtr += 3
next
next
glTexImage2D( GL_TEXTURE_CUBE_MAP_POSITIVE_X , 0 , GL_RGB8 , size , size , 0 , GL_RGB , GL_UNSIGNED_BYTE , ImageData )
bytePtr = 0
for j=0 to size
for i=0 to size
temp(0) = -halfSize
temp(1) = j+offset-halfSize
temp(2) = i+offset-halfSize
d=1.0/sqr(temp(0)^2+temp(1)^2+temp(2)^2)
temp(0)*=d
temp(1)*=d
temp(2)*=d
ImageData[bytePtr] = (temp(0)+1.0) * 127.0f
ImageData[bytePtr+1] = (temp(1)+1.0) * 127.0f
ImageData[bytePtr+2] = (temp(2)+1.0) * 127.0f
bytePtr+=3
next
next
glTexImage2D( GL_TEXTURE_CUBE_MAP_NEGATIVE_X , 0 , GL_RGB8 , size , size , 0 , GL_RGB , GL_UNSIGNED_BYTE , ImageData )
bytePtr = 0
for j=0 to size
for i=0 to size
temp(0) = i + offset - halfSize
temp(1) = -halfSize
temp(2) = j + offset - halfSize
d=1.0/sqr(temp(0)^2+temp(1)^2+temp(2)^2)
temp(0)*=d
temp(1)*=d
temp(2)*=d
ImageData[bytePtr] = (temp(0)+1.0) * 127.0f
ImageData[bytePtr+1] = (temp(1)+1.0) * 127.0f
ImageData[bytePtr+2] = (temp(2)+1.0) * 127.0f
bytePtr += 3
next
next
glTexImage2D( GL_TEXTURE_CUBE_MAP_POSITIVE_Y , 0 , GL_RGB8 , size , size , 0 , GL_RGB , GL_UNSIGNED_BYTE , ImageData )
bytePtr = 0
for j=0 to size
for i=0 to size
temp(0) = i+offset-halfSize
temp(1) = halfSize
temp(2) = -(j+offset-halfSize)
d=1.0/sqr(temp(0)^2+temp(1)^2+temp(2)^2)
temp(0)*=d
temp(1)*=d
temp(2)*=d
ImageData[bytePtr] = (temp(0)+1.0) * 127.0f
ImageData[bytePtr+1] = (temp(1)+1.0) * 127.0f
ImageData[bytePtr+2] = (temp(2)+1.0) * 127.0f
bytePtr += 3
next
next
glTexImage2D( GL_TEXTURE_CUBE_MAP_NEGATIVE_Y , 0 , GL_RGB8 , size , size , 0 , GL_RGB , GL_UNSIGNED_BYTE , ImageData )
bytePtr = 0
for j=0 to size
for i=0 to size
temp(0) = i+offset-halfSize
temp(1) = (j+offset-halfSize)
temp(2) = halfSize
d=1.0/sqr( (temp(0)^2) + (temp(1)^2) + (temp(2)^2) )
temp(0)*=d
temp(1)*=d
temp(2)*=d
ImageData[bytePtr] = (temp(0)+1.0) * 127.0f
ImageData[bytePtr+1] = (temp(1)+1.0) * 127.0f
ImageData[bytePtr+2] = (temp(2)+1.0) * 127.0f
bytePtr += 3
next
next
glTexImage2D( GL_TEXTURE_CUBE_MAP_POSITIVE_Z , 0 , GL_RGB8 , size , size , 0 , GL_RGB , GL_UNSIGNED_BYTE , ImageData )
bytePtr = 0
for j=0 to size
for i=0 to size
temp(0) = -(i+offset-halfSize)
temp(1) = (j+offset-halfSize)
temp(2) = -halfSize
d=1.0/sqr(temp(0)^2+temp(1)^2+temp(2)^2)
temp(0)*=d
temp(1)*=d
temp(2)*=d
ImageData[bytePtr] = (temp(0)+1.0) * 127.0f
ImageData[bytePtr+1] = (temp(1)+1.0) * 127.0f
ImageData[bytePtr+2] = (temp(2)+1.0) * 127.0f
bytePtr += 3
next
next
glTexImage2D( GL_TEXTURE_CUBE_MAP_NEGATIVE_Z , 0 , GL_RGB8 , size, size , 0, GL_RGB, GL_UNSIGNED_BYTE, ImageData )
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE)
end sub
but when i display the texture it creates its all white ie it wont do anything when i try and run a light over it.