Skip to main content
gamedev.net
🔒 Locked

correct render loop?

Started by aphydx May 9, 2003 at 12:03 PM 2 replies 750+ views
Original Post
aphydx
aphydx
here''s my general algorithm please tell me what you think .. for(every texture) if(texture.used) { dev->settexture(texture); // meshes can use only one texture for(every mesh using this texture) if(mesh.used) { dev->setstreamsource(mesh); // change dev fvf if necessary for(every frame using this mesh) if(frame.visible) { dev->setworldmatrix(frame.mtx); mesh->render; } } } -- the whole point is to be able to switch to vertex shaders easily .. it boils down to whether texture changes or stream source changes are more expensive
bpopp
bpopp
>>Don''t think about performance and optimizations at the start of your project

Ack. I totally disagree. Unless your code is purely prototype and you have no intention of using it, I would put a lot of thought initially into design and performance.

Your pseudocode looks right to me. That''s exactly how I''m planning on setting up my engine when I rewrite it.
Illumini
Illumini
Yea I agree with both AP and bpopp on this.

Optimizing extensively early on is BAD.

However, what your talking about is a DESIGN issue. Some people don''t see the difference between Designing properly and Optimization.


Not calling excesive set texture''s, is a crucial part of getting a engine running even reasonably.

If you just brute forced throguh all meshes and textured each one you would might need to totally change your design when it came to optimizing. (eg if you let the client call engine->draw, instead of having them add all the meshes to the engine and letting the engine sort it out.)

Based on your psuedocode it seems your on the right track

Topic Locked

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

Sign in to reply to this topic.