Results 1 to 5 of 5

Thread: Team Colors

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2001

    Team Colors

    I'm doing a 2d game with teams.
    how would I do team colors without loading the sprites again into memory with a different color?
    probably some form of alpha blending / masking but I'm new to openGL and don't know exactly how to do this.
    I have many sprites with certain colors on them that need to change to different colors depending on which team that unit belongs to.

    I'm currently doing it with the gl texture palette extension since I only cared that the program ran on my machine, but now I want to get it to work on machines other than geForce based systems.


  2. #2

    Re: Team Colors

    This may be a terrible way to do it, but
    you could simple use a base texture that was
    white and load it with different (non-fullbright) rgb values. So, that if you wanted a blue team you could load your base texture using 0.0, 0.0, 1.0

    This may not be a good way to handle it...

  3. #3
    Senior Member OpenGL Pro
    Join Date
    Jun 2000
    Shreveport, LA, USA

    Re: Team Colors

    I can think of many ways to do what you want. However, the best way would seem to be dependent on the number of team colors that could be in use at any given time and the number of unique sprite frames. For example, if the maximum number of team colors is relatively small and fixed, then I would likely just use team specific sprites. On the otherhand, if the number of sprite frames is very large (on the order of 1 MB or more), then I would resort to a either a multipass or multitexture method. In the multipass method, you first draw the sprite to the depth buffer only using an alpha test to reject the sprite background. Then in the next pass, you draw the team color (a colored quad that is the size of the sprite) to only the color buffer using a depth function of equals. Then finally draw the sprite to the color buffer only, using an appropriate alpha blend function (so the team color shows through the translucent parts of the texture) and alpha test (to reject the sprite background). Also note that if an alpha buffer is available, the multipass method can be reduced to two passes. With multitexture hardware you can mix the team color with the base texture using the combine extension, and you'd only have to draw the sprite once.

    [This message has been edited by DFrey (edited 06-17-2001).]

  4. #4
    Senior Member OpenGL Guru zed's Avatar
    Join Date
    Nov 2010

    Re: Team Colors

    personally ild go with the unique texture for each team (if fiessable?) like Q3 does, more flexible. than with other aproaches the colour will be in the same spot for each team eg a team with red shirts + an identicle looking team with blue shirts. using diff textures u can give the red team a logo on the front of there shirts and the blue team some sort of headband for example

  5. #5
    Senior Member OpenGL Guru
    Join Date
    Mar 2001

    Re: Team Colors

    You could have one texture saved on disk, but multiple copies (with certain color changes) loaded into separate OpenGL texture objects.

Similar Threads

  1. Replies: 3
    Last Post: 06-19-2016, 08:11 AM
  2. TEAM
    By BamBamm in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 09-07-2003, 08:58 PM
  3. Developing team ?
    By jirkamelich in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 11-12-2002, 10:54 AM
  4. Need more fps in quake3 Team Arena
    By in forum OpenGL: User Software
    Replies: 1
    Last Post: 04-29-2001, 07:11 AM
  5. My team needs a manager - volunteers?
    By Schlogenburg in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 06-26-2000, 07:27 PM

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