Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
A

ant damage

@ant damage
About
Posts
51
Topics
12
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Help on snippet
    A ant damage

    It's ok! And thanks, it helped!

    Linux, Apache, MySQL, PHP c++ python database tools help

  • Reading CPU Temperature (including each core temperature) without third party tools
    A ant damage

    It could help but I never worked with WMI, so I will need a example of its use. I've just downloaded the WDK and I will try to read the temperature by making a driver. This could be fun! :D

    C / C++ / MFC asp-net hardware algorithms tools

  • Reading CPU Temperature (including each core temperature) without third party tools
    A ant damage

    I'm trying to use __readmsr() intrinsic function to get the temperature, but it keeps giving this error: "Unhandled exception at 0x000000013fd81009 in test.exe: 0xC0000096: Privileged instruction." It seems that rdmsr instruction must be executed in privileged mode. EDIT: Is there any way of switching from user-mode to kernel-mode instead of making a driver?

    modified on Tuesday, August 17, 2010 8:29 AM

    C / C++ / MFC asp-net hardware algorithms tools

  • Reading CPU Temperature (including each core temperature) without third party tools
    A ant damage

    I'm trying to make a program that reads the temperature from the cpu and then sends it to my arduino duemilanove, where I have a 4 digit 7-segment display. I've been searching for a while but found nothing about reading the temperature from cpu's DTS (Digital Thermal Sensors). I don't want to use CoreTemp or any other related tool. EDIT: By the way, I have a asus n61jq laptop with intel core i7 720QM

    C / C++ / MFC asp-net hardware algorithms tools

  • Making a connection through serial from mobile to pc
    A ant damage

    I'm using a Sony Ericsson w910i (not a smartphone). The purpose is to create a java applet for my phone, that enables it to comunicate with my laptop, through bluetooth. I searched online about this type of connection, but found nothing.

    Mobile csharp hardware tutorial

  • RAW Triangle Format: How to parse it properly
    A ant damage

    By the way, which formats do you use?

    C / C++ / MFC game-dev help tutorial

  • What does mean "struct foo f = {0};"?
    A ant damage

    That is exactly what I wanted to know. Thanks.

    C / C++ / MFC question

  • What does mean "struct foo f = {0};"?
    A ant damage

    And if we have

    struct point
    {
    float x;
    float y;
    float z;
    };

    struct face
    {
    point a;
    point b;
    point c;
    };

    face f = {0}; // <- This will initialize to zero the struct, and its elements?

    C / C++ / MFC question

  • Help on snippet
    A ant damage

    Hi I'm trying to convert a python script from blender to C++. The script is used to import 3D data from a file. Things have been going right until I got to this part of the script:

    # Generate verts and faces lists, without duplicates
    verts = []
    coords = {}
    index = 0

    for f in faces:
    if f: # Line might be blank
    for i, v in enumerate(f):
    try:
    f[i]= coords[v]
    except:
    f[i]= coords[v] = index
    index += 1
    verts.append(v)

    Since I don't know python, I need help to interpretate this part of the code.

    Linux, Apache, MySQL, PHP c++ python database tools help

  • What does mean "struct foo f = {0};"?
    A ant damage

    struct foo
    {
    int i;
    };

    foo f = {0}; // <- What does this mean?

    C / C++ / MFC question

  • RAW Triangle Format: How to parse it properly
    A ant damage

    The RAW Triangle Format is parsed by reading lines, not individual values. That was what I didn't know.

    C / C++ / MFC game-dev help tutorial

  • RAW Triangle Format: How to parse it properly
    A ant damage

    I think that I've found the solution for my problem here.

    C / C++ / MFC game-dev help tutorial

  • RAW Triangle Format: How to parse it properly
    A ant damage

    Blender is outputting a strange kind of list of triangles. For instance, a circle, it seems that Blender is outputting a triangle fan.

    C / C++ / MFC game-dev help tutorial

  • RAW Triangle Format: How to parse it properly
    A ant damage

    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);
    

    }

    C / C++ / MFC game-dev help tutorial

  • RAW Triangle Format: How to parse it properly
    A ant damage

    Yes. I used that tutorial from "drunkenhyena.com" to understand more about the direct 3d The code I'm working is huge. Here is the whole code. main.cpp

    #include "common.h"
    #pragma comment(lib, "d3d9")
    #pragma comment(lib, "user32")
    #pragma comment(lib, "gdi32")

    extern IDirect3D9 *g_d3d9;
    extern IDirect3DDevice9 *g_device;
    extern D3DPRESENT_PARAMETERS g_pparams;
    extern const unsigned Width;
    extern const unsigned Height;

    extern HRESULT Init_d3d9(IDirect3D9 **d3d9);
    extern void Init_pparams(HWND hwnd, D3DFORMAT format, D3DFORMAT depth, D3DPRESENT_PARAMETERS *pparams);
    extern HRESULT Init_device(IDirect3D9 *d3d9, HWND hwnd, D3DPRESENT_PARAMETERS *pparams, IDirect3DDevice9 **device);
    extern void Kill_d3d9(IDirect3D9 **d3d9, IDirect3DDevice9 **device);

    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;
    

    }

    // D3D related functions
    void Resources_Init()
    {
    }

    void Resources_Free()
    {
    }

    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);
    

    }

    LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
    {
    switch(message)
    {
    case WM_KEYDOWN:
    case WM_CLOSE:
    case WM_LBUTTONDOWN:
    PostQui

    C / C++ / MFC game-dev help tutorial

  • Read an executable and write the data to a file.
    A ant damage

    Are you asking how to find executable code inside a program and copy it to another file, in order to run it? If so, you have to learn the structure of the program.

    C / C++ / MFC question

  • RAW Triangle Format: How to parse it properly
    A ant damage

    Hi I'm creating a 3D app which the main purpose for it is to be a game engine renderer. The file format that I will use for geometry is the RAW Triangle, since it is very simple to understand. I've created a function able to read the entire 3d file and parse it to a IDirect3DVertexBuffer9. Things are going fine here, but the problem is when it becomes rendered. I'm not getting the full object rendered, it seems that file is corrupted.

    C / C++ / MFC game-dev help tutorial

  • Emulating a serial communication through RFCOMM
    A ant damage

    Hi I've been facing problems with this new type of connection, and I want some examples on how to establish a serial connection between my phone (SE w910i) and my laptop, through bluetooth. I'm not an expertise on this topic, even on this programming language. It was better if I could make java applets in C#

    Java csharp java tutorial

  • Making a connection through serial from mobile to pc
    A ant damage

    Hello everyone! I'm new on mobile development, so be gentle with me. I need some information about how to create a serial communication, like the way arduino is connected to computer, a serial protocol. I want to create an applet to communicate with a C# application, for data exchange.

    Mobile csharp hardware tutorial

  • Getting integer values (not double-precision) from a slider (trackbar)
    A ant damage

    Here is the point: Getting a number from the slider control and make it integer (a.k.a. removing fractional part) so that I can send it through the serial port When speaking about integers, it doesn't mean to be a 'int' variable, but in other words, a natural number

    C# hardware question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups