PDA

View Full Version : problems with texgen



mithun_daa
12-13-2003, 04:59 PM
i have a 2D texture that i want to be mapped onto my DL. i am having some problems. the problem is that the half the texture is being repeated. i am using the GL_REPEAT option, but i guess if i specify the 4th parameter of the coefficient right, then i dont think it should make any difference right? i have used texgen with 1D textures before and this is the first time i am using it with 2D textures. herez a piece of code that might help


currentCoeff(0) = 1 / (dblXmax - dblXmin)
currentCoeff(1) = 0#
currentCoeff(2) = 0
currentCoeff(3) = (dblActualXMin) * currentCoeff(0)
currentCoeff1(0) = 0#
currentCoeff1(1) = 1 / (dblYmax - dblYmin)
currentCoeff1(2) = 0#
currentCoeff1(3) = (dblActualYMin) * currentCoeff1(1)

glBindTexture glTexture2D, 11
glTexParameteri glTexture2D, tpnTextureWrapS, GL_REPEAT
glTexParameteri glTexture2D, tpnTextureWrapT, GL_REPEAT
glTexParameteri glTexture2D, tpnTextureMagFilter, GL_LINEAR
glTexParameteri glTexture2D, tpnTextureMinFilter, GL_LINEAR
glTexImage2D glTexture2D, 0, GL_LUMINANCE8, 256, 256, 0, tiLuminance, pxlFloat, intTexture(0)

glTexGeni GL_S, GL_TEXTURE_GEN_MODE, tgmObjectLinear
glTexGenfv GL_S, tgObjectPlane, currentCoeff(0)
glTexGeni GL_T, GL_TEXTURE_GEN_MODE, tgmObjectLinear
glTexGenfv GL_T, tgObjectPlane, currentCoeff1(0)
glTexEnvf tetTextureEnv, tenTextureEnvMode, tepDecal

thank u

mithun_daa
12-14-2003, 08:21 PM
someone? anyone??????????

jwatte
12-14-2003, 08:31 PM
It's somewhat un-clear what you're trying to do, and what the actual problem you're seeing is.

Let me take a guess: you need to negate the value of your (3) coefficients.

mithun_daa
12-15-2003, 05:25 AM
Originally posted by jwatte:
It's somewhat un-clear what you're trying to do, and what the actual problem you're seeing is.

Let me take a guess: you need to negate the value of your (3) coefficients.

im sorry for being unclear. the problem is that the texture is not being mapped right. the left half of the texture is mapped on the right and the right half on the left.the same with the y-axis too. this is because im not setting the (3) coeff right. is the way that i adopted the right way to do it(as with 1D tex), or is it different for 2D textures?

mithun_daa
12-15-2003, 06:50 AM
Originally posted by jwatte:
It's somewhat un-clear what you're trying to do, and what the actual problem you're seeing is.

Let me take a guess: you need to negate the value of your (3) coefficients.

thanx, that worked for me. could u plz explain why i have to giv -ve values ? cause in 1D textures i didnt need to do this.