Jump to content

  • Log In with Google      Sign In   
  • Create Account

Zaoshi Kaba

Member Since 04 Nov 2012
Offline Last Active Yesterday, 09:43 AM

#5177680 For-loop-insanity

Posted by on 02 September 2014 - 10:51 AM

Since we are trying to come up with new, obscure, and complicated ways for counting up, how about this

Somehow I can see Java programmer actually doing this.

#5177206 Font Rendering Woes (FreeType)

Posted by on 31 August 2014 - 08:19 AM

Are you sure this is not .jpg artifact? I'm not sure how good quality is on those.

#5175284 DirectX with or without Visual Studio 2013

Posted by on 21 August 2014 - 08:52 AM

D3DX is Direct3D Extension, which included texture loading and other things, it's not DirectX API. It has been removed in some version and you have to implement that yourself.

I think DirectX Tool Kit implements most things D3DX used to have.

#5174257 Thesis idea: offline collision detection

Posted by on 17 August 2014 - 07:13 AM

I don't feel this is possible.

You'd need 2 transformation matrices per situation. Even if you do accuracy of 1 degree you get 360 * 360 * 360 = 46,656,000 combinations. Add to that matrix size of 16 * 4 * 2 = 128 and it's suddenly 6 gigabytes of data and you still haven't taken into account translation or scaling.


Unless I have wrong idea...

#5172366 How to make 3D Character move to a specific point

Posted by on 08 August 2014 - 04:28 PM

You should figure vectors; it's along the lines of:

difference = destination - position;
direction = normalize(difference);
movement = direction * move_speed;

#5172351 DXGI leak warnings

Posted by on 08 August 2014 - 03:24 PM

Refcount of 0 means object has been released but not destroyed yet. It'll happen sometime later, don't worry about these.

IntRef of >= 1 means object is bound (PSSetShader, etc), shouldn't worry about these either, they'll get destroyed once possible.


Though you have some objects with massive amount references:

Live ID3D11RasterizerState at 0x009E872C, Refcount: 2337

Live Object at 0x00BCC7BC, Refcount: 448.


Are you sure you don't have regular memory leaks leading to objects not being destroyed?

Do you destroy all ComPtr before releasing device?

#5172130 Inertia Causing Extremely odd effects.

Posted by on 07 August 2014 - 03:03 PM

That's weird. Could you try to replace your main / WinMain method with this code just to test whether you get correct results with minimal code?

And of course you'll need to fix Bullet paths.

#include <iostream>
using std::cout;
#include <DirectXMath.h>
using DirectX::XMFLOAT3;
#include "../Bullet Physics/btBulletCollisionCommon.h"
#include "../Bullet Physics/btBulletDynamicsCommon.h"
#pragma comment(lib, "../x64/Debug/Bullet Physics.lib")

btRigidBody* addRigidSpehere(float rad, XMFLOAT3 position)
	btTransform t;
	t.setOrigin(btVector3(position.x, position.y, position.z));

	btSphereShape* sphere = new btSphereShape(rad);

	//calculate inertia
	btVector3 inertia(0.0, 0.0, 0.0);
	sphere->calculateLocalInertia(1.0, inertia);

	btMotionState* motionState = new btDefaultMotionState(t);
	btRigidBody::btRigidBodyConstructionInfo info(1.0, motionState, sphere, inertia);
	btRigidBody* sphereBody = new btRigidBody(info);

	return sphereBody;

void main() {
	auto bulletConfiguration = new btDefaultCollisionConfiguration();
	auto bulletDispatcher = new btCollisionDispatcher(bulletConfiguration);
	auto bulletBroadPhaseInterface = new btDbvtBroadphase();
	auto bulletSolver = new btSequentialImpulseConstraintSolver();

	auto bulletWorld = new btDiscreteDynamicsWorld(bulletDispatcher, bulletBroadPhaseInterface, bulletSolver, bulletConfiguration);
	bulletWorld->setGravity(btVector3(0, -10, 0));

	btTransform t;
	t.setOrigin(btVector3(0, 0, 0));

	btStaticPlaneShape* plane = new btStaticPlaneShape(btVector3(0, 1, 0), 0.0);
	btMotionState* motionStatePlane = new btDefaultMotionState(t);
	btRigidBody::btRigidBodyConstructionInfo info(0.0, motionStatePlane, plane);
	btRigidBody* planeBody = new btRigidBody(info);


	auto sphere = addRigidSpehere(1, XMFLOAT3(0, 3, 0));

	while(1) {
		bulletWorld->stepSimulation(1.0 / 60.0);
		cout << sphere->getWorldTransform().getOrigin().getX() << ", ";
		cout << sphere->getWorldTransform().getOrigin().getY() << ", ";
		cout << sphere->getWorldTransform().getOrigin().getZ() << "\n";

#5172100 Inertia Causing Extremely odd effects.

Posted by on 07 August 2014 - 01:13 PM

I probably have 2.82 too. Are you sure you're not modifying it somewhere accidently; like force, velocity, or position?

I used this loop and a debugger to inspect values:

	while(1) {
		bulletWorld->stepSimulation(1.0 / 60.0);
		OutputDebugString(L", ");
		OutputDebugString(L", ");

First few values are 3.0 and lower, but eventually it stops at 0.000000, 1.000000, 0.000000 and just spams that.

(seems debugger and outputting to debug console gives different numbers; rounding?).

#5172090 Inertia Causing Extremely odd effects.

Posted by on 07 August 2014 - 12:27 PM

I am unable to reproduce this problem. I copy pasted your code and sphere stops at position {0.000000000, 0.999999821, 0.000000000, 0.000000000}.

#5171808 Interrupt handling very slow

Posted by on 06 August 2014 - 03:03 AM

I noticed a lot of people make mistake of using if(PeekMessage(&message, 0, 0, 0, PM_REMOVE)) instead of while(...) inside game loop, this might be source of the problem.

#5170975 Isn't "delete" so pesky to type? Wish there was a better way?

Posted by on 01 August 2014 - 03:54 PM

I am disturbed by how legit this thread sounds.

#5170613 [Questions] First RenderLoop with Fixed Time-Step and Animations ...

Posted by on 31 July 2014 - 09:23 AM

Basically I want to make sure my RenderLoop runs properly

Define properly. Most would say you need to use fixed time step to have proper game loop. There's a link in your code, and if that isn't sufficient I can also suggest this article.


running at the Time I've intended them to run independent of the FPS

You just measure time since last frame and move everything by that much. For example, your character moves 2 m/s, so you multiply that by time elapsed in seconds and you get distance character moved since last frame. This will happen in your Update() function.


However, if you are using fixed time step then elapsed time in Update() function will be constant, ex. 0.03(3) seconds if you want 30 UPS (updates per second). Then your Render() function interpolates between last position and current position (it's explained in the article I linked earlier).

#5170576 [Questions] First RenderLoop with Fixed Time-Step and Animations ...

Posted by on 31 July 2014 - 06:14 AM

I might be the only one, but so far I cannot understand what you're trying to do or what is your question.


So far I can only try to answer first question in original post.

The code you posted:

FrameTime = (double)_StopWatch.ElapsedTicks / (Stopwatch.Frequency / 1000);

Stopwatch.Frequency is number of ticks per second, therefore I fail to understand why you divide by 1000 (esp. why integer).

If you want time passed in seconds then you should be doing this:

FrameTime = (double)_StopWatch.ElapsedTicks / (double)Stopwatch.Frequency;

However there's one more thing I'd like to mention:

public void Frame()
	_StopWatch.Stop(); // time stops

	FrameTime = (double)_StopWatch.ElapsedTicks / (double)Stopwatch.Frequency;
	LastUpdated = Stopwatch.GetTimestamp();

	_StopWatch.Restart(); // time restarts
	// but did it count time that passed between Stop and Restart calls?

#5169723 Drawing fullscreen triangle without vertex buffers

Posted by on 28 July 2014 - 06:24 AM

  1. Is black your clear color?
  2. You return alpha of 0.0f, depending on blending settings which we cannot see your pixels might do nothing;
  3. Set correct primitive topology (TRIANGLESTRIP);
  4. You need to draw 4 vertices to make a quad, at the moment you have only 3;
  5. It doesn't seem you need depth buffer at all; don't bind it.

#5168017 looping through struct array

Posted by on 20 July 2014 - 03:42 PM

Well that's more or less correct thinking.

Use vector<string> which doesn't have size limit and you can retrieve number of items without making own extra variable.