Archived

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

Gary

Rendering to a Texture

Recommended Posts

I have a program which renders a model to a texture and then places it as an overlay..... It works completely fine when I have: PR_SetD3DPipeline (0) However, when I have PR_SetD3DPipeline (1) only materials that are non-gouraud are rendered. So, just plain texture works fine but if I use Gouraud or GouraudTextured it doesn''t get rendered. I know it''s not a lighting issue because I have all of the ambient light values set to 255 and it works when run through the PR Pipeline. The model also renders fine if it isn''t rendered to a texture..... Gary

Share this post


Link to post
Share on other sites
No, because I''m not actually using any lights...... I''m using the gouraud rendering method because I need to be able to change the color values, the lighting part isn''t important for what I''m doing.

I had thought that with the ambient light value set to max that it would be fine. Do I need to transform a light, even if I''m not using one?


Gary

Share this post


Link to post
Share on other sites
Ok, I just tried putting in a light and trying again.

I got more of a result. Where the light was set, that part of the model was lit by the light. The thing is I want it fully bright which is why I set the ambient light values.


Why arn''t the Ambient Light values doing anything?


I noticed this same problem with the Simple Land program as well. When I changed the terrain engine to have light, ambient light values did absolutely nothing....


Gary

Share this post


Link to post
Share on other sites
Ambient colors are currently not hooked up with the D3D pipeline.

Here is a function you can use to set the ambient color for the D3D pipeline instead:

void PR_SetD3DAmbientLight (PR_REAL r, PR_REAL g, PR_REAL b)
{
D3DCOLOR dwColor;

dwColor = D3DCOLOR_RGBA(r,g,b,255);
PR_Globals.PR_Direct3DDevice->lpVtbl->SetRenderState(PR_Globals.PR_Direct3DDevice, D3DRS_AMBIENT, dwColor);
}

There is a PR_SetAmbientLight function but it only sets the variables used in the PR pipeline. I''ll make it call this code as well in the future.

Share this post


Link to post
Share on other sites
Gary, how do you render directly to a texture? I always thought you had to render to the screen, and then copy the screen to a texture. Thanks.

-Rich

Share this post


Link to post
Share on other sites
PsycoBlade, older video cards, like the Voodoo II can't render directly to a texture. However, newer video cards can.

Somewhere in one of chris's examples he does it and this is where I learned how to do it.

It's not difficult at all so I just shoved my code into the SimpleObject example. I'll upload it to the FTP when I can connect to it (The FTP seems to be down right now).



BTW: Chris, the function works great but the rbg variables you posted need to be int, not float.


Gary


Edited by - Gary on August 10, 2001 9:52:48 PM

Share this post


Link to post
Share on other sites