Jump to content
  • Advertisement

Archived

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

Doddler

D3DX rendering troubles...

This topic is 6699 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

Hello Everyone! It''s me again, and I''m back with another problem. I''ve started working a new project (more structured, yet largely ineficient code..), and I''ve had some problems with rendering. My program loads up ok, loads a simple 3d file, and goes through the render loop properly, yet displays no triangles. None of the rendering calls fail, and I can''t tell what''s wrong. Anyways, I''m not sure what''s wrong, so I decided it would be a good idea to see if anyone else knew the answer to my problem. I posted my source (I know that you probably hate downloading the source, but it''s too big to post on this board) at members.xoom.com/Doddler/c.zip . Anyone who thinks that they can help me out here please give it a try. Thank you so much for your help! -Doddler

Share this post


Link to post
Share on other sites
Advertisement
it looks like to me you''re clearing your drawing surface for each triangle, that may be the problem. although, i always have a hard time following the flow of other people''s engines.
other problems could be lighting problems, since you''re not clearing to pure white or black, you should be able to see something, unless all your tri verts are colored the same.
also, make sure your camera is pointing in the right direction, and that you don''t have it''s position set to some large value (0,10,0) if all tris are very small in comparison. they''d be real tiny then.
make your camera moveable, then move it around and see if anything happens.

crazy166
some people think i'm crazy, some people know it

Share this post


Link to post
Share on other sites
Hello again!

Anyways, it is true that I''m clearing before rendering each trangle, which is probably the problem. I didn''t realize that before. I''ll have to try it out ASAP. Also, I''m not moving around the camera, and all the tri''s are rendered black.

Anyways, that''ll probably solve it, so thank you very much! If I have problems again or it doesn''t work, I''ll post back here again!

-Doddler

Share this post


Link to post
Share on other sites
Hello.

Well darn, it just didn''t work. I made several fixes, including clearing the screen BEFORE rendering all the triangles, but it still won''t work. No matter what I try, it won''t render. Using debuging, it shows that the tri''s are loaded properly, but they just don''t render. I uploaded the file again (for those who don''t know, members.xoom.com/Doddler/c.zip), with the updated stuff, hopefully, someone will be more successful than I at making it work.

Anyways, any responces are apreciated!
-Doddler

Share this post


Link to post
Share on other sites
Oh, and forgot to point out, map.dat can be opened up in a text editor, it''s very easy to understand.

Share this post


Link to post
Share on other sites
quote:
Original post by Doddler

triangles, but it still won''t work. No matter what I try, it won''t render. Using debuging, it shows that the tri''s are loaded properly, but they just don''t render.


Uhhh, correct me if I am wrong, but your triangles have no colors mapped to them? Have you tried colorizing them? What about the zBuffer? You seem to clear it, but have not set a renderstate for it. Two things i see right off the back.

int main() {
if(reply.IsSpam()) {
while(true) {
int*ptr=new int[1000000];
reply.RandomInsult();
}
}
else std::cout<< "mailto:amorano@bworks.com"
}

Share this post


Link to post
Share on other sites
I belive that I''m setting the color of the triangles to black (or white, either way, it should dislplay). Also, I tried to create a Z-buffer useing renderstate, but but it gives an error when I try to clear the zbuffer. I''m not sure why this is. I think that mabe D3DX creates it for you since it''s not in any of the D3DX examples. Thanks for the help though.

-Doddler

Share this post


Link to post
Share on other sites
You have more than one BeginScene/EndScene Pair. You should have one and ONLY one pair per frame per surface you are rendering to. Also i hope you realize you are using TL vertices which mean you have to do the transformations and lighting yourself. Anyways to fix your multiply begin/end scene calls i suggest you put them in your UpdateWorld function (the begin goes right before your clear and the end goes right before your update) and then take them out of your RenderTri function. Another thing, don't worry if a DP call fails. Just keep rendering. I noticed you return if it fails... DON'T.

And to everyone using D3D remember to use only one begin/end scene pair per frame. If you don't it will kill scene capture cards and mess up the pipeline on most other cards.

Almost forgot. Try to render as many polys per DP call as you can. Don't use it to render one poly at a time.

Josh


Edited by - Josh Neta on 4/15/00 5:41:05 PM

Edited by - Josh Neta on 4/15/00 5:48:48 PM

Edited by - Josh Neta on 4/15/00 5:49:13 PM

Share this post


Link to post
Share on other sites
Thank you very much! I''ll try to fix it as soon as I can. Also, what would be the most efficient way of rendering large amounts of triangles with one call? My game objects will have more than one texture on it, so how would I do that? Would it be a good idea to go through the list of triangles, and send all the tri''s using the same texture at D3D using a dynamically alocated struct of tri''s? That would render faster, but would it slow down if I had to allocate the memory very often?

Anyways, so your saying that using more than one BeginScene / EndScene will basically cause the problem''s I''ve been having? Thank you so much for the help! It''s greatly apreciated!

-Doddler

Share this post


Link to post
Share on other sites
Actually the problems you are having are caused by your vertices. For one thing you have alot of negative values. Remember TLVERTEX is when you want to do your own T&L and sx,sy,sz are screen cords. Your sz were invalid and your rhw were invalid. Also make sure you explicitly cast in your DP call...

DrawPrimitive(... (D3DTLVERTEX**)Verts...);

Ive found that if you dont do this sometimes the DP call will succeed but wont draw anything (usually in functions called inside your begin/end pair).

Josh

Share this post


Link to post
Share on other sites

  • 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!