Help with Rendering Images In-Game (WotLK 3.3.5a) menu

Shout-Out

User Tag List

Results 1 to 6 of 6
  1. #1
    Makkah's Avatar Active Member Authenticator enabled
    Reputation
    45
    Join Date
    Jun 2024
    Posts
    67
    Thanks G/R
    10/29
    Trade Feedback
    0 (0%)
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Help with Rendering Images In-Game (WotLK 3.3.5a)

    Hello,

    I'm currently working on adding image rendering to my in-game drawing API for WotLK 3.3.5a. The texture loads correctly and I'm able to confirm it's valid, but for some reason, the image isn't being drawn on screen.

    I've gone through my projection and rendering code, but can't seem to figure out what’s going wrong. Any help or pointers would be greatly appreciated! 😄

    Thanks in advance!

    Code:
    void Draw::DrawImageAtPosition(Vector3 worldPos, float size, LPDIRECT3DTEXTURE9 texture, LPDIRECT3DDEVICE9 dev)
    {
        if (!dev) {
            printf("[DrawImage] Device is null.\n");
            return;
        }
    
        if (!texture) {
            printf("[DrawImage] Texture is null. Skipping image draw.\n");
            Draw::DrawBox(worldPos, size, D3DCOLOR_ARGB(255, 255, 0, 0), dev);
            return;
        }
    
        CameraInfo* cam = (CameraInfo*)Camera::GetActiveCamera();
        if (!cam) {
            printf("[DrawImage] No active camera.\n");
            Draw::DrawBox(worldPos, size, D3DCOLOR_ARGB(255, 255, 0, 0), dev);
            return;
        }
    
        // Build camera matrices
        D3DXMATRIX world, view, projection;
        D3DXMatrixIdentity(&world);
    
        D3DXVECTOR3 eye = cam->Position;
        D3DXVECTOR3 at = eye + Camera::Forward();
        D3DXVECTOR3 up(0, 0, 1);
    
        D3DXMatrixLookAtRH(&view, &eye, &at, &up);
        D3DXMatrixPerspectiveFovRH(&projection, cam->FieldOfView * 0.6f, cam->Aspect, cam->NearPlane, cam->FarPlane);
    
        // Project 3D world position to 2D screen
        D3DVIEWPORT9 viewport;
        dev->GetViewport(&viewport);
    
        D3DXVECTOR3 screenPos;
        D3DXVECTOR3 input(worldPos.X, worldPos.Y, worldPos.Z);
    
        if (!D3DXVec3Project(&screenPos, &input, &viewport, &projection, &view, &world)) {
            printf("[DrawImage] D3DXVec3Project failed.\n");
            Draw::DrawBox(worldPos, size, D3DCOLOR_ARGB(255, 255, 0, 0), dev);
            return;
        }
    
        if (screenPos.z < 0.0f || screenPos.z > 1.0f) {
            printf("[DrawImage] Projected Z out of view range: %.2f\n", screenPos.z);
            Draw::DrawBox(worldPos, size, D3DCOLOR_ARGB(255, 255, 0, 0), dev);
            return;
        }
    
        // Debug projection result
        printf("[DrawImage] Projected screen X=%.2f Y=%.2f Z=%.2f\n", screenPos.x, screenPos.y, screenPos.z);
    
        // Prepare screen-space quad
        float half = size / 2.0f;
    
        struct ScreenVertex {
            float x, y, z, rhw;
            float u, v;
        };
    
        ScreenVertex quad[4] = {
            { screenPos.x - half, screenPos.y - half, 0.0f, 1.0f, 0.0f, 0.0f },
            { screenPos.x + half, screenPos.y - half, 0.0f, 1.0f, 1.0f, 0.0f },
            { screenPos.x + half, screenPos.y + half, 0.0f, 1.0f, 1.0f, 1.0f },
            { screenPos.x - half, screenPos.y + half, 0.0f, 1.0f, 0.0f, 1.0f }
        };
    
        quad->rhw = 1.0f;
    
        // Set rendering state
        dev->SetTexture(0, texture);
        dev->SetFVF(D3DFVF_XYZRHW | D3DFVF_TEX1);
        dev->SetRenderState(D3DRS_ZENABLE, FALSE);
        dev->SetRenderState(D3DRS_ZWRITEENABLE, FALSE);
        dev->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
        dev->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
        dev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
        dev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
    
    
        HRESULT hr = dev->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, quad, sizeof(ScreenVertex));
        if (FAILED(hr)) {
            printf("[DrawImage] DrawPrimitiveUP failed (HRESULT: 0x%08X). Drawing fallback box.\n", hr);
            Draw::DrawBox(worldPos, size, D3DCOLOR_ARGB(255, 255, 0, 0), dev);
        }
        else {
            printf("[DrawImage] Image draw completed successfully.\n");
        }
    }

    Help with Rendering Images In-Game (WotLK 3.3.5a)
  2. #2
    demerda10's Avatar Member
    Reputation
    2
    Join Date
    Jan 2019
    Posts
    31
    Thanks G/R
    1/1
    Trade Feedback
    0 (0%)
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Can you give us more info about the "problem"?

    First, do any of these printf return the error?

    Try removing the "out of view" until you get it working.
    Sometimes it would be drawing, but in incorrect position, but because of this, is isn't drawing at all.
    And incorrect render is better than no render for debugging purposes.

    Also, are you able to draw very simple shapes first? Like a circle or just a line.
    Just so we can make sure there is nothing wrong with the projection mathematics or the camera values or render state.
    Last edited by demerda10; 4 Weeks Ago at 08:11 PM.

  3. #3
    Makkah's Avatar Active Member Authenticator enabled
    Reputation
    45
    Join Date
    Jun 2024
    Posts
    67
    Thanks G/R
    10/29
    Trade Feedback
    0 (0%)
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I have drawing lines, circle etc working there is nothing wrong with projection mathematics or camera values. but i am trying to put a image on unitpositions but it not showing the texture

  4. #4
    demerda10's Avatar Member
    Reputation
    2
    Join Date
    Jan 2019
    Posts
    31
    Thanks G/R
    1/1
    Trade Feedback
    0 (0%)
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Mind sharing how you are loading the texture?
    Even if it isn't null pointer, it can still fail (not draw) for other reasons texture related.

    Also, have you tried using ID3DXSprite instead of drawing quads directly ?

  5. #5
    cowah's Avatar Member
    Reputation
    1
    Join Date
    Jun 2025
    Posts
    1
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Memory editing’s never easy, especially with older games like Would 3.3.5a. I ran into similar stuff messing with Null’s Brawl mods textures not showing up right or memory addresses being off. Usually just takes some patience and tweaking to figure out what’s going wrong.

  6. #6
    Makkah's Avatar Active Member Authenticator enabled
    Reputation
    45
    Join Date
    Jun 2024
    Posts
    67
    Thanks G/R
    10/29
    Trade Feedback
    0 (0%)
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I was never able to figure it out, so i kinda gave up on adding my own textures,

Similar Threads

  1. Need help with Mod-Editing in general [+Rep for help]
    By Flesh0209 in forum WoW ME Questions and Requests
    Replies: 4
    Last Post: 08-15-2009, 07:06 PM
  2. Need help with a bug in arcemu
    By thefallen1one in forum WoW EMU Questions & Requests
    Replies: 1
    Last Post: 08-02-2009, 08:44 PM
  3. I need help with an Error in startup
    By MEC in forum WoW EMU Questions & Requests
    Replies: 5
    Last Post: 09-29-2008, 06:03 PM
  4. Problem with my skin in-game
    By C-Death in forum WoW ME Questions and Requests
    Replies: 3
    Last Post: 01-04-2008, 10:12 PM
All times are GMT -5. The time now is 07:18 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