How to delete a texture which is on a quad?

Hello trying to delete a texture off a quad and I can’t seem to figure out how to do it I tried


I even tried putting alpha information after every frame hoping that it would create a overlap but no luck

heres my code for the texture loading

void MarioRunAnimation(void)
              //First Frame

             //Mario Left Texture Enable

            glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);


            //Storage for Texture for OpenGL
            GLuint MarioLeftTexture;

            //OpenGL Generate Texture
            glGenTextures(1,&  MarioLeftTexture);
            glBindTexture(GL_TEXTURE_2D,  MarioLeftTexture);

            //Setting Up Texture

            glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, MarioRun1->w,MarioRun1->h, 0, GL_RGBA, GL_UNSIGNED_BYTE, MarioRun1->pixels);
            //Enviroment Variable for OpenGL

            //Texture Parameter information
            glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
            glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

         //X is left and right// Y is Up and Down // and Z is how far it is to the camera or not
                           //x       y        z
        //Bottom Left
        glVertex2f(0, 1);

        //bottom right

        //top right
        glVertex2f(60, 80);

        //top left


but the question is does anyone know how to delete a texture off a quad :>?

In general you can not “undo” any drawing done in OpenGL, all you can do is not draw the object in the next frame.
There is also no association between the texture and the quad, so it is not necessary to “delete the texture off the quad” (I’m just pointing this out cause that is not how OpenGL works and it’s probably not helpful to think about it that way). To have the quad drawn without the texture, you need to disable texturing:


so how would I Remove the remains off the framebuffer without deleting everything else on the framebuffer which are just textured mapped vertexes?

Usually at the start of each frame you clear the framebuffer like this,


When I do that my other vertexes on the first viewport get cleared I only want my Animated textured vertex on the second viewport to be cleared every frame how would I do that?

could someone help me? :slight_smile:

You didn’t even wait two hours to bump this.

The correct answer is redraw everything on every frame. That’s how just about every game you’ve ever seen does it. That’s how it is intended to work.

You don’t “remove” things. You simply don’t draw them the next frame. You don’t take a texture away from a quad; you draw the quad without a texture the next frame. You don’t keep pixels around from frame to frame. If you want something to appear at a location, you must draw it again and again, every frame.

That is the way of things. Restructure your code to be able to do this.

thanks alfonse you saved me alot of hassle :smiley: wait no you didn’t I want to create an animation with textures on a quad and every frame of the texture stays on the screen and the problem is I want it too not do that

this is what it looks like

image of the animation

now do you Understand what I’m asking :>
If I redraw everything which Is what I’m doing then thats fine but with the animation it is not because it stays

the last frame that was before the current frame stays on screen and this animation on this vertex is on another viewport

Texture animation doesn’t involve removing something from the framebuffer. Depending on the situation, and I assume you’re talking about moving a texture, it merely involves shifting the texture coordinates of the vertices of the quad in the desired direction to produce the illusion of movement. Draw your frame, then shift the tex coords, then draw the next frame and so on.

thanks alfonse you saved me alot of hassle. wait no you didn’t.

Sarcasm isn’t going to get you anywhere. Do you think anyone here wants to spend their time to decode your posts just to have sarcasm thrown their way?

The first few lines of your initial post reveal once more the tremendous lack of knowledge about even the most basic practices in computer graphics. I said it in another thread you started, I’ll say it again now: pick up a book and read!

it wasn’t sarcasm and that’s not what my question was I think you are getting the wrong idea I just want to know how to get rid of the remains of the animation frames on a texture on a quad. :slight_smile:

Reading a book dude Iv created my own graphical user interface using opengl and SDL don’t tell me I have no understanding of basic concepts I just don’t know what functions are needed to do what I ask so I come too you in hopes for help and you keep slagging me off like some noob or idiot who doesn’t understand without understanding the question first.

The way to “get rid” of something in a framebuffer is to just not draw it - or to draw over it, which obviously wastes resources. If you want texturing for a specific object gone, turn off texturing altogether with glDisable(GL_TEXTURE_2D).

[…] Reading a book dude Iv created my own graphical user interface using opengl and SDL don’t tell me I have no understanding of basic concepts I just don’t know what functions are needed to do what I ask so I come too you in hopes for help and you keep slagging me off like some noob or idiot who doesn’t understand without understanding the question first.

Yeah, I don’t really understand the question and I doubt anyone does because neither your code nor your depictions offer any clear description of what your problem is. I think that’s why four people don’t seem to be able to sufficiently answer your questions.

Furthermore, I don’t think you’re an idiot. I think you’re crying for help without exploiting all available resources first. And with all due respect, trying to ‘delete’ a particular portion of the framebuffer by trying to delete a texture object is simply somewhat hilarious.

