Re: Texture problem
- From: "forkazoo" <wrosecrans@xxxxxxxxx>
- Date: 15 Jun 2006 08:59:52 -0700
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(). 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.
I followed all the known tutorials (like NeHe etc) to a word, but
simply can't get it to work. Thanks.
Well, it sounds like you could have problems in several places. My
first suspicion would be the file loading code. So, you may want to
try making a simple bitmap in memory. 128*128. It could even be a
solid color, but some sort of simple pattern would be better. Stripes
is quite easy to program. Then, try using this instead of a texture
from a file. If this works, then we know it isn't related just to
OpenGL.
If it doesn't, add lots of calls to see if there is any OpenGL error.
Make sure you aren't trying to upload the texture before you have a
context, or something like that. Or, that you are running out of
memory on texture upload because it is too big, or something.
Now, start picking through your code, and reduce the complexity to
something as simple as possible. make sure you enable GL_TEXTURE_2D.
Make sure you are using MIP levels appropriately, or have it turned
off.
At least, that's how I would approach trying to narrow down the problem.
.
- References:
- Texture problem
- From: delisonews
- Texture problem
- Prev by Date: Re: uv coordinates???
- Next by Date: Re: RE:Conversion problem between 3Dmax and Maya
- Previous by thread: Re: Texture problem
- Next by thread: RE:Conversion problem between 3Dmax and Maya
- Index(es):
Loading