textSprite.Begin(SpriteFlags.ObjectSpace  SpriteFlags.DoNotModifyRenderState  SpriteFlags.DoNotSaveState); Device.SetRenderState(RenderState.AlphaBlendEnable, false); text2D.DrawString(textSprite, text, rect, format  DrawTextFormat.NoClip, color); textSprite.End();
 Home
 » Viewing Profile: Topics: OppiXP
Banner advertising on our site currently available from just $5!
1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!
OppiXP
Member Since 20 Dec 2009Offline Last Active Aug 02 2012 01:42 AM
Community Stats
 Group Members
 Active Posts 13
 Profile Views 490
 Submitted Links 0
 Member Title Member
 Age Age Unknown
 Birthday Birthday Unknown

Gender
Not Telling
Topics I've Started
[SlimDX] Render solid 2D text
06 May 2010  02:51 AM
Hello everybody,
I am wondering if it is possible to render solid 2D text using a SlimDX.Direct3D9.Sprite and a SlimDX.Direct3D9.Font.
Basically this is what i am doing:
text, rect, format and color are parameters of my method.
Unfortunately I only get a solid black rectangle.
Is it possible to draw black text with a white background?
Any help is appreciated!
Best regards
[SlimDX] Picking a point on a plane
08 February 2010  10:09 PM
Hello guys,
I am stuck on picking a certain point on a plane which is located anywhere on the z axis of my coordinate system. The coordinate system can be zoomed and rotated by using my chase camera.
Here is what it looks like:
The problem is that my coordinates seem to be messed up and I cannot figure out why.
The camera is rotated and zoomed by setting up the projection and view matrices in this way:
Rotating the camera around my coordinate system works fine.
I use this code to determine if a ray intersects a certain plane:
Sometimes it seems that the plane is located flat in the upper right corner of the screen...
Can please anybody have a look at this and tell me what is wrong?
I also tried intersection using a BoundingBox:
BoundingBox box = new BoundingBox(new Vector3(0), new Vector3(1));
It seems that the coordinates are not translated correctly.
Any help is appreciated!
Best Regards
OppiXP
projectionMatrix = Matrix.PerspectiveFovLH( (float)Math.PI / 4, (float)ClientRect.Width / ClientRect.Height, 0.001f, 20f); Matrix trans = Matrix.Translation(0.0f, 0.0f, camDistance); Matrix rot = Matrix.Multiply(Matrix.RotationY(camAngleHorizontal), Matrix.Identity); rot = Matrix.Multiply(Matrix.RotationX(camAngleVertical), rot); viewMatrix = Matrix.Multiply(trans, rot); viewMatrix = Matrix.Invert(viewMatrix);
protected override void MouseMove(System.Windows.Forms.MouseEventArgs e) { base.MouseMove(e); Plane plane = new Plane(new Vector3(1f, 0, 0), 0); DX.Instance.SetWorldMatrix(Matrix.Identity, Matrix.Identity); Vector3 nearPlane = Vector3.Unproject(new Vector3((float)e.X, (float)e.Y, currentCamDistance), DX.Instance.ViewPort, DX.Instance.CurrentProjectionMatrix, DX.Instance.CurrentViewMatrix, DX.Instance.CurrentWorldMatrix); Vector3 farPlane = Vector3.Unproject(new Vector3((float)e.X, (float)e.Y, 20f), DX.Instance.ViewPort, DX.Instance.CurrentProjectionMatrix, DX.Instance.CurrentViewMatrix, DX.Instance.CurrentWorldMatrix); Vector3 direction = farPlane  nearPlane; direction.Normalize(); Ray ray = new Ray(nearPlane, direction); float distance; Console.WriteLine(Ray.Intersects(ray, plane, out distance)); }
[SlimDX] Clip planes
20 December 2009  08:10 PM
Hello everybody,
I am currently working on a 3 dimensional plot of measurement data (waterfall diagram). What I am trying to do is to implement zooming and scrolling by scaling and translating the trianglestrips. But I cannot figure out how to use the clip planes to clip the data at the left and right ends of the xaxis. Imagine a box with an edge length of 1. I only want to draw the data inside this box.
I have tried this to clip the data on the left side of the x axis:
Plane clipPlane = new Plane(new Vector3(1f, 0f, 0f), new Vector3(0.0f, 1f, 0.0f));
DX.Instance.Device.SetClipPlane(0, clipPlane);
DX.Instance.Device.SetRenderState(RenderState.ClipPlaneEnable, 0);
DX.Instance.Device.SetRenderState(RenderState.Clipping, true);
and:
Plane clipPlane = new Plane(new Vector3(1f, 0f, 0f), new Vector3(0.0f, 1f, 0.0f));
clipPlane.Normalize();
Matrix view = DX.Instance.Device.GetTransform(TransformState.View);
view.Invert();
view = Matrix.Transpose(view);
Matrix projection = DX.Instance.Device.GetTransform(TransformState.Projection);
projection.Invert();
projection = Matrix.Transpose(projection);
view *= projection;
clipPlane = Plane.Transform(clipPlane, view);
DX.Instance.Device.SetClipPlane(0, clipPlane);
DX.Instance.Device.SetRenderState(RenderState.ClipPlaneEnable, 0);
DX.Instance.Device.SetRenderState(RenderState.Clipping, true);
Maybe I misunderstood clip planes but there is no clipping at all.
Any help is appreciated!
Best regards
OppiXP
EDIT:
I figured out that SlimDX writes the following lines to the Output window:
Direct3D9: (WARN) :Ignoring redundant SetRenderState  152
Direct3D9: (WARN) :Ignoring redundant SetRenderState  136
Could it be possible that this is a bug in SlimDX and the user clipping planes are never used? I just switched to the August Release and there the same issue occurs.
Best regards
OppiXP
[Edited by  OppiXP on December 28, 2009 4:07:54 AM]