Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 28 May 2012
Offline Last Active Jun 29 2015 08:53 AM

#5236872 Learning Direct3D Programming properly

Posted by on 26 June 2015 - 12:43 AM

Hi GameDev community, it's been a while!
I've been doing hobby game programming for a few years now, but I feel like considering how long I've been doing it for, I am nowhere near as fluent with it as I should be.
I learned all that I know about DirectX 9 programming from www.directxtutorial.com and while I feel that was a decent start, I feel like I've missed learning a lot of things that is therefore limiting my ability to program.
I've been able to make basic games in the past with not much of an issue, but now I decided to take on my biggest personal project so far, which is nothing huge, just a Doom-style FPS, and I'm quickly finding that I'm on the internet looking for help on things that I feel I should already know how to do.
That said, I'm wondering if anyone here can point me to a good resource (website/book/anything) on learning to program in DirectX properly.
I had a look through the documentation that ships with the DXSDK but it doesn't make a lot of sense to me. 
I need something that will start with the basics again, and not only tell me what to do but explain /why/ it works that way so that I can retain the information without it just being a bunch of jargon.
I'm still using Direct3D 9 functions, I've been meaning to learn Direct3D 11 functions but looking over it briefly it seems a lot more complex and I've been putting it off because of that.
So my questions are as follows:
-Do I need to learn to use 9 effectively before migrating to 11?
-What is a good resource to start learning to program in DirectX effectively and know what I'm actually doing?
Thanks in advance.

#5041697 error lnk2001

Posted by on 10 March 2013 - 09:18 PM

Hey GameDev :)


Just a quick one today, I can't seem to figure out why this code:


#include <d3d9.h>
#include <d3dx9.h>
#pragma comment (lib, "d3d9.lib")
#pragma comment (lib, "d3dx9.lib")
class Player
static D3DXVECTOR3 paddlePosition;
static RECT paddleTexture;
static void Initialize(LPDIRECT3DDEVICE9* d3dDevice);
static void Draw(LPD3DXSPRITE sprite, LPDIRECT3DTEXTURE9* texture);
static void Update();
void Player::Initialize(LPDIRECT3DDEVICE9* d3dDevice)
paddlePosition = D3DXVECTOR3(0, 0, 0);
paddleTexture.bottom = 28;
paddleTexture.left = 0;
paddleTexture.right = 136;
paddleTexture.top = 0;
void Player::Draw(LPD3DXSPRITE sprite, LPDIRECT3DTEXTURE9* texture)
sprite->Draw(*texture, &paddleTexture, &D3DXVECTOR3(0, 0, 0), &paddlePosition, D3DCOLOR_ARGB(255, 255, 255, 255));
void Player::Update()


Feels like telling me this: 

Error 1 error LNK2001: unresolved external symbol "private: static struct tagRECT Player::paddleTexture" (?paddleTexture@Player@@0UtagRECT@@A)

Error 2 error LNK2001: unresolved external symbol "private: static struct D3DXVECTOR3 Player::paddlePosition" (?paddlePosition@Player@@0UD3DXVECTOR3@@A)


Could I get one of you lovely people to help me out? :)

#4994078 Why is my code giving me Error C2027 "use of an undefined type"

Posted by on 26 October 2012 - 02:51 AM

In C++, unless you know exactly what you are doing, always start with the first error and look at that error only. C++ is such a complex language, an error can produce such weird problems that all errors after that do not make any sense without having dealt with the initial problem first.

Yeah well the first error told me that Camera was being redefined but I made the mistake of ignoring it and trying to fix the one I thought most important first. As it turns out, by fixing the first error, I'd fixed the others too.

Lesson learned :)

#4991600 Can make money with flash games

Posted by on 18 October 2012 - 05:50 PM

You can also sell Flash games instead of going the sponsor/ad route. I believe McPixel is a flash game and that is now sold as a stand alone game on Steam. I don't think there's anything inherently limiting when it comes to selling a flash game outside of needing to target platforms that support Flash.

