Skip to main content
GameDev.net gamedev.net
🔒 Locked

Vertex Texture Problem

Started by Last Attacker Sep 23, 2006 at 11:43 AM 1 replies 750+ views
Original Post
Last Attacker
Last Attacker
Hi guys, I have made a lot of progress with my geometry clipmaps implementation but I have a small problem that I just can't figure out. I am using displacement mapping with VBOs for implementing my geometry clipmaps algo. When mapping my vertex texture I do the following to load my texture:

//Width - Image Width
//Height - Image Height
//colorMode - RGB, RGBA or LUMINANCE (Its an enum without GL_ prefix)
//Data - Image Data
gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA_FLOAT32_ATI, Width, Height, colorMode, GL_UNSIGNED_BYTE, Data);

It works like that and it gives me this output: But... when I do it like this:

//Width - Image Width
//Height - Image Height
//colorMode - RGB, RGBA or LUMINANCE (Its an enum without GL_ prefix)
//Data - Image Data
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA_FLOAT32_ATI, Width, Height, 0, colorMode, GL_UNSIGNED_BYTE, Data);

It comes out like this: Totally flat. No terrain at all. What you see above is multilple layers in wireframe mode with different colors to highlight the different layers. My Data variable is a 8-bpp 256x256 image. Any ideas why it could do this? Thanks
"Take delight in the Lord and He will give you your heart's desires" - Psalm 37:4My Blog
Brother Bob
Brother Bob
Don't know if vertex textures are different than the, well, "regular" textures, but if they are not, then the minification filter is usually the problem in this kind of scenario.

Default minification filter requires a complete mipmap set or the texture object isn't valid. gluBuild2DMipmaps builds the entire set, but glTexImage2D don't. You need to manually build the missing mipmap levels, enable automatic mipmap generation, or set the minification filter to something that doesn't require mipmaps.
Last Attacker
Last Attacker
Cool, thanks Brother Bob.
I did the following and it worked:

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);

||
\/

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

EDIT:

I had this previously:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
"Take delight in the Lord and He will give you your heart's desires" - Psalm 37:4My Blog

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.