This topic is now archived and is closed to further replies.

Mark Tanner

Extending PowerRender

Recommended Posts

Mark Tanner    100
Hello Chris, This subject hasn''t been touched upon much or at all as far as I can tell, but could you please inform me about the following: I understand that I have access to the Direct3D interface through the global structure. Now, suppose that I really need to implement my own custom rendering in addition to PR. This would require the following: - DrawPrimitives using Index buffers - Creating and setting textures, I know this won''t use PR''s texture handling, but please hear me out on this one - SetVertexShader, SetStreamSource, etc. So, with access to the Direct3D interface, I should in theory be able to do all the above. I think it is, but could you tell me if it''s actually ok to do the above, meaning rendering my own tris in between PR''s framestart and end. Lastly, how do I control if stuff goes through the D3D pipeline or the D3D T&L pipeline? As you know, in DX8, you can set this at init. time, how would I do it in this case? Thank you for your time & continue the great work! Mark

Share this post

Link to post
Share on other sites
ChrisE    184
Yes it''s ok to call these functions. You have to be careful about state changes since PR keeps track of the last material/rendering method used. If you change the states you should also reset the PR_Globals.last_material and PR_Globals.last_method to negative numbers so it knows the states need to be updated.

If the index/vertex buffers are created in hardware memory then T&L will be used.

There are a number of useful internal functions that you could use when rendering your own triangles:

PR_DWORD PR_SetVertexProcessing (PR_DWORD VShader, PR_DWORD VBufSoftware); // vhshader = 0 or 1, vbufsoftware = 0 or 1, called before SetVertexShader

void PR_SetStreamSource (PR_DWORD stream, LPDIRECT3DVERTEXBUFFER8 vbuf, PR_DWORD size);

etc.... Having the source code would probably save you a lot of time when attempting this. If you use some of these internal functions it will be harder to mess up and confuse PR.

Share this post

Link to post
Share on other sites