Nobody who participates regularly in this board does so because they don’t want to help. But even the best intentions only go so far. You have to understand what people tell you and if they suspect that you try to handle stuff you don’t understand at its core then it’s totally legitimate to urge you to broaden your knowledge first and then come back with a specific problem you really can’t figure out.




Please someone answer that question

and Yes I know some people can’t be arsed or don’t want to be pushed to answer a question so don’t but someone out there has to know what I’m talking about with my question and be able to answer the way most people want it which is simplisty unless there a hardcore programmer and want the hardest brought to them in which case I’m shore they will say !! ??? god

grow up and become a better service stop putting yourselfs in a place of non-freedom and open up your minds think outside the box.

And don’t give me that crap about that your not paying for the service crap why even make a forum then?

Its people trying to make it difficult on purpose that’s what I think maybe its bad assumption but it bloody well feels like it .

And yes there are books out there to read but who really wants to go through a 1000page book to figure out how to do one thing sorry I’m not one of them.

I don’t get the world these days so out of wack

Identifying Help Vampires

Identifying Help Vampires can be tricky, because they look like any ordinary person (or internet user, whichever is lesser). But by closely observing an individual’s behavior using this handy checklist, you too can identify Help Vampires in the field:

[ul][li]Does he ask the same, tired questions others ask (at a rate of once or more per minute)? Yes. He didn’t even wait two hours to bump this thread.[]Does he clearly lack the ability or inclination to ask the almighty Google? Indeterminate, but there are plenty of tutorials out there. And virtually all graphics tutorials would have told him that redrawing the screen every frame is standard practice.[]Does he refuse to take the time to ask coherent, specific questions? See the original post.[]Does he think helping him must be the high point of your day? See post directly above.[]Does he get offensive, as if you need to prove to him why he should use Ruby on Rails? See post directly above.[]Is he obviously just waiting for some poor, well-intentioned person to do all his thinking for him? Indeterminate, but evidence exists to support this.[]Can you tell he really isn’t interested in having his question answered, so much as getting someone else to do his work? Indeterminate, but again, evidence suggests this.[/ul][/li]
So I’d say the evidence suggests that the Nosferatu are among us.

I would advise noobscratcher, that you calm down, take some time, and read up on how to effectively ask questions and get help (the above link on help vampirism is a good place to start). Because this? This thing you’re doing? This isn’t working. For us and for you.

And yes there are books out there to read but who really wants to go through a 1000page book to figure out how to do one thing sorry I’m not one of them.

First, you don’t read through “a 1000page book to figure out how to do one thing;” you read through a 1000 page book to learn how to do stuff correctly. If you had read through a proper programming book/tutorial, you wouldn’t have to ask this question, because you would have a firm understanding of how OpenGL works.

Second, if you’re not willing put forth at least some effort to learn on your own, why should others be willing to put forth effort to help you?


You were already told how to do what you want to do. There’s obviously some kind of communication disconnect here, and we’re not gonna be able to move forward unless we resolve it.

Alfonse I Don’t want to do all that every time I have a problem and I always try google before I come to any other person and quite a few times there’s nothing on it that is going too help me.

Its really off putting actually the lack of information coding provide s when I can just ask and get it answered in say 5-3minutes and also you have not answered my question because I don’t know how to do what you ask you just say something and then expect me to know how to do it.

That’s not the case so I ask could someone explain to me how to redraw everything all the time since While loops are just going too mess up the application.

So please if you can do anything just tell me how to redraw everything so I can just finish my game and be done with it thanks.

You may think I’m stupid for saying this but in reality I’m just trying to be honest about who I am and in the process being able to have fun with programming instead of bashing my head across because I have a lack of interest in the technicality of programming and love the visuals of programming. There are many differences between us alfonse one of them being my intrests. Please respect that for once not everyone is the same.

I have a lack of interest in the technicality of programming and love the visuals of programming

I’m afraid that if you want to further pursue graphics programming, this is mutually exclusive.

The standard approach for almost every double-buffered OpenGL app out there is:

a) Clear
b) Draw
c) Swap
d) while app is running, jump to a)

Of course during the whole thing you’re gonna have to set various other properties to make rendering work correctly.

There is something that was not suggested : you can setup a scissor and then call glClear, then render your object, and swap buffers. For that to work properly, you need to setup a proper pixelformat that preserves the back buffer on a swap.

You would need PFD_SWAP_COPY (Windows only).

Personally, I would go with Alfonse’s suggestion. You can’t go wrong with what every other software does.

Still no one has answered my question how to redraw everything all the time :D?

but thanks for the suggestion but I already tried that V-man and it just put blackness behind my player character and I couldn’t remove that

Aren’t there any moderators who can move this kind of thread out of the ADVANCED forum?