Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: environment color vs. primary color

  1. #1
    Senior Member Frequent Contributor
    Join Date
    Oct 2009
    Posts
    592

    environment color vs. primary color

    This is very outdated, I know, but please write your opinion. Which color do you think is better for use in a TU, if you can use both equally well. I can't find anything on google.

    My take: if primary colors are specified, they are interpolated, but the environment color is constant so it may be better to use environment color.

  2. #2
    Senior Member OpenGL Lord
    Join Date
    Mar 2015
    Posts
    6,671

    Re: environment color vs. primary color

    Which color do you think is better for use in a TU, if you can use both equally well.
    What do you mean by "better?"

    The environment color is a constant. The per-vertex color is per-vertex. Which you use is a matter of what you're doing.

  3. #3
    Senior Member Frequent Contributor arekkusu's Avatar
    Join Date
    Nov 2003
    Posts
    890

    Re: environment color vs. primary color

    Some hardware in recent memory (the Imagination MBX) has issues with the environment color:

    * the environment color should be unique for each texture unit, but isn't.
    * the environment color is stored in lower precision than the primary color.

    So, it depends on your use pattern. But environment color has some disadvantages on some hardware.

  4. #4
    Senior Member Frequent Contributor
    Join Date
    Oct 2009
    Posts
    592

    Re: environment color vs. primary color

    * the environment color is stored in lower precision than the primary color.
    Really? Where do the GL specs specify this?

    I've already heard about the MBX oddity, but with that GPU, there are only 2 TUs, so you can use primary color for one TU and the environment color for another.

    Alfonse, I specified: if you can use both equally well. That is, you can choose to either use the environment color or the primary color to achieve the same result.

  5. #5
    Senior Member OpenGL Lord
    Join Date
    Mar 2015
    Posts
    6,671

    Re: environment color vs. primary color

    Where do the GL specs specify this?
    They don't; he's talking about the vagaries of a particular piece of hardware.

    Alfonse, I specified: if you can use both equally well. That is, you can choose to either use the environment color or the primary color to achieve the same result.
    "If you can use both equally well" means that the per-vertex color is a constant. Therefore, you are passing per-vertex data that is not necessary. If you're rendering with vertex arrays, this means having to pull extra data for every vertex. That's a waste of space and bandwidth for every draw call.

  6. #6
    Senior Member Frequent Contributor
    Join Date
    Oct 2009
    Posts
    592

    Re: environment color vs. primary color

    Even if he is talking about the specifics of the MBX GPU, his statement needs to have come from some specs.

    "If you can use both equally well" means that the per-vertex color is a constant. Therefore, you are passing per-vertex data that is not necessary. If you're rendering with vertex arrays, this means having to pull extra data for every vertex. That's a waste of space and bandwidth for every draw call.
    What if you call glColor*() instead?

  7. #7
    Senior Member OpenGL Lord
    Join Date
    Mar 2015
    Posts
    6,671

    Re: environment color vs. primary color

    Even if he is talking about the specifics of the MBX GPU, his statement needs to have come from some specs.
    No they don't. They could come from personal experience. Or a post on a forum. There's nothing in any specification that says immediate mode is slower than using vertex arrays for rendering, but it's almost guaranteed to be true.

    There's a lot of unspecified knowledge you need when dealing with hardware like GPUs.

    What if you call glColor*() instead?
    If it's part of immediate mode, then you're using immediate mode. Since you have chosen to use immediate mode, performance must clearly not be much of a concern. So the difference is irrelevant.

    If it's part of array rendering, using a constant attribute with arrays, then it's implementation dependent. However, it is clear that this kind of thing is not done often by users, so it's not likely to be a case that driver writers optimize for. Benchmark it if you want, but you probably won't find any performance improvements.

  8. #8
    Senior Member Frequent Contributor
    Join Date
    Oct 2009
    Posts
    592

    Re: environment color vs. primary color

    No they don't. They could come from personal experience. Or a post on a forum. There's nothing in any specification that says immediate mode is slower than using vertex arrays for rendering, but it's almost guaranteed to be true.
    Sometimes they do. The environment color limitation of the MBX is well documented.

    glColor*() is not necessarily part of the immediate mode. You can call it outside of the glBegin()/glEnd() code block.

  9. #9
    Newbie OpenGL Pro
    Join Date
    Jan 2007
    Posts
    1,789

    Re: environment color vs. primary color

    Quote Originally Posted by ugluk
    glColor*() is not necessarily part of the immediate mode. You can call it outside of the glBegin()/glEnd() code block.
    That's not really relevant, you can call glNormal, glTexCoord, etc outside of a Begin/End block too. All that that they do is specify a current colour/normal/texcoord which is then picked up and transferred to the GPU when you call glVertex.

    But on the other hand, you can also use these functions with vertex arrays if you wish, and they'll work fine. Obviously you won't be able to use per-vertex colours/normals/texcoords but if doing so floats your boat...

    I don't know if they work with VBOs and nor do I feel inclined to find out.

  10. #10
    Senior Member Frequent Contributor
    Join Date
    Oct 2009
    Posts
    592

    Re: environment color vs. primary color

    I don't know if they work with VBOs and nor do I feel inclined to find out. wink
    They do.

Page 1 of 2 12 LastLast

Similar Threads

  1. Rainbow color band and color palettes in OpenGL?
    By rakeshthp in forum OpenGL: Basic Coding
    Replies: 11
    Last Post: 01-15-2013, 01:57 AM
  2. Replies: 7
    Last Post: 09-10-2004, 07:02 AM
  3. High color/true color troubles on Win2000
    By Lelik in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 06-22-2004, 04:39 AM
  4. How to show object-color through light-color?
    By jonn in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 01-18-2001, 09:25 PM
  5. color buffer color as source for register combiners
    By Kosta in forum OpenGL: General
    Replies: 1
    Last Post: 07-11-2000, 09:47 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