Lesson 13 UpSpeed Pixel

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
ElmerCoder
Posts: 10
Joined: March 5th, 2013, 8:00 pm

Lesson 13 UpSpeed Pixel

Post by ElmerCoder » March 8th, 2013, 1:21 pm

Hi, i've had problems with the making the pixels faster, and it worked without the upspeed but this is what it made me do :
In D3DGraphics.h class D3DGraphics: Private : pBackBuffer;
D3DLOCKED_RECT backRect;

to add all those 3.
and inside the Graphics.cpp it made me do

Code: Select all

#include "D3DGraphics.h"

D3DGraphics::D3DGraphics( HWND hWnd )
{
	backRect.pBits = NULL;
	
	pDirect3D = Direct3DCreate9( D3D_SDK_VERSION );

    D3DPRESENT_PARAMETERS d3dpp;
    ZeroMemory( &d3dpp,sizeof( d3dpp ) );
    d3dpp.Windowed = TRUE;
    d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
    d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
	d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE;
	d3dpp.Flags = D3DPRESENTFLAG_LOCKABLE_BACKBUFFER;

    pDirect3D->CreateDevice( D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hWnd,
		D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_PUREDEVICE,&d3dpp,&pDevice );

	pDevice->GetBackBuffer( 0,0,D3DBACKBUFFER_TYPE_MONO,&pBackBuffer );
}

D3DGraphics::~D3DGraphics()
{
	if( pDevice )
	{
		pDevice->Release();
		pDevice = NULL;
	}
	if( pDirect3D )
	{
		pDirect3D->Release();
		pDirect3D = NULL;
	}
	if( pBackBuffer )
	{
		pBackBuffer->Release();
		pBackBuffer = NULL;
	}
}

void D3DGraphics::PutPixel( int x,int y,int r,int g,int b )
{
	((D3DCOLOR*)backRect.pBits)[ x + (backRect.Pitch >> 2) * y ] = D3DCOLOR_XRGB( r,g,b );
}

void D3DGraphics::BeginFrame()
{
	pDevice->Clear( 0,NULL,D3DCLEAR_TARGET,D3DCOLOR_XRGB(0,0,0),0.0f,0 );
	pBackBuffer->LockRect( &backRect,NULL,NULL );
}

void D3DGraphics::EndFrame()
{
	pBackBuffer->UnlockRect();
	pDevice->Present( NULL,NULL,NULL,NULL );
}
and that's how it looked there .
in Game.cpp it made me do

Code: Select all

void Game::Go()
{
	UpdateFace();
	UpdatePoo();

	gfx.BeginFrame();
	ComposeFrame();
	gfx.EndFrame();
}
it says 1 succeded. Then when i start i get an unexpected thingy.
and then it says ::

'Chili DirectX Framework.exe': Loaded 'C:\Users\Elmer1\Desktop\Chili DirectX Framework\Release\Chili DirectX Framework.exe', Symbols loaded.
'Chili DirectX Framework.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
'Chili DirectX Framework.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
'Chili DirectX Framework.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
'Chili DirectX Framework.exe': Loaded 'C:\Windows\SysWOW64\d3d9.dll', Cannot find or open the PDB file
'Chili DirectX Framework.exe': Loaded 'C:\Windows\SysWOW64\msvcrt.dll', Cannot find or open the PDB file
'Chili DirectX Framework.exe': Loaded 'C:\Windows\SysWOW64\sechost.dll', Cannot find or open the PDB file
'Chili DirectX Framework.exe': Loaded 'C:\Windows\SysWOW64\rpcrt4.dll', Cannot find or open the PDB file
'Chili DirectX Framework.exe': Loaded 'C:\Windows\SysWOW64\sspicli.dll', Cannot find or open the PDB file
'Chili DirectX Framework.exe': Loaded 'C:\Windows\SysWOW64\cryptbase.dll', Cannot find or open the PDB file
'Chili DirectX Framework.exe': Loaded 'C:\Windows\SysWOW64\user32.dll', Cannot find or open the PDB file
'Chili DirectX Framework.exe': Loaded 'C:\Windows\SysWOW64\gdi32.dll', Cannot find or open the PDB file
'Chili DirectX Framework.exe': Loaded 'C:\Windows\SysWOW64\lpk.dll', Cannot find or open the PDB file
'Chili DirectX Framework.exe': Loaded 'C:\Windows\SysWOW64\usp10.dll', Cannot find or open the PDB file
'Chili DirectX Framework.exe': Loaded 'C:\Windows\SysWOW64\advapi32.dll', Cannot find or open the PDB file
'Chili DirectX Framework.exe': Loaded 'C:\Windows\SysWOW64\version.dll', Cannot find or open the PDB file
'Chili DirectX Framework.exe': Loaded 'C:\Windows\SysWOW64\d3d8thk.dll', Cannot find or open the PDB file
'Chili DirectX Framework.exe': Loaded 'C:\Windows\SysWOW64\dwmapi.dll', Cannot find or open the PDB file
'Chili DirectX Framework.exe': Loaded 'C:\Windows\SysWOW64\msvcr100.dll', Symbols loaded.
'Chili DirectX Framework.exe': Loaded 'C:\Windows\SysWOW64\imm32.dll', Cannot find or open the PDB file
'Chili DirectX Framework.exe': Loaded 'C:\Windows\SysWOW64\msctf.dll', Cannot find or open the PDB file
'Chili DirectX Framework.exe': Loaded 'C:\Windows\SysWOW64\uxtheme.dll', Cannot find or open the PDB file
'Chili DirectX Framework.exe': Loaded 'C:\Windows\SysWOW64\ole32.dll', Cannot find or open the PDB file
'Chili DirectX Framework.exe': Loaded 'C:\Windows\SysWOW64\aticfx32.dll', Cannot find or open the PDB file
'Chili DirectX Framework.exe': Loaded 'C:\Windows\SysWOW64\atiu9pag.dll', Cannot find or open the PDB file
'Chili DirectX Framework.exe': Loaded 'C:\Windows\SysWOW64\atiumdag.dll', Cannot find or open the PDB file
'Chili DirectX Framework.exe': Loaded 'C:\Windows\SysWOW64\atiumdva.dll', Cannot find or open the PDB file
'Chili DirectX Framework.exe': Unloaded 'C:\Windows\SysWOW64\atiumdva.dll'
'Chili DirectX Framework.exe': Unloaded 'C:\Windows\SysWOW64\atiumdag.dll'
'Chili DirectX Framework.exe': Loaded 'C:\Windows\SysWOW64\atiumdag.dll', Cannot find or open the PDB file
'Chili DirectX Framework.exe': Loaded 'C:\Windows\SysWOW64\atiumdva.dll', Cannot find or open the PDB file
'Chili DirectX Framework.exe': Loaded 'C:\Windows\SysWOW64\winmm.dll', Cannot find or open the PDB file
First-chance exception at 0x013d2fbc in Chili DirectX Framework.exe: 0xC0000005: Access violation writing location 0x000008a0.
Unhandled exception at 0x772615de in Chili DirectX Framework.exe: 0xC0000005: Access violation writing location 0x000008a0.
The program '[6516] Chili DirectX Framework.exe: Native' has exited with code -1073741819 (0xc0000005).


Please i really need help :( , i wanna keep go on coding because its so god damn fun ;D
I want to be able to make like an Android market game in maybe a month or so. Have been watching all these tutorials in like 3.5 Days.

Edit : The code Works Perfectly fine in a new place and which i just draw pixels, etc... BUT PLEASE ANSWER GOD DAMMIT :( I NEED TO KNOW IT NOW!!!!! Im getting so fkin angry about this problem.... Any smart programmer or someone who has done this, Btw Send the exact code u have in your whole Game.ccp so i can match it with mine and see the problem please :/...

Edit again : Well when i started follow that Solution to how to DrawGameOver if Face collides with poo it worked ;o weird. But still if someone has that solution . Tell me ;)

User avatar
LuisR14
Posts: 1248
Joined: May 23rd, 2013, 3:52 pm
Location: USA
Contact:

Re: Lesson 13 UpSpeed Pixel

Post by LuisR14 » July 3rd, 2013, 3:50 pm

[necroposting just to answer thread ._.]
o.o, could be because of trying to release pBackBuffer after having released pDirect3D
always available, always on, about ~10 years c/c++, java[script], win32/directx api, [x]html/css/php/some asp/sql experience. (all self taught)
Knows English, Spanish and Japanese.
[url=irc://irc.freenode.net/#pchili]irc://irc.freenode.net/#pchili[/url] [url=irc://luisr14.no-ip.org/#pchili]alt[/url] -- join up if ever want real-time help or to just chat :mrgreen: --

Post Reply