Jump to content
Xtreme .Net Talk

Slade

Members
  • Posts

    8
  • Joined

  • Last visited

Slade's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Slade

    ViewMatrix

    Because I dont know what I'm looking at. And in a first person perspective, it seems like it would be more efficient to mirror the settings of the object I am 'following' rather then trying to calculate a point I'm looking at.
  2. Slade

    ViewMatrix

    I'm trying to build some camera routines that dont use Matrix.LookAtLH for setting the view matrix. However I am having problems with the math required to take a position (vector3) and an orientation (roll, pitch, yaw or possibly a quat) and turn it into a view matrix. I cant quite seem to make it work.
  3. Figured it out. You have to cancel the resize event. That solved my problem I'm attaching a working fullscreen class class1.cs
  4. still no go I updated it as such (File attached for convienience) and am having the same problem. A window the size of the previous screen simply restores itself and it errors out(even tho I believe I've trapped every line calling d3d) //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- using System; using System.Drawing; using System.Windows.Forms; //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- using Microsoft.DirectX; using Microsoft.DirectX.Direct3D; //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- class Fullscreen : Form { private Device device = null; PresentParameters presentParams; private bool deviceLost; public Fullscreen() { this.FormBorderStyle = FormBorderStyle.None; } public void InitDirect3D() { presentParams = new PresentParameters(); presentParams.BackBufferCount = 1; presentParams.BackBufferFormat = Manager.Adapters[0].CurrentDisplayMode.Format; presentParams.BackBufferHeight = 768; presentParams.BackBufferWidth = 1024; presentParams.FullScreenRefreshRateInHz = Manager.Adapters[0].CurrentDisplayMode.RefreshRate; presentParams.SwapEffect = SwapEffect.Discard; presentParams.Windowed = false; device = new Device(0, DeviceType.Hardware, this, CreateFlags.SoftwareVertexProcessing, presentParams); deviceLost = false; } public void Render() { if(deviceLost) { try { device.TestCooperativeLevel(); device.Reset(presentParams); deviceLost = false; } catch { return; } } try { device.TestCooperativeLevel(); device.Clear(ClearFlags.Target, Color.Black, 1.0f, 0); device.BeginScene(); device.EndScene(); device.Present(); } catch(DeviceLostException) { deviceLost = true; } } public static void Main() { using(Fullscreen frm = new Fullscreen()) { frm.InitDirect3D(); frm.Show(); while(frm.Created) { frm.Render(); Application.DoEvents(); } } } } class1.cs
  5. Alt-Tab I love this snippet. Took me forever to come up with this, however it has the same problem as my class. It does not handle alt tab :( What needs to be done to make this handle alt-tab?
  6. I've actually narrowed it down to a problem with alpha // These two lines cause the code to render nothing device.RenderState.SourceBlend = Blend.SourceAlpha; device.RenderState.DestinationBlend = Blend.InvSourceAlpha; // These two lines cause it to work. device.RenderState.SourceBlend = Blend.One; device.RenderState.DestinationBlend = Blend.Zero; this kills the alpha blending however :/ I guess now I'm lost on why this works as I'd like it to with transformed vertices, but not with position ones.
  7. In regards to rendering to a d3d texture, I havent found anyone rendering more than just the texture containing the movie on the screen. Since its an asynch call being made it really interferes with my rendering flow, along with the flow of every other setup I've seen. Even with thread/object locking I get flickering on the objects above the video and nothing below the video can be rendered without horrible results. Has anyone come up with a good way to handle this? The only 2 I can come up with is: copying the texture to be rendered later (cant figure out how to do this in managed d3d but copying was really expensive in normal d3d) rerendering the entire scene when the texture is ready
  8. I'm attempting to convert my UI code that is successfully using TransformedTextured to code that uses PositionTextured so that my imagry changes size to fit when resolution is changed. From my understanding I simply need to set my view and world matrices to Identity and then setup my projection matrix to fit the screen.. I've put together a little test app that does it as such. device.Transform.World = Matrix.Identity; device.Transform.View = Matrix.Identity; device.Transform.Projection = Matrix.OrthoOffCenterLH(0, 640, 480, 0, 0, 1); However I'm not getting the results I expect. Does anyone have any ideas? (I've attached the complete source to my test) form1.cs
×
×
  • Create New...