Endscene hook drawing a triangle menu

Shout-Out

User Tag List

Results 1 to 2 of 2
  1. #1
    swooshy's Avatar Member
    Reputation
    2
    Join Date
    Dec 2009
    Posts
    24
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Endscene hook drawing a triangle

    hey guys i have a problem.

    Few months ago i managed to draw a triangle with this tutorial in my endscene hook:
    Two-Kings - DirectX Graphics Tutorial 3: Draw Polygons

    Now i wanted to try something again in directx but somehow i cant get it to work.

    Drawing text works fine no problems with that but always when i try to render polygons nothing happens. (i tried in different directx 9 games not just wow)

    Here is some of the current code. I really tested a lot of stuff but somehow i dont find the mistake.
    Code:
    #define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZ | D3DFVF_DIFFUSE)
    
    
    struct D3DVERTEX
    {
    float fX,
          fY,
          fZ;
    DWORD dwColor;
    };
    
    D3DVERTEX aTriangle[] = {{-2.0f, 1.0f,10.0f,0xffff0000},
                             {-3.0f,-1.0f,10.0f,0xff00ff00},
                             {-1.0f,-1.0f,10.0f,0xff0000ff}};
    Code:
    void Triangle(IDirect3DDevice9 * pDevice)
    {
    static bool runOnce = false;
    if (!runOnce)
    	{
    runOnce = true;
    	pDevice->CreateVertexBuffer(sizeof(aTriangle),
                                          D3DUSAGE_WRITEONLY,
                                          D3DFVF_CUSTOMVERTEX,
                                          D3DPOOL_DEFAULT,
                                          &pTriangleVB,
                                          NULL);
    	pTriangleVB->Lock(0,sizeof(pData),(void**)&pData,0);
    
    	memcpy(pData,aTriangle,sizeof(aTriangle));
    
    	pTriangleVB->Unlock();
    	}
    
    pDevice->SetFVF(D3DFVF_CUSTOMVERTEX);
    pDevice->SetRenderState(D3DRS_ZENABLE, FALSE);
    pDevice->SetRenderState(D3DRS_LIGHTING, FALSE);
    pDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
    /* 
    pDevice->SetPixelShader(0);
    pDevice->SetVertexShader(0);
    pDevice->Clear(0,
                               NULL,
                               D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER,
                               D3DCOLOR_XRGB(0,0,0),
                               1.0f,
                               0);
    
    */
    pDevice->SetStreamSource(0,pTriangleVB,0,sizeof(D3DVERTEX));
    pDevice->DrawPrimitive(D3DPT_TRIANGLELIST,0,1);
    
    }
    and thats how i call the function in my endscene hook:

    Code:
    pDevice->CreateStateBlock(D3DSBT_ALL, &stateBlock);
    stateBlock->Capture();
    Triangle(pDevice);
    stateBlock->Apply();
    stateBlock->Release();

    I would really appreciate some help . i just want to draw some simple polygons

    Endscene hook drawing a triangle
  2. #2
    _Mike's Avatar Contributor
    Reputation
    310
    Join Date
    Apr 2008
    Posts
    531
    Thanks G/R
    0/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You're not setting the transformation matrices.
    Why are you clearing the z-buffer when you have disabled depth testing?
    Code:
    stateBlock->Capture();
    Redundant call. State is implicitly captured when creating the state block.

Similar Threads

  1. [C# DLL] aHook, use ASM through EndScene hook
    By JuJuBoSc in forum WoW Memory Editing
    Replies: 81
    Last Post: 04-22-2024, 02:55 PM
  2. Is EndScene hooking detectable?
    By xLeo123 in forum WoW Memory Editing
    Replies: 9
    Last Post: 01-13-2010, 03:49 PM
  3. Custom rendering in endscene hook
    By ggg898 in forum WoW Memory Editing
    Replies: 3
    Last Post: 09-11-2009, 09:38 AM
  4. [Test Theory] EndScene hook without Native Code (Kinda)
    By Apoc in forum WoW Memory Editing
    Replies: 7
    Last Post: 09-04-2009, 12:46 PM
  5. EndScene Hook not changing anything
    By lanman92 in forum WoW Memory Editing
    Replies: 32
    Last Post: 06-01-2009, 11:46 PM
All times are GMT -5. The time now is 12:07 PM. 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