This is my *arghh* how does it work code.
#include "stdafx.h"
#include
using namespace std;
int b = 3;
void func(int ** i){
*i = &b;
}
int _tmain(int argc, _TCHAR* argv[])
{
int * p;
func(&p);
std::cout << (*p) << std::endl;
char a;
cin >> a;
return 0;
}
My second sweet snippet is cheap cheap openGL matrices.
This takes in an openGL matrix array, like you'd get from glLoadMatrix, then applies to a vector or vertex.
void TransformVector(float * m, Vector3d &v, Vector3d &d)
{
d.x = (m[0] * v.x) + (m[4] * v.y) + (m[8] * v.z) + m[12];
d.y = (m[1] * v.x) + (m[5] * v.y) + (m[9] * v.z) + m[13];
d.z = (m[2] * v.x) + (m[6] * v.y) + (m[10] * v.z) + m[14];
}
3 comments:
i would like you write about alpha blending c# managed with sprites =]
There's some basic blending stuff under 2:2 movement. But at the moment I'm not going to be writing anything more - sorry!
I have some time free after Christmas so I might expand / rewrite parts of the tutorials then.
okay thanks, uh nice page very usefull!
Post a Comment