Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Deleting textures

luhnthluhnth Member Posts: 78
I made some code to make textures with C++ and OpenGL. The textures are store in this variable:
[code]
GLuint *TextureImage;
[/code]
I use this code to delete all the textures:
[code]
glDeleteTextures(numTex,TextureImage);
[/code]

How do I delete one texture in TextureImage? I tried this, but it didn't work:
[code]
glDeleteTextures(1,TextureImage[num]);
[/code]

Can someone help me?



Best Regards,
CodeKing

Comments

  • luhnthluhnth Member Posts: 78
    P.S. Is there any good tutorials for displaying ms3d files with OpenGL C++?
  • gautamgautam Member Posts: 642
    If you see the prototype for glDeleteTextures it is

    [code]
    glDeleteTextures(int, GLuint *);
    [/code]


    So if you want to delete 1 texture and as the prototype takes a pointer, you need to send its memory address. With an array you are automatically doing this as in for an array *a = a[0] = a. Now if you want to send it one element, its memory address is sent by using the & operator. So you will have to do

    [code]
    glDeleteTextures(1, &TextureImage[num]);
    [/code]

    : I made some code to make textures with C++ and OpenGL. The textures are store in this variable:
    : [code]
    : GLuint *TextureImage;
    : [/code]
    : I use this code to delete all the textures:
    : [code]
    : glDeleteTextures(numTex,TextureImage);
    : [/code]
    :
    : How do I delete one texture in TextureImage? I tried this, but it didn't work:
    : [code]
    : glDeleteTextures(1,TextureImage[num]);
    : [/code]
    :
    : Can someone help me?
    :
    :
    :
    : Best Regards,
    : CodeKing
    :

Sign In or Register to comment.