Re: Texture problem
- From: Andy V <Nobody@xxxxxxxxxxx>
- Date: Wed, 14 Jun 2006 22:40:09 -0400
delisonews@xxxxxxxxx wrote:
I am trying to apply a texture to a mesh of quads but with no success.
In another words, the mesh stays bland, illuminated with just the
ambient color. I simply can't discover the reason for the texture not
showing up. Could you please list some obvious reasons for this
happening?
Long story short, I have a C++ class MyTexture. In its constructor
MyTexture::MyTexture(string filename) I open the file, fill the array
with bitmap data, call glGenTextures(), glBindTexture() and
glTexImage2D(). In its destructor I call delete[] bitmap data and
glDeleteTextures().
Do you ensure that you have an active OpenGL context when the constructor
is called?
Unless you are using it for your own purposes, you could delete[] the bitmap
data just after the glTexImage2D call.
Are the width and height powers of two?
In the main method activate() I set GL_REPEAT,
GL_MODULATE, environment color, GL_EYE_PLANE for s and GL_EYE_PLANE for
t, and filter GL_LINEAR, GL_LINEAR. Finally, I draw the mesh.
Do you enable texture mapping sometime?
I followed all the known tutorials (like NeHe etc) to a word, but
simply can't get it to work. Thanks.
At least you have something visible on the screen -- that makes things easier.
--
Andy V
.
- References:
- Texture problem
- From: delisonews
- Texture problem
- Prev by Date: Texture problem
- Next by Date: Re: Texture problem
- Previous by thread: Texture problem
- Next by thread: Re: Texture problem
- Index(es):
Relevant Pages
|
Loading