Results 1 to 4 of 4

Thread: Removing remains

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2011
    Location
    East Riding of Yorkshire
    Posts
    3

    Removing remains

    Ok so I'm making a game to do with pies and ants and its all going well until I need to delete the remains left behind after killing the ants.
    so what I need to do is either remove the remains after a certain time or my idea was have 10 remains on the screen at a time, so I need to delete the oldest remains and replace it with new ones, and I don't have a clue.

    I don't really care how it's solved whether I use a timer or my suggestion but Its kind of urgent

    I am also having trouble with the blending of the texture. I used the same code for the live ants, the only difference is the ants don't move and it's only drawing white area of the mask, however if another ant dies over the top it draws the texture on the overlaid part.

    Appreciate any help
    405290

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: Removing remains

    (not opengl) Store creation time or creation index for each remain.
    Then whenever you add a remain after the 10 first, delete the oldest and replace it with the new one. Or store the creation date, and each frame delete all remains older than x. Even better, do both.

    For your texture issue, no idea of what is your problem.
    Post your blend func, details about your textures (do they have alpha), and ideally too, an image showing the problem.

  3. #3
    Junior Member Newbie
    Join Date
    Dec 2011
    Location
    East Riding of Yorkshire
    Posts
    3

    Re: Removing remains

    Here is pretty much all I consider useful code (I am a complete dunce when it come to technical stuff)




    GL.glDisable(GL.GL_DEPTH_TEST);
    GL.glEnable(GL.GL_TEXTURE_2D);

    GL.glEnable(GL.GL_BLEND);





    GL.glBlendFunc(GL.GL_DST_COLOR, GL.GL_ZERO);
    GL.glBindTexture(GL.GL_TEXTURE_2D,m_maskID );


    GL.glBegin(GL.GL_QUADS);

    GL.glTexCoord2f(0f, 0f);
    GL.glVertex2f(pos.X, pos.Y + height);

    GL.glTexCoord2f(1f, 0f);
    GL.glVertex2f(pos.X, pos.Y);

    GL.glTexCoord2f(1f, 1f);
    GL.glVertex2f(pos.X + width, pos.Y);

    GL.glTexCoord2f(0f, 1f);
    GL.glVertex2f(pos.X + width, pos.Y + height);


    GL.glEnd();


    GL.glBlendFunc(GL.GL_ONE, GL.GL_ONE);
    GL.glBindTexture(GL.GL_TEXTURE_2D, m_textureID);

    GL.glBegin(GL.GL_QUADS);

    GL.glTexCoord2f(0f, 0f);
    GL.glVertex2f(pos.X, pos.Y + height);

    GL.glTexCoord2f(1f, 0f);
    GL.glVertex2f(pos.X, pos.Y);

    GL.glTexCoord2f(1f, 1f);
    GL.glVertex2f(pos.X + width, pos.Y);

    GL.glTexCoord2f(0f, 1f);
    GL.glVertex2f(pos.X + width, pos.Y + height);

    GL.glEnd();

    GL.glEnable(GL.GL_DEPTH_TEST);
    GL.glDisable(GL.GL_TEXTURE_2D);

    GL.glDisable(GL.GL_BLEND);


    GL.glPopMatrix();

  4. #4
    Junior Member Newbie
    Join Date
    Dec 2011
    Location
    East Riding of Yorkshire
    Posts
    3

    Re: Removing remains

    Problem solved, not sure how but well it works.

Similar Threads

  1. Replies: 492
    Last Post: 03-30-2009, 10:29 PM
  2. HELP! dialog outline remains after screen draw
    By rjh57 in forum OpenGL: Advanced Coding
    Replies: 10
    Last Post: 08-15-2002, 01:52 AM
  3. WinXP becomes Dull when remains idle for long
    By immy in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 07-24-2002, 10:59 PM
  4. my OpenGL window remains busy and white... why ?
    By Alexouin in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 11-26-2000, 04:27 PM
  5. Texture remains black
    By even_steven in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 09-23-2000, 09:29 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean