Draw in EndScene menu

User Tag List

Results 1 to 1 of 1
  1. #1
    nightUA's Avatar Private
    Reputation
    2
    Join Date
    Jun 2012
    Posts
    11
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Draw in EndScene

    I have almost no experience with directx. I want to draw a single triangle, but it fails. Device is cleared, also i can draw text, but any primitive fails. Im sure im missing some render states or my transforms are wrong.
    Here is my code:
    Code:
    #define CUSTOMFVF (D3DFVF_XYZRHW | D3DFVF_DIFFUSE)
    struct CUSTOMVERTEX
    {
    	FLOAT x, y, z, rhw;    // from the D3DFVF_XYZRHW flag
    	DWORD color;    // from the D3DFVF_DIFFUSE flag
    };
    CUSTOMVERTEX OurVertices[] =
    {
    	{0.0f, 0.0f, 1.0f, 1.0f, D3DCOLOR_XRGB(0, 0, 255),},
    	{0.0f, 100.0f, 1.0f, 1.0f, D3DCOLOR_XRGB(0, 255, 0),},
    	{100.0f, 0.0f, 1.0f, 1.0f, D3DCOLOR_XRGB(255, 0, 0),},
    };
    
    LPDIRECT3DVERTEXBUFFER9 v_buffer;
    
    void xD3::xD3Engine::Initialize(LPDIRECT3DDEVICE9 device)
    {
    	device->CreateVertexBuffer(3*sizeof(CUSTOMVERTEX),
    		0,
    		CUSTOMFVF,
    		D3DPOOL_MANAGED,
    		&v_buffer,
    		NULL);
    
    	VOID* pVoid;    // the void* we were talking about
    	v_buffer->Lock(0, 0, (void**)&pVoid, 0);    // locks v_buffer, the buffer we made earlier
    	memcpy(pVoid, OurVertices, sizeof(OurVertices));
    	v_buffer->Unlock();    // unlock v_buffer
    }
    
    void xD3::xD3Engine::OnDraw(LPDIRECT3DDEVICE9 device)
    {
    	//device->GetTransform(D3DTS_WORLD, &matTranslate);
    	device->SetFVF(CUSTOMFVF);
    	device->SetRenderState(D3DRS_ZENABLE, FALSE);
    	device->SetRenderState(D3DRS_LIGHTING, FALSE);
    	device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
    	device->SetPixelShader(NULL);
    	device->SetVertexShader(NULL);
    
    	device->Clear(0,
    		NULL,
    		D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER,
    		D3DCOLOR_XRGB(0,0,0),
    		1.0f,
    		0);
    
    	D3DXMATRIX matTranslate;
    	D3DXMatrixIdentity(&matTranslate);
    	
    	device->SetStreamSource(0, v_buffer, 0, sizeof(CUSTOMVERTEX));
    	device->SetTransform(D3DTS_WORLD, &matTranslate);
    	device->SetTransform(D3DTS_VIEW, &matTranslate);
    	device->SetTransform(D3DTS_PROJECTION, &matTranslate);
    	device->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 1);
    
    }
    Any help please.
    Last edited by nightUA; 07-08-2012 at 02:24 PM.

    Draw in EndScene

Similar Threads

  1. Endscene hook drawing a triangle
    By swooshy in forum WoW Memory Editing
    Replies: 1
    Last Post: 12-20-2010, 11:35 AM
  2. Zukassi Karlov's Drawing guide (Anime Style): Blood Elf Male
    By karlov in forum Art & Graphic Design
    Replies: 5
    Last Post: 11-11-2007, 05:54 PM
  3. Offensive Drawing!!! (extremely nice if you ask me!)
    By latruwski in forum Screenshot & Video Showoff
    Replies: 7
    Last Post: 11-07-2007, 09:07 PM
  4. PMap, draw your glider profiles!
    By MLT in forum World of Warcraft Bots and Programs
    Replies: 10
    Last Post: 08-30-2007, 03:06 PM
  5. Increase 'draw' range? (graphic improvements)
    By Toldorn in forum World of Warcraft General
    Replies: 0
    Last Post: 01-11-2007, 08:07 PM
All times are GMT -5. The time now is 02:24 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search