开发者

Texture mapping problems with OpenGL

I'm having some problems mapping textures with OpenGL. Here's the link to the model which I'm currently trying load correctly with these textures.

Now here's a link to a directory where all the related files are: http://karvis.kapsi.fi/

The problem can be seen from the img1.jpg

That area I've marked with red is not supposed to be mapped with texture as you can see from the 3d warehouse model. Problem is that for some reason whole model gets mapped though there should be also areas without textures. There's also that same model without textures: img2.jpg

And there's the code I'm compiling: main.cpp. I'm using Asset Import Library for importing Collada models and FreeImage for converting images to RGB-format.

Does anyone开发者_高级运维 know why this is happening? Maybe I'm passing wrong parameters to OpenGL or is it with the way I load these textures or something?


Before rendering a texture, you need to do :

glEnable(GL_TEXTURE_2D);
glBindTexture(...);
//render the texture

After finished rendering a texture, you need to disable a texture :

glDisable( GL_TEXTURE_2D );

All I see in your code that you enable 2d texture at the start of the program.

Looking further through your code, check if this :

if(mesh->HasTextureCoords(0))

return true or false for area where you don't want textures to be rendered.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