skybox cpp and h, please take a glance.

Started by
6 comments, last by GekkoCube 20 years, 8 months ago
i posted this on the directx forum, but nobody will give it a shot. there are no exe''s, just 1 .cpp and 1. h file, both are for my skybox object. i used vertex buffer to draw it, but recently changed it to use index buffering...problem is the whole skybox doesnt render, only 3 triangles. was wondering if somebody can check out my implementation of the index buffered skybox. i check and double checked, and everything seems find (this is my first attempt to use index buffers). http://edan.48thfloor.com/project thanks,
Advertisement
I don''t have the patience to verify that you''re box faces are correct, but the comment above where you fill in the vb says strips, where as in your draw call you are rendering a triangle list. If that''s just a typo then set the draw state to not cull back faces, that should tell you if some of your faces are facing the wrong direction.

------------
- outRider -
First off, why do you have collision code for your skybox? A skybox is just suppose to be backdrop filler for your scene. You''re going way overcomplicated. What I do is simply draw a small box (1x1x1) around the origin of the camera. Reverse the vertex order so it will be textured on the inside of the box. Disable depth test and lighting before drawing it, and boom you''re done. it will draw the small box around the camera and everything else will "appear" to be inside the box because you disable depth test for drawing the skybox.
TO answer your question:

I have a Collision function which is unused because CSkybox inherits from CObject, which has Collision as a pure virtual.

Also, why is it a good idea to turn lighting off before drawing the skybox?

and why not keep the z-depth checking on...? because having it on doesnt seem to make any difference whatsoever.

and finally, you said draw the skybox as a 1x1x1 dimensional thing. wouldnt that be too small?
hehe, you dont want it to be affected by lighting because it would look unnatural. the size of the skybox is unimportant, if you try to draw it to encompass your entire scene then the corners are going to be culled out by the far clipping plane.
i dont use the z-depth trick but actually translate my skybox according to the cameras world position but what the above poster stated will work as well.
"Let Us Now Try Liberty"-- Frederick Bastiat
I got it.
what exactly does z buffer enabling do?

this line...
g_pd3dDevice->SetRenderState( D3DRS_ZENABLE, D3DZB_TRUE );


doesnt appear to matter much whether i turn it on or off for any polygon being drawn, such as my terrain mesh.
set your zenable to false and render a model, then immediately after rendering that model render another model behind it, what you will find is the second model is drawn over the first because the illusion of depth is created by assigning a z depth to your geometry.
"Let Us Now Try Liberty"-- Frederick Bastiat
You probably didn''t set the flag in your presentation parameters. The z-buffer makes it so objects behind each other actually appear behind each other. If you don''t have it on, they will simply appear in whatever order you rendered them. If you have an object 50 feet away and an object 10 feet away but you render the 50 foot one first, then it will appear on top of the other one...
____________________________________________________________AAAAA: American Association Against Adobe AcrobatYou know you hate PDFs...

This topic is closed to new replies.

Advertisement