Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 26 Mar 2010
Offline Last Active Feb 03 2015 11:52 AM

#5116022 Designing an efficient multithreading architecture

Posted by Six222 on 10 December 2013 - 04:21 PM

If you haven't already take a look at how Doom 3 BFG handles threads: http://fabiensanglard.net/doom3_bfg/index.php

#5093008 Separating API specific code from the rest of the framework

Posted by Six222 on 10 September 2013 - 07:54 AM

The key thing is to wrap it all around in a nice interface, going back to the vertex buffer you could have an interface that defines how to access it (create, map data, etc.) then for example you could have a GLVertexBuffer and an DXVertexBuffer class that derives from the interface. This way you hide the implementation and let your render system decide which one it wants to use.

#5056519 random numbers in for loop (rand())

Posted by Six222 on 24 April 2013 - 06:53 PM

Maybe because this is a simple asteroids game? Does he need to bother with new fancy C++11 features at this time?

Well it's well worth the read even if he is making a simple game. C++ 11 offers better ways of doing things such as the new random which can create a better distributed random number...

#4833330 Please help me

Posted by Six222 on 10 July 2011 - 08:20 AM

thnx man and whats the best language to start from?


Most game development companies these days use C++ but as has been said before, it is a fairly complex language with lots of techniques to learn and will take you a good year before you'll be comfortable with the language... My advice right now would be to get the idea of wanting to make a full MMO game out of your mind as it probably won't be reachable for a very long time. Right now i would start to learn the basics of how a computer actually works, how it processes data, what it does with the data etc. and learn a programming language i would recommend learning c# as it's fairly easy to pick up and will teach you the core programming ideas that you can then work your self up to C++ and once your comfortable with that you can go and start learning a graphics API such as XNA, DirectX, OpenGL etc. But be warned game/graphics programming is VERY mathematical.

#4824266 DX11 - If I create shaders instead of effects how do I GetVariableByName

Posted by Six222 on 16 June 2011 - 04:26 PM

If i'm correct this is how you should use them...

cbuffer ConstBuffer : register(b0)
	float4x4 SomeMatrix;
	float3 Offset;

struct VSOut
    float4 Col : COLOR;    // vertex color
    float4 Pos : SV_POSITION;    // vertex screen coordinates

// the vertex shader
VSOut VertexSH( float4 Col : COLOR, float4 Pos : POSITION)
    VSOut Output;
    Output.Pos = mul(Pos, SomeMatrix);    // set the vertex position to the input's position
    Output.Pos.x += Offset.x;
    Output.Col = Col;    // set the vertex color to the input's color

    return Output;    // send the modified vertex data to the Rasterizer Stage

C++ File

ID3D10Buffer* g_pConstantBuffer = NULL;

//This Is important... this struct MUST be aligned properly with the cbuffer defined in the shader file
struct OffsetMatrix
	D3DXMATRIX SomeMatrix;
	D3DVECTOR3 Offset;

//create the buffer

ZeroMemory(&bd, sizeof(bd));
bd.Usage = D3D10_USAGE_DEFAULT;
bd.ByteWidth = sizeof(OffsetMatrix); //Shouldn't really use sizeof() as this param must ALWAYS be a multiple of 16 always better off to set the value yourself
	if(FAILED(D3DDevice->CreateBuffer(&bd, NULL, &g_pConstantBuffer)))

OffsetMatrix some;

some.SomeMatrix=  Renderer->GetFinalMatrix();
some.Offset = D3DVECTOR3(0.7f, 0.5f, 0.0f);
D3DDevice->UpdateSubresource(g_pConstantBuffer, 0, 0, &some, 0, 0); //This is how you copy data over into the GPU

/The first param is important... remember back in the shader we have ": register(b0)" well the first param is basically how you select each constant buffer, if you had a second constant buffer with : register(b1) at it this function would become D3DDevice->VSSetConstantBuffers( 1, 1, &g_pSomeOtherConstantBuffer ); 
D3DDevice->VSSetConstantBuffers( 0, 1, &g_pConstantBuffer ); 

I hope this helps... i'm not the best person at explaining stuff

#4824209 DX11 - If I create shaders instead of effects how do I GetVariableByName

Posted by Six222 on 16 June 2011 - 02:10 PM

Take a look into Constant Buffers, these should point you in the right direction


Also take a look in the "Tutorial 07: Texture Mapping and Constant Buffers" project on the DirectX Sample Browser for DX11 and DX10 or the "HLSLWithoutFX" for DX10

#4819953 Using 1 Large VB... Drawing Simple Rectangle

Posted by Six222 on 05 June 2011 - 09:00 PM

Hey there don't worry about the english... Your not actually copying the data into the vertex buffer
stVertexTex1* v = NULL;
v[0] = stVertexTex1( -2.0f, -0.5f, 0.0f, 0.0f, 1.0f );
v[1] = stVertexTex1( -2.0f, 0.5f, 0.0f, 0.0f, 0.0f );
v[2] = stVertexTex1( 2.0f, 0.5f, 0.0f, 1.0f, 0.0f );
v[3] = stVertexTex1( 2.0f, -0.5f, 0.0f, 0.0f, 1.0f );
void* pData;
pMesh->LockVertexBuffer( 0, (void**)&pData );
memcpy(pData, stVertexTex1, sizeof(v));

#4812497 Pointer Arithmetic and Delete

Posted by Six222 on 18 May 2011 - 07:11 AM

It is legal yes... but it's generally not safe.

#4802782 Should I Only draw between Sprite->Begin and Sprite->End()?

Posted by Six222 on 25 April 2011 - 01:33 PM

what about instructions like if, switch etc...? Can I put them between Sprite->Begin() and Sprite->End()? For example:

If(shoot == true) Draw()...
Or only drawing?:P

You can do yeah, but it's best to minimize the amount of time spent drawing, to improve fps etc. It would be better before rendering you were to decided what gets rendered and what doesn't.