Problem rendering anything other than text menu

Shout-Out

User Tag List

Results 1 to 2 of 2
  1. #1
    jack445's Avatar Member
    Reputation
    2
    Join Date
    Apr 2008
    Posts
    10
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problem rendering anything other than text

    I've recently started trying make some kind of overlay for wow. The problem I ran into and don't know how to solve is that if I try to render anything other than text, it just won't appear. Strangely enough, if I start Mumble with its overlay enabled everything works just fine (and continues to work even if I close Mumble after that). I've already tried setting some properties for d3device as suggested in other threads that had similar issue (such as VertexShader and PixelShader to null, enabling AlphaBlend etc.) and it didn't seem to fix this issue. Any clue what am I doing wrong?

    Correct rendering: https://i.imgur.com/uDLrJ6r.jpg
    Incorrect: https://i.imgur.com/PPsTDVs.jpg

    EndScene hook code:
    Code:
                            device.VertexShader = null;
                            device.PixelShader = null;
                            device.SetRenderState(RenderState.AlphaBlendEnable, true);
                            device.SetRenderState(RenderState.BlendOperation, BlendOperation.Add);
                            device.SetRenderState(RenderState.DestinationBlend, Blend.InverseSourceAlpha);
                            device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha);
                            device.SetRenderState(RenderState.Lighting, 0);
                            device.SetTexture(0, null);
                            device.SetRenderState(RenderState.CullMode, Cull.None);
                            using (Surface renderTargetTemp = device.GetRenderTarget(0))
                            {
                                int width, height;
                                width = renderTargetTemp.Description.Width;
                                height = renderTargetTemp.Description.Height;
    
                                if (_renderTarget == null)
                                {
                                    using (SwapChain sc = device.GetSwapChain(0))
                                    {
                                        _renderTarget = Surface.CreateOffscreenPlain(device, width, height, sc.PresentParameters.BackBufferFormat, Pool.SystemMemory);
                                    }
                                }
    
                                using (Surface resolvedSurface = Surface.CreateRenderTarget(device, width, height, renderTargetTemp.Description.Format, MultisampleType.None, 0, false))
                                {
                                    device.StretchRectangle(renderTargetTemp, resolvedSurface, TextureFilter.None);
    
                                    device.GetRenderTargetData(resolvedSurface, _renderTarget);
                                }
                            }
                            
                            // draw letterbox
                            if (_lineVectors == null)
                            {
                                _lineVectors = new SlimDX.Vector2[] { 
                                            new SlimDX.Vector2(0, 0),
                                            new SlimDX.Vector2(_renderTarget.Description.Width - 1, _renderTarget.Description.Height - 1),
                                            new SlimDX.Vector2(0, _renderTarget.Description.Height - 1),
                                            new SlimDX.Vector2(_renderTarget.Description.Width - 1, 0),
                                            new SlimDX.Vector2(0, 0),
                                            new SlimDX.Vector2(0, _renderTarget.Description.Height - 1),
                                            new SlimDX.Vector2(_renderTarget.Description.Width - 1, _renderTarget.Description.Height - 1),
                                            new SlimDX.Vector2(_renderTarget.Description.Width - 1, 0),
                                        };
                            }
    
                            // draw lines
                            if (_lineVectors != null)
                            {
                                using (SlimDX.Direct3D9.Line line = new SlimDX.Direct3D9.Line(device))
                                {
                                    line.Antialias = false;
                                    line.Width = 1.0f;
                                    line.Begin();
                                    line.Draw(_lineVectors, new SlimDX.Color4(1.0f, 0.5f, 0.5f, 1.0f));
                                    line.End();
                                }
                            }
    
                            
                            // random lines in random colors
                            lineData = new LineVertex[100];
                            Random rnd = new Random(DateTime.Now.Millisecond);
    
                            for (int i = 0; i < lineData.Length; i++)
                            {
                                lineData[i] = new LineVertex();
                                float x = (float)rnd.Next(0, _renderTarget.Description.Width);
                                float y = (float)rnd.Next(0, _renderTarget.Description.Height);
                                float z = 1.0f;
                                lineData[i].Position = new Vector4(x, y, z, 0f);
                                lineData[i].Color = Color.FromArgb(rnd.Next(0, 255), rnd.Next(0, 255), rnd.Next(0, 255)).ToArgb();
                            }
                            device.VertexFormat = LineVertex.Format;
                            device.DrawUserPrimitives<LineVertex>(PrimitiveType.LineList, 0, lineData.Length / 2, lineData);
                            
                            
                            // draw frame rate
                            using (SlimDX.Direct3D9.Font font = new SlimDX.Direct3D9.Font(device, new System.Drawing.Font   ("Arial", 20.0f, FontStyle.Bold)))
                            {
                                if (_lastFrame != null)
                                {
                                    if (lastDispSec != _lastFrame.Value.Second)
                                    {
                                        lastDispSec = _lastFrame.Value.Second;
                                        fps = (1000.0 / (DateTime.Now - _lastFrame.Value).TotalMilliseconds);
                                        Interface.DebugMessage(this.ProcessId, "Game running at: " + (fps++) + " fps.");
                                    }
                                    font.DrawString(null, String.Format("{0:N1} fps", fps), 100, 200, System.Drawing.Color.Aqua);
                                }
                                _lastFrame = DateTime.Now;
                            }
    Code above draws (as seen on screenshots) a latterbox of size of the current wow window, lines with random start/end points and colors as well as current frame rate. Hook is done using EasyHook, rendering using SlimDX.

    Problem rendering anything other than text
  2. #2
    jack445's Avatar Member
    Reputation
    2
    Join Date
    Apr 2008
    Posts
    10
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Solved by doing this instead:
    Code:
    device.SetRenderState(RenderState.Lighting, false);
                            device.SetRenderState(RenderState.SpecularEnable, false);
                            device.SetRenderState(RenderState.CullMode, Cull.None);
                            device.SetRenderState(RenderState.AlphaBlendEnable, true);
                            device.SetRenderState(RenderState.VertexBlend, VertexBlend.Disable);
                            device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha);
                            device.SetRenderState(RenderState.DestinationBlend, Blend.InverseSourceAlpha);
                            device.SetRenderState(RenderState.FillMode, FillMode.Solid);
                            device.SetRenderState(RenderState.ColorWriteEnable, 0xF);
                            device.SetRenderState(RenderState.MultisampleAntialias, false);
                            device.SetTexture(0, null);
                            device.VertexShader = null;
                            device.PixelShader = null;
                            device.VertexDeclaration = null;
    This is based on d3dshark ofc, so anyone checking this thread should thank those guys instead

Similar Threads

  1. Something Other Than Wow-v Plz.....
    By Snailz in forum World of Warcraft Emulator Servers
    Replies: 7
    Last Post: 12-31-2007, 08:38 AM
  2. Anywhere other than STV?
    By giantman in forum World of Warcraft General
    Replies: 3
    Last Post: 01-27-2007, 07:18 AM
  3. any thomg other than wowglider?
    By raceboy404 in forum World of Warcraft General
    Replies: 1
    Last Post: 01-21-2007, 02:57 PM
All times are GMT -5. The time now is 11:45 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search