Click here to Skip to main content
15,890,186 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Debug with breakpoint works, but debug without breakpoint or release mode fails ? Pin
Code-o-mat23-Jun-10 8:30
Code-o-mat23-Jun-10 8:30 
AnswerRe: Debug with breakpoint works, but debug without breakpoint or release mode fails ? [modified] Pin
Aescleal23-Jun-10 7:30
Aescleal23-Jun-10 7:30 
GeneralRe: Debug with breakpoint works, but debug without breakpoint or release mode fails ? Pin
oppstp23-Jun-10 15:58
oppstp23-Jun-10 15:58 
QuestionRAW Triangle Format: How to parse it properly Pin
ant-damage23-Jun-10 5:37
ant-damage23-Jun-10 5:37 
AnswerRe: RAW Triangle Format: How to parse it properly Pin
El Corazon23-Jun-10 5:44
El Corazon23-Jun-10 5:44 
GeneralRe: RAW Triangle Format: How to parse it properly Pin
ant-damage23-Jun-10 5:55
ant-damage23-Jun-10 5:55 
GeneralRe: RAW Triangle Format: How to parse it properly Pin
El Corazon23-Jun-10 6:03
El Corazon23-Jun-10 6:03 
GeneralRe: RAW Triangle Format: How to parse it properly Pin
ant-damage23-Jun-10 6:05
ant-damage23-Jun-10 6:05 
By the way I'm using Blender 2.49a for exporting the geometry files

Here
HRESULT load_RAW(const char *fname, IDirect3DVertexBuffer9 **buffer, int *count)
{
	HRESULT hr = E_FAIL;
	FILE *f = fopen(fname, "r");
	if(f)
	{
		(*count) = 0;
		float tmp[3] = {0};
		while(fscanf(f, "%g %g %g", &tmp[0], &tmp[1], &tmp[2]) == 3)(*count)++;

		rewind(f);
		HUD_VERTEX vert[(*count)];
		memset(vert, 0, sizeof(vert));
		for(int i = 0; i < (*count); i++)
		{
			fscanf(f, "%g %g %g", &(vert[i].x), &(vert[i].y), &(vert[i].z));
			if(ferror(f))
			{
				fclose(f);
				return hr;
			}
		}
		fclose(f);

		int byteLen = sizeof(vert);
		hr = g_device->CreateVertexBuffer(byteLen, D3DUSAGE_WRITEONLY, HUD_VERTEX_fvf, D3DPOOL_MANAGED, buffer, NULL);
		if(FAILED(hr))return hr;

		void *ptr = NULL;
		hr = (*buffer)->Lock(0, 0, &ptr, 0);
		if(FAILED(hr))return hr;

		memcpy(ptr, vert, byteLen);
		hr = (*buffer)->Unlock();
		if(FAILED(hr))return hr;
	}
	fclose(f);
	return hr;
}


And here
HRESULT Device_Render(IDirect3DVertexBuffer9 *buffer, int count)
{
	HRESULT hr = D3D_OK;
	hr = g_device->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_COLORVALUE(1.0, 1.0, 1.0, 1.0), 0.0, 0);
	if(FAILED(hr))return hr;

	hr = g_device->BeginScene();
	if(FAILED(hr))return hr;

	g_device->SetFVF(HUD_VERTEX_fvf);

	g_device->SetStreamSource(0, buffer, 0, sizeof(HUD_VERTEX));
	g_device->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, count);

	g_device->EndScene();
	g_device->Present(NULL, NULL, NULL, NULL);
}

GeneralRe: RAW Triangle Format: How to parse it properly Pin
El Corazon23-Jun-10 6:45
El Corazon23-Jun-10 6:45 
GeneralRe: RAW Triangle Format: How to parse it properly Pin
ant-damage23-Jun-10 7:01
ant-damage23-Jun-10 7:01 
GeneralRe: RAW Triangle Format: How to parse it properly Pin
El Corazon23-Jun-10 7:03
El Corazon23-Jun-10 7:03 
GeneralRe: RAW Triangle Format: How to parse it properly Pin
ant-damage23-Jun-10 8:08
ant-damage23-Jun-10 8:08 
GeneralRe: RAW Triangle Format: How to parse it properly Pin
ant-damage23-Jun-10 8:16
ant-damage23-Jun-10 8:16 
GeneralRe: RAW Triangle Format: How to parse it properly Pin
El Corazon23-Jun-10 8:21
El Corazon23-Jun-10 8:21 
GeneralRe: RAW Triangle Format: How to parse it properly Pin
ant-damage24-Jun-10 9:41
ant-damage24-Jun-10 9:41 
GeneralRe: RAW Triangle Format: How to parse it properly Pin
El Corazon24-Jun-10 10:03
El Corazon24-Jun-10 10:03 
QuestionRead an executable and write the data to a file. Pin
ALLERSLIT23-Jun-10 5:14
ALLERSLIT23-Jun-10 5:14 
AnswerRe: Read an executable and write the data to a file. Pin
Not Active23-Jun-10 5:26
mentorNot Active23-Jun-10 5:26 
GeneralRe: Read an executable and write the data to a file. Pin
harold aptroot23-Jun-10 5:31
harold aptroot23-Jun-10 5:31 
GeneralRe: Read an executable and write the data to a file. Pin
Not Active23-Jun-10 6:00
mentorNot Active23-Jun-10 6:00 
GeneralRe: Read an executable and write the data to a file. Pin
harold aptroot23-Jun-10 6:15
harold aptroot23-Jun-10 6:15 
AnswerRe: Read an executable and write the data to a file. Pin
Code-o-mat23-Jun-10 5:28
Code-o-mat23-Jun-10 5:28 
GeneralRe: Read an executable and write the data to a file. Pin
ALLERSLIT23-Jun-10 5:46
ALLERSLIT23-Jun-10 5:46 
GeneralRe: Read an executable and write the data to a file. Pin
Code-o-mat23-Jun-10 6:38
Code-o-mat23-Jun-10 6:38 
AnswerRe: Read an executable and write the data to a file. Pin
ant-damage23-Jun-10 5:48
ant-damage23-Jun-10 5:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.