This is correct. Steam can and does vend Flash games.

#4990747 What makes Debug different from Release?

Posted by on 16 October 2012 - 09:05 AM

When you're in Release mode you're sacrificing a lot of the runtime debugging Visual Studio does. In reality, however, your array is trashed in both Debug and Release mode. In Release mode you just can't tell because you're not debugging it! Posted Image

I would suggest going into Debug mode and stepping through your code to find where the problem is.

#4956131 Global variables in comparison to #define

Posted by on 05 July 2012 - 04:50 PM

As far as I can understand, if you use the pre processor command #define, for example, #define money 100, it'll replace all the instances of "money" and replace them with 100. As far as I know it is global and can be used all over your code?

What is the point of using #define instead of a global variable? Don't they pretty much do the same thing?
What's the difference between the two?

#4955505 Collision Detection + Classes

Posted by on 03 July 2012 - 07:56 PM

I've followed how to do it but as I've used classes instead of structs, it doesn't work.

FTR: C++ Structs and Classes are, for the most part, identical. Therefore there is something else causing your code to fail

#4952558 Questions on 3D Game Development Process

Posted by on 24 June 2012 - 10:33 PM

The code for animating a mesh is too long for me to write up right now (I'm in school) but I can write a sample of how you'd go about loading and drawing a mesh stored in an X file using Direct3D 9:

LPD3DXMESH mesh;     //mesh object to store the loaded mesh
DWORD numberOfMaterials;     //stores number of materials in the mesh
D3DMATERIAL9* materialArray;     //array to store the materials in
LPD3DXBUFFER materialBuffer;

D3DXLoadMeshFromX(L"filepath", D3DPOOL_MANAGED, &d3dDevice,
     NULL, &materialBuffer, NULL, &numberOfMaterials, &mesh);          //Loads a mesh from a *.x file

D3DXMATERIAL* temp = (D3DXMATERIAL*)materialBuffer->GetBufferPointer();

materialArray = new D3DMATERIAL9[numberOfMaterials];

for (DWORD i = 0; i < numberOfMaterials; ++i)
     materialArray[i] = temp[i].MatD3D;

//in your drawing code:

for (DWORD i = 0; i < numberOfMaterials; ++i)

//finally in your cleanup code remember to release and deallocate memory:

delete[] materialArray;

That will load a mesh at it's most basic (without textures) forgive me if there is errors, it's rushed and I'm at school so I couldn't test the code first

#4952547 Questions on 3D Game Development Process

Posted by on 24 June 2012 - 09:46 PM

How can 3D graphical resources be used in applications that use opengl or directx?

3D meshes come in different formats, there is as you said .obj, also .x and .fbx and heaps of other choices or can be programmed (tediously) vertex by vertex

If one can import animating objects from Maya or Blender, can I consider this object similar to animated GIF image on the web?

Animated meshes have an extra dimension than a .gif so they would not be treated as a 2d image. It wouldn't make sense

If importing an animating object is not preferred in the industry, do they import the sprite sheets of the movement like old 2D games?

2D animation is done using sprite sheets still. To animate 3D objects you have to import the mesh and animation files

#4951555 Is it possible for me to get into the industry?

Posted by on 21 June 2012 - 06:34 PM

Hey gamedev

I was just reading through Tom Sloper's site and he made quite alot of remarks about people trying to get into the industry without college are just plain lazy and shouldn't bother.

I would love to be a programmer in the game industry, and I would do anything I can to get there.
My problem is that I am 17 and no longer live with my parents (for personal reasons) because I have things to pay for to keep myself off the streets, I don't think I can afford to go to university once I finish High School. It's not that I'm lazy, I would love to go to university. But I'm living off scraps as it is and will most likely not be able to afford it.

How hard will it be for me to get a career in the industry in programming? If I can at all? At the moment I've been learning C++ and using the DirectX API from books and tutorials.