Quantcast
Channel: Active questions tagged xna-4.0 - Game Development Stack Exchange
Viewing all articles
Browse latest Browse all 33

Using 2D sprites and 3D models together

$
0
0

I have gone through a few posts that talks about changing the GraphicsDevice.BlendState and GraphicsDevice.DepthStencilState (SpriteBatch & Render states). . however even after changing the states .. i cant see my 3D model on the screen.. I see the model for a second before i draw my video in the background. . If i dont play my video then i can see the 3D model ..Here is the code:

GraphicsDevice.Clear(Color.AliceBlue);spriteBatch.Begin();if (player.State != MediaState.Stopped){    videoTexture = player.GetTexture();}Rectangle screen = new Rectangle(GraphicsDevice.Viewport.X, GraphicsDevice.Viewport.Y, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);// Draw the video, if we have a texture to draw.if (videoTexture != null){    spriteBatch.Draw(videoTexture, screen, Color.White);    if (Selected_underwater == true)    {        spriteBatch.DrawString(font, "MaxX , MaxY" + maxWidth +"," + maxHeight, new Vector2(400, 10), Color.Red);        spriteBatch.Draw(kinectRGBVideo, new Rectangle(0, 0, 100, 100), Color.White);        spriteBatch.Draw(butterfly, handPosition, Color.White);        foreach (AnimatedSprite a in aSprites)        {            a.Draw(spriteBatch);        }                           }    if(Selected_planet == true)    {                    spriteBatch.Draw(kinectRGBVideo, new Rectangle(0, 0, 100, 100), Color.White);        spriteBatch.Draw(butterfly, handPosition, Color.White);        spriteBatch.Draw(videoTexture,screen,Color.White);        GraphicsDevice.BlendState = BlendState.Opaque;        GraphicsDevice.DepthStencilState = DepthStencilState.Default;        GraphicsDevice.SamplerStates[0] = SamplerState.LinearWrap;        foreach (_3DModel m in Solar)        {            m.DrawModel();        }    }    spriteBatch.End();

Viewing all articles
Browse latest Browse all 33

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>