It's ok! And thanks, it helped!
ant damage
Posts
-
Help on snippet -
Reading CPU Temperature (including each core temperature) without third party toolsIt 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
-
Reading CPU Temperature (including each core temperature) without third party toolsI'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
-
Reading CPU Temperature (including each core temperature) without third party toolsI'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
-
Making a connection through serial from mobile to pcI'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.
-
RAW Triangle Format: How to parse it properlyBy the way, which formats do you use?
-
What does mean "struct foo f = {0};"?That is exactly what I wanted to know. Thanks.
-
What does mean "struct foo f = {0};"?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?
-
Help on snippetHi 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 = 0for 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.
-
What does mean "struct foo f = {0};"?struct foo
{
int i;
};foo f = {0}; // <- What does this mean?
-
RAW Triangle Format: How to parse it properlyThe RAW Triangle Format is parsed by reading lines, not individual values. That was what I didn't know.
-
RAW Triangle Format: How to parse it properlyI think that I've found the solution for my problem here.
-
RAW Triangle Format: How to parse it properlyBlender is outputting a strange kind of list of triangles. For instance, a circle, it seems that Blender is outputting a triangle fan.
-
RAW Triangle Format: How to parse it properlyBy 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);
}
-
RAW Triangle Format: How to parse it properlyYes. 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 -
Read an executable and write the data to a file.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.
-
RAW Triangle Format: How to parse it properlyHi 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.
-
Emulating a serial communication through RFCOMMHi 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#
-
Making a connection through serial from mobile to pcHello 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.
-
Getting integer values (not double-precision) from a slider (trackbar)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