Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 23 Jun 2012
Offline Last Active Yesterday, 08:30 PM

#5257726 Checking if a bit is set, when it's not the first

Posted by noatom on 17 October 2015 - 05:11 PM

bool is_set(uint x, uint bit)
  return ((x >> bit) & 0x01);

Think thats right smile.png



Yeah, that makes a hell of a lot more sense than my logic. Thank you 

#5254780 vector push_back creates error when multi threading

Posted by noatom on 30 September 2015 - 07:56 AM

thanks for the answer. And no, im not using this code, it was just a very simple replication of the problem.

#5243663 D language code question

Posted by noatom on 30 July 2015 - 03:57 PM

protected string delegate() getTimePeriod()
immutable string[] months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];

string path     = buildPath(this._config.path.officialDirectory, "test");

return delegate()
	auto time = Clock.currTime();
	return format("%s/%d/%s/savedData.log", path, time.year, months[time.month - 1], time.day);

My problem here, is the return type. Its a delegate. However, at the end of the function, I don't really understand what the delegate that is returned, points to.


I mean, format returns just a string, not an actual function. So the delegate points to...a string?

#5238638 C++ signed char and unsigned char question

Posted by noatom on 06 July 2015 - 11:50 AM

unsigned char foo = 253;
signed char foo2 = static_cast<signed char>(foo);
cout << foo2;
So, a signed char is supposed to store a value between -127 and 127.
My unsigned char, has a value of 253, which is then cast to a signed char.
How come, that when the code runs, I still see the correct ASCII symbol, even though I am using a signed char?!


#5164175 How is this a pass by value?!

Posted by noatom on 01 July 2014 - 06:20 PM




I can't believe I didn't notice this:


I failed so hard because I was thinking about objects. You know, you have an object, and 2 pointers, a pointer points to it, and you make the second pointer point to it too, and no matter which pointer changes something about the object(using the dereference op, which is not used here, another triple facepalm for me), the other pointer will obviously see the change too.


Here, the situation was more like: the 2 pointers point to the same object, but later one of them is made to point to another different object...

void set(char const *&value)

There you took a reference to a pointer, and of course doing any change inside the function is actually made to the pointer outside the function.




You could've in a way, modify the outside char array if you could use the dereference operator, but since the array is constant(because its a literal), there is no way in which you can change the array.(ONLY if you were to dynamicly allocate it, you could freely change the array) and of course, not take a pointer to a constant value as an argument.


I explained it so if anyone will ever have the same problem as me, will see things the clear way.(MASSIVE HINT: Look for the GODDAMN dereference operator damn it!)


I'm literally cringing in shame when I think about this....oh god....


Thanks Brother Bob smile.png

#5135112 Using the same message processor but closing only 1 window

Posted by noatom on 27 February 2014 - 12:07 PM

Because I didn't know about EndDialog untill now,so thanks sleep.png

#5133864 Function call is jumped!

Posted by noatom on 23 February 2014 - 09:01 AM

Heh stop bashing your heads with this, I just disabled the optimizations in Visual Studio and it worked. I'm not really sure what kind of optimizations VS does if it excluded a function call like that but... that's it.

#5133796 Render directx in only a portion of a window

Posted by noatom on 23 February 2014 - 03:59 AM

Yea apparently using a viewport won't work since the backbuffer will still be created by default to fill the entire window. You simply cannot specify a custom buffer size. So,by using a viewport you will have all the space that is nonrendered black, and if you decide to put buttons or other controls in that space, there will be problems with rendering.


The only solution is to actually render in a control like a tab.

#5130371 Concatenating indices for meshes

Posted by noatom on 10 February 2014 - 02:19 PM

I'm basically trying to get all the data from all the meshes and put them into a single buffer(a buffer for vertices,one for indices). The models are of TriangleList type.


Here's how I'm currently doing it:

vector<unsigned long> finall_indices;
	unsigned long indices_before_adding = 0;
	for (long long i = 0; i < meshes.size(); i++){
		for (long long s = 0; s < meshes.at(i)->index_queue.size(); s++){
			finall_indices.push_back(meshes.at(i)->index_queue.at(s)+ indices_before_adding);
		indices_before_adding += meshes.at(i)->index_queue.size();

However,there are some problems,like missing quads. The indices are fine,because I tested them when I did not put all the mesh data together.


What am I doing wrong?






To indices_before_adding should be added the nr of vertices in the last mesh,every time a new mesh's indices are added to the finall_indices mesh.

#5129823 Physics for a game

Posted by noatom on 08 February 2014 - 07:36 AM

Right now I have the basic velocity and gravity,and all is good. The problem is,when the player jumps and goes forward,the falling speed(and just the way the player falls is not that realistic).


If I increase the gravity,the player will come back to earth too fast,making it more unrealistic. Does anybody know some kind of guide for handling this type of stuff?

#5128401 c++11 move constructor question

Posted by noatom on 03 February 2014 - 06:25 AM

Suppose I have the following:


class Test {};


Test a;

vector<Test> v;



Basically,now a has been moved to the vector(so it is a part of the vector now),but,what happens if I try to access the original a?(not the one that is in the vector now?)

#5128029 My singleton class is not so singleton

Posted by noatom on 01 February 2014 - 03:36 PM

Yes,that was the problem. I don't usually define functions in headers...but this time I did,and look what happened!


Thanks a lot

#5127422 Should I add any Nvidia intro if I use PhysX?

Posted by noatom on 30 January 2014 - 04:00 AM

B. For Games, Demos, and Videos that incorporate the PHYSX SDK or portions thereof, the NVIDIA
logos must appear:

a. on the back cover of the instruction manual or similar placement in an electronic file for the purpose of acknowledgement/copyright/trademark notice;
b. on external packaging;
c. during opening marquee or credits with inclusion of “NVIDIA”;
d. must appear on title marketing feature list with a specific call-out of NVIDIA PHYSX Technology
e. on the credit screen; and
f. in the “About” or “Info” box menu items (or equivalent) of all Physics Games or Applications using any portion of the PHYSX SDK.



Ok,but don't they provide any links where I can download the material(the logos,etc)?

#5127394 Should I add any Nvidia intro if I use PhysX?

Posted by noatom on 30 January 2014 - 01:02 AM

So,I'm using PhysX,and I was wondering,do I have to add a Nvidia intro/logo/anything because I'm using it in my demos?

#5127182 Why doesn't screen tearing happen at 5 fps?

Posted by noatom on 29 January 2014 - 06:15 AM

This is one of those stupid questions...but yeah,i couldn't get it out of my head so I had to ask.


Normally,screen tearing happens when there are more than 60 fps rendered,since the flipping is done before the monitor finishes rendering what is on the front buffer.


But,why doesn't it happen below 60 fps too? How is it that it's always synchronized,so it NEVER happens that a flip is done when the monitor is still rendering from the front buffer?