Jump to content
  • Advertisement
Sign in to follow this  
CyberSlag5k

Materials aren't stored in display lists, right?

This topic is 4865 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm pretty sure they aren't, but I'd just like to confirm it. Calling glMaterialfv() while creating a display list just sets the material then and there and it will change if new materials are set before the display list is actually drawn, right?

Share this post


Link to post
Share on other sites
Advertisement
no, they should be stored in the display list as they are part of the server state, not the client state. Chapter 7 of the Red Book mentions that storing material infomation in a DL is a good idea.

Share this post


Link to post
Share on other sites
Well I'll be. You're right. State changes persist even after the display list is called. That's a handy piece of info to have, as one could very well be changing the same materials back and forth multiple times needlessly amongst display lists, suffering a big ol' performance hit by doing so.

Thanks, phantom

Share this post


Link to post
Share on other sites
Quote:
Original post by _the_phantom_
ofcourse i'm right, tsk! as if there would be any doubt about this [wink]


How could one ever doubt you, oh mighty moderator :P

Here's another one for you. I was reporting in to my boss that I had finished my present project and while doing so I commented to him that I had disabled blending (which for the life of me I cannot figure out why was enabled to begin with) so what I'm drawing doesn't appear see-through. He said I shouldn't have to and that I should just try mirroring his material values from another part of the program. I didn't really think that made a whole lot of sense, but they don't pay me to think (well, they do, of course), so I said I'd try it.

And wouldn't you know, it worked! I'm really at a loss on this one. With my old material values (something like grey for diffuse and ambient and white for specular), the part is translucent. With my boss's values (0.5 for all three speculars, 0.12 for the ambients, and 0.6 for the diffuse's) the object is opaque. What's up with that? How can setting materials a certain way remove the blending effect? Perhaps there's something I don't know about materials or blending...?

Share this post


Link to post
Share on other sites
there was probably something in interactions which caused it, without seeing the two bits of code and whats going on before them I couldnt really say.

however, if you dont require blending you should really disable it, as with it on writing to the frame buffer becomes a read-modifiy-write setup, with it off its just a write, which can be alot faster.

Share this post


Link to post
Share on other sites
Interactions? It's not terribly important, I just find it very odd that it worked.

Yeah, I wish we could disable blending, at least at the end of the function that enabled it (I have leaving things like that opened as it causes problems down the line). I doubt I'll be given the go ahead, as the general rule is "If it's not broke, don't fix it."

Oh well. Thanks again, phantom.

Share this post


Link to post
Share on other sites
Quote:
Original post by CyberSlag5k

Here's another one for you. I was reporting in to my boss that I had finished my present project and while doing so I commented to him that I had disabled blending (which for the life of me I cannot figure out why was enabled to begin with) so what I'm drawing doesn't appear see-through. He said I shouldn't have to and that I should just try mirroring his material values from another part of the program. I didn't really think that made a whole lot of sense, but they don't pay me to think (well, they do, of course), so I said I'd try it.

And wouldn't you know, it worked! I'm really at a loss on this one. With my old material values (something like grey for diffuse and ambient and white for specular), the part is translucent. With my boss's values (0.5 for all three speculars, 0.12 for the ambients, and 0.6 for the diffuse's) the object is opaque. What's up with that? How can setting materials a certain way remove the blending effect? Perhaps there's something I don't know about materials or blending...?


With lighting enabled the pre-texture source alpha value comes from the diffuse material color. (see pg 63 in the ogl 2.0 spec) If it's set to something less than 1.0 this could cause objects to appear transparent when they should be opaque, depending on your blending equation. My guess would be this is the difference between the two sets of materials. I agree with Phantom though that it's probably best to disable blending when drawing opaque objects.

Share this post


Link to post
Share on other sites
Quote:
Original post by Solias
Quote:
Original post by CyberSlag5k

Here's another one for you. I was reporting in to my boss that I had finished my present project and while doing so I commented to him that I had disabled blending (which for the life of me I cannot figure out why was enabled to begin with) so what I'm drawing doesn't appear see-through. He said I shouldn't have to and that I should just try mirroring his material values from another part of the program. I didn't really think that made a whole lot of sense, but they don't pay me to think (well, they do, of course), so I said I'd try it.

And wouldn't you know, it worked! I'm really at a loss on this one. With my old material values (something like grey for diffuse and ambient and white for specular), the part is translucent. With my boss's values (0.5 for all three speculars, 0.12 for the ambients, and 0.6 for the diffuse's) the object is opaque. What's up with that? How can setting materials a certain way remove the blending effect? Perhaps there's something I don't know about materials or blending...?


With lighting enabled the pre-texture source alpha value comes from the diffuse material color. (see pg 63 in the ogl 2.0 spec) If it's set to something less than 1.0 this could cause objects to appear transparent when they should be opaque, depending on your blending equation. My guess would be this is the difference between the two sets of materials. I agree with Phantom though that it's probably best to disable blending when drawing opaque objects.


Wow, thanks. I'll look into how we're doing the blending.

And yeah I know, I'd disable the blending if I could (providing it's not actually being used somewhere, but when I killed it earlier nothing appeared affected). Still, I am but a humble intern and so no doubt shall be smote vigorously should I press the matter.

Thanks, Solias!

Share this post


Link to post
Share on other sites
personally I'd press the matter and point out that you are wasting fillrate by performing a blend when a blend isnt required. There could be a reason for it being like that, but personally I'd have thought that a default of 'only turn it on when its needed' would be better than having it on all the time.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!