Re: Texture problem



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
.



Relevant Pages

  • Re: Texture problem
    ... I simply can't discover the reason for the texture not ... showing up. ... In its destructor I call deletebitmap data and ... Finally, I draw the mesh. ...
    (comp.graphics.api.opengl)
  • Texture problem
    ... I am trying to apply a texture to a mesh of quads but with no success. ... I simply can't discover the reason for the texture not ... In its destructor I call deletebitmap data and ...
    (comp.graphics.api.opengl)
  • Re: Texture problem
    ... ambient color. ... I simply can't discover the reason for the texture not ... Finally, I draw the mesh. ...
    (comp.graphics.api.opengl)
  • Re: Problem Loading Simple Mesh
    ... like it isn't shading the object, but just appling the texture so the object ... //globabl variables for the mesh ... Mesh\Sample\tiger.x", MeshFlags.SystemMemory, device, out materials); ... //used to render the mesh to backbuffer ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: Can Microsoft people answer my last post, please?
    ... Microsoft DirectX MVP 1998-2006 ... and a mesh. ... chapter of a book to disable texture colores and alpha. ... State the basis of your problem, i.e. when rendering a triangle list ...
    (microsoft.public.win32.programmer.directx.graphics)

Loading