Skip to main content
gamedev.net
🔒 Locked

Sorting and rendering by Effect

Started by littlekid 0 replies 550+ views
Original Post
littlekid
littlekid
I have sorted the items that I wish to draw by their Effect ID, but how should draw these groups of items with similar effects? Is it done this way: Effect->Begin(); Effect->BeginPass(); SetVB/IB and constants for Object1 DrawObject1 Effect->EndPass(); Effect->BeginPass(); SetVB/IB and constants for Object2 DrawObject2 Effect->EndPass(); Effect->End(); or should I do it: SetVB/IB and constants for Object1 Effect->Begin(); Effect->BeginPass(); DrawObject1 Effect->EndPass(); Effect->End(); Repeat for next few objects Which is the correct method to render the objects that have been sorted by Effect?
smally
smally
I've come up to this problem as well and am not so sure as to what the best method is.

The two ways you've described are both correct really, it does the same thing.
You'll probably want to do:
Effect->Begin();Effect->BeginPass(0);SetVB/IB and constants for Object1DrawObject1SetVB/IB and constants for Object2DrawObject2Effect->EndPass();Effect->End();

instead

That is how I am doing it for my small programs (and that is how i see most samples over the internet do it). But for my game I am making, with the way it is structured, for now I am having resort to the second method you described.

Hopefully someone in these forums can provide an answer.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.