r3n

I'm creating a loading screen. I'm doing this by drawing 2 primatives to form a simple positioned coloured vertex as a rectange. The square is black, and is the width and height of the screen (as in device.DisplayMode).

I'd like this to rectange "cover" the screen while textures are loaded. I'm doing it this way so I can fade the loading screen out to reviel the environment once everything is ready to go.

However, because the position of the primative is 0, 0, 0 - and I do not wish to move my camera, the primative is obviously at a distance (not covering the screen).

Mathamtically, what is a good way to position this rectange directly infront of the camera, without moving the camera, and without adjusting the perspective



Re: Game Technologies: Graphics Using a Primative to obscure View

Ralf Kornmann

Why not disable the Z-buffer and render the rectangle as last object






Re: Game Technologies: Graphics Using a Primative to obscure View

r3n

The rectangle actually appeared distorted - What I am looking for is a way to render the rectangle directly in front of the camera at it's current position.

For now, as a temporary solution... I have lerped my cached camera position and target values, and scaled the screen size so that my rectangle is so close to the camera that it blocks everything else out. Obviously, without rotation the object would not be square to the view; to solve this I have rotated the World by static values, but then I must change these for every different initial camera view (which is a pain).

I thought perhaps I could calculate a 'normal' (math normal) from the camera target and position vectors. Is this possible





Re: Game Technologies: Graphics Using a Primative to obscure View

Ralf Kornmann

You can use pre transformed vertex coordinates. This will make your primitive independent from the current camera. Look for custom vertex formats that have a í░Transformedí▒ in their name.






Re: Game Technologies: Graphics Using a Primative to obscure View

r3n

In a manner of speaking, would this make the vertices appear to move with the camera



Re: Game Technologies: Graphics Using a Primative to obscure View

Ralf Kornmann

Yes, the will stay on the same position on the screen independent were your camera is.






Re: Game Technologies: Graphics Using a Primative to obscure View

r3n

I am using texture transparency, will this still work



Re: Game Technologies: Graphics Using a Primative to obscure View

Ralf Kornmann

Yes, there is no difference how textures are handled.






Re: Game Technologies: Graphics Using a Primative to obscure View

r3n

Ralf, finally got round to implementing this. Works perfectly, although I had to start from -1 x and y otherwise there was a leak around the outside. I've noticed that happening before on C&C generals. Thanks!