Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > C/C++
You last visited: Today at 17:41

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



DirectX drawn lines are not visible

Discussion on DirectX drawn lines are not visible within the C/C++ forum part of the Coders Den category.

Reply
 
Old   #1
 
znoeen's Avatar
 
elite*gold: 0
Join Date: May 2014
Posts: 58
Received Thanks: 33
DirectX drawn lines are not visible

Hello guys,

I'm trying to draw some lines with DirectX. I hooked into present, and using the games LPDIRECT3DDEVICE9 to draw strings/lines. Somehow only the strings are visible, and not the lines.

Code:
void Menu::Box(int x, int y, int w, int h, DWORD Color, LPDIRECT3DDEVICE9 pDevice)
{
	if (!pDevice)
		return;

	const DWORD D3D_FVF = (D3DFVF_XYZRHW | D3DFVF_DIFFUSE);

	struct Vertex
	{
		float x, y, z, ht;
		DWORD yourcolor;
	}
	V[4] =
	{
		{ (float)x, (float)(y + h), 0.0f, 0.0f, Color },
		{ (float)x, (float)y, 0.0f, 0.0f, Color },
		{ (float)(x + w), (float)(y + h), 0.0f, 0.0f, Color },
		{ (float)(x + w), (float)y, 0.0f, 0.0f, Color }
	};

	pDevice->SetTexture(0, NULL);
	pDevice->SetRenderState(D3DRS_LIGHTING, FALSE);
	pDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW);
	pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
	pDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
	pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
	pDevice->SetRenderState(D3DRS_FOGENABLE, false);

	pDevice->SetFVF(D3D_FVF);
	pDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, V, sizeof(Vertex));
}
znoeen is offline  
Old 12/17/2017, 19:08   #2
 
elite*gold: 0
Join Date: Apr 2011
Posts: 363
Received Thanks: 167
I think your code is OK..

Shouldn't u call this function in:
Code:
HRESULT WINAPI EndScene(LPDIRECT3DDEVICE9 pDevice)
{
      //call function here to draw on top
        return pEndScene(pDevice);
}
elmarcia is offline  
Old 12/19/2017, 19:38   #3
 
Decrypted's Avatar
 
elite*gold: 0
Join Date: Mar 2016
Posts: 70
Received Thanks: 176
Quote:
Originally Posted by elmarcia View Post
I think your code is OK..

Shouldn't u call this function in:
Code:
HRESULT WINAPI EndScene(LPDIRECT3DDEVICE9 pDevice)
{
      //call function here to draw on top
        return pEndScene(pDevice);
}

Like Elmarcia already said, you can't render 3D stuff after the scene has been rendered (BeginScene => EndScene (Processes all the stuff left in the render queue(flushes it)).
The rendered image is now the backbuffer of your device. Present takes the backbuffer and draws it as a simple image on the window. (The text only works because the text framework writes on the backbuffer regardless of the scene drawing).
Decrypted is offline  
Old 12/24/2017, 13:38   #4


 
Ende!'s Avatar
 
elite*gold: 1
Join Date: Feb 2009
Posts: 6,378
Received Thanks: 7,996
It’s been ages since I last did D3D9 hooks, but IIRC it was possible to just call BeginScene before doing your stuff in Present and finish off with an EndScene call.

Also, check your return values.
Ende! is offline  
Reply

« Question | Problem »

Similar Threads Similar Threads
[Selling] [VERKAUFE] Drawn Together DVD Sammelbox [SUCHE] e*gold
01/05/2016 - elite*gold Trading - 159 Replies
Hey, ich biete euch folgendes: Drawn Together: DVD Sammelbox (Staffel 1-3) _ -Bild http://i.epvpimg.com/54Wzg.jpg -Infos Die CD's befinden sich alle in einem guten Zustand. Die Serie läuft flüssig ohne irgendwelche Unterbrechungen#
[Buying] [WANT BUY] A very very simple Logo (Self-drawn!!!)
05/02/2015 - Artist Trading - 2 Replies
Deutsch Hi, ich suche einen grafiker, der für mich ein ganz simples Logo zeichnen kann. Es sollte selbst gezeichnet werden! Bezahlen kann ich mit PaysafeCard's oder anderen Dienstleistungen. Bei Interesse, schreibe mir eine PN oder schreibe hier im Thread. Falls Skype vorhanden ist, bitte mit Skype Namen - Gehandelt wird hier!
[HELP] sharpdx drawn overlay after 10 sec execption
07/17/2014 - .NET Languages - 0 Replies
hi community my injected overlay is drawn then after 10 sec he throws a exception Debug: DXHookD3D11: PresentHook: Exeception: SharpDX.SharpDXException: SharpDX.SharpDXException: HRESULT: , Module: , ApiCode: , Message: Falscher Parameter. bei SharpDX.Result.CheckError() bei SharpDX.Direct3D11.Device.CreateRenderTargetView(R esource resourceRef, Nullable`1 descRef, RenderTargetView rTViewOut) bei SharpDX.Direct3D11.RenderTargetView..ctor(Device device, Resource resource) ...
background in console drawn!
03/28/2013 - C/C++ - 2 Replies
Hey Leute ! Ich arbeite zur Zeit mit SDL und c++ und möchte ein einfaches Bild in meiner Console darstellen. Jetzt habe ich diesen einfachen Code hier, aber unten bei apply_surface(0,0,background,screen); sagt er das apply_surface falsch ist. Error: Der Bezeichner ""apply_surface"" ist nicht definiert. #include <SDL.h> SDL_Surface *screen = NULL;
Hand-drawn Design
12/11/2011 - elite*gold Trading - 13 Replies
Hey Leute, hier biete ich an, handgezeichnete Werke für euch zu designen... Einfach sagen was ihr wollt... Egal was, ich mache es... Logo - Signatur - Avatar - Buttons... Egal was... Na ja... okay... vielleicht Webdesign nicht, aber sonst alles... :) Preise der Werke Logo Signatur Avatar



All times are GMT +1. The time now is 17:42.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.