Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 25 Feb 2008
Offline Last Active Apr 30 2016 08:20 AM

Topics I've Started

HLSL stencil functions to OpenGL

09 November 2011 - 01:37 PM


I'm in the middle of porting some HLSL shaders to opengl (with CG) and I'm struggling a bit with the correct opengl stencil statements...
I have to states that need to be set for the stencil buffer :

//first onea
StencilEnable = true;
StencilPass = REPLACE;
StencilRef = 1;

StencilEnable = true;
StencilPass = KEEP;
StencilFunc = EQUAL;
StencilRef = 1;

I thought it would be this but it looks wrong sometimes. Withing my directX project, I'm clearing the backbuffer with stencil value 0
//first one
glStencilFunc(GL_ALWAYS, 1, 1); 

//second one
glStencilFunc(GL_EQUAL, 1, 1);

So, can anybody verify if this is correct (and what would needed to be changed)?


[C++] Arithmetic operations with boost::dynamic_bitset

15 April 2010 - 07:11 AM

hi Is it possible to do an arithmetic operation on 2 boost::dynamic_bitsets ?? say I want to do something like this :
boost::dynamic_bitset<> a(3,3);
boost::dynamic_bitset<> b(3,3);
boost::dynamic_bitset<> c(3,0);
c = a+b; //I would want c to have a value of 6 (110)

there is no support for the arithmetic operators but say I do want this, can anybody point me into the right direction? cheers

C++ : data alignment

30 March 2010 - 01:20 AM

hi, If you want to align data during an optimization of a (C++) program, But should I align to (2^n) or to ((2^n)-1) ?? My structure has at the moment a size of 24, so I want to align it to 32, or should I start counting from zero and align it to 31?? cheers

[OGRE] manualobject vs stencil shadows

09 March 2010 - 10:26 AM


this is an ogre project :)
I'm trying to have a manualobject cast stencil shadows.
the manual states that if you want this, you have to define the indices and I have done that :)
now the problem is that the shadows aren't working at they should :(
the shadows are totaly wrong and whenever I move the camera, the are following me (they look like some kind of overlay).
some code about what I do :
ManualObject* manual = mSceneMgr->createManualObject("manual");
		manual->begin("CubeMTL", RenderOperation::OT_TRIANGLE_LIST );
		std::vector<OBJTriangle>::iterator it = TriangleList.begin();
		int ind = 0;
		for (;it!=TriangleList.end();++it)
			OBJTriangle current = (*it);
			for (int i = 0;i<3;++i)
				int blabla = ind*3 + i;
		SceneNode* mm = SceneMgr->getRootSceneNode()->createChildSceneNode("manualobj",Vector3(0,0,0));

as you can see, I'm parsing an obj file (School assignment).
I know for sure that the indices are correct, c'se I don't really need them (when in comment, the model stays the same) and when I change them (cf. int blabla = ind*3 - i;), the model is drawn wrong...
So, what I'm I doing wrong/forgetting ??


convert matrix

23 February 2010 - 05:46 AM

hi all, I'm using the PhysX libraries for collision checking in my project but I come upon a problem... I need to set the matrix of the visual object the same as the matrix of the PhysX actor and that's were it goes wrong : my X-axis is the opposite of the one that PhysX uses so everything is mirrored. for translations, this isn't a problem (just reverse the x value) but for the rotations it is.. so, how can something like this be done? I tried some stuff but it all doesn't seem to work :( thx PS.: I'm not using DirectX / OpenGL and trying to change the direction of the X-axis is NOT an option