Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

Conny14156

Member Since 27 Nov 2012
Offline Last Active Apr 12 2013 07:02 PM
-----

Topics I've Started

How to change the area size for DirectX SwapChain?

01 April 2013 - 04:49 PM

Hi,

I was wondeirng if it was possible and if its how would I be able to limit the area for the Chain Swapping to happend?

 

Basicly I have something like this

 

zPZl6rq.png

 

A simple window with a button that does nothing,

But when the program start to swap buffer I get something like

 

LOex7OQ.png

I think that even after I changed the viewport the swap still cover the whole window, 

is it somehow possible to like cut the window in half 

so the swap doesnt cover the whole window.

 


Casting without casting?

04 March 2013 - 05:51 PM

Hi

This may seems like a wierd question but is there a way to cast a base class upto a derived class (both is a pointer of the class ),

What I have is a derived class pointer that is inside a vector of baseclass pointers, my question is if I could get a derived class pointer from the vector without using 

(c style casting)

dynamic_cast

static_cast

as I got the impression from people that those things are bad, if there are no standard way to do this, would it be better if I Included a "Copy return" function in my base class (and ovverirde it from the derived class) where I would have something like this pseudo code down here?

class Base
{
//Magical Code here and there

base* Copy(const BaseToCopy);



//Magical Code here and there
}

base* Base::Copy(const BaseToCopy)
{
Base newBase;
//Magical Copy code from BaseToCopy into the newBase
return &newBase
}

std::vector<std::shared_ptr<Base>> test;

DerivedClass* testDerived;

testDerived = test[0]->Copy(&test[0]); 

As this would theoretical work am not sure if this is a good way to do it or not, or if there exist a more so called "elegant" way to do it.

 

 

 

P.S

If I just should cast, which of the cast should I use if I know 100% for sure which class it is? or should always go safe with dynamic_cast?


return std::map Question[Solved]!

28 February 2013 - 07:23 PM

Hi,

I just notice something very wierd today, when I try to return the std::map<string,ID3DResourceView*> value with help from map[std::string] I get the ID3D11ResourceView* pointer, but that only works when I return it two example I have in my code 

//While this work
return TotalTexture[textureName];


/*
This wont, Both is identical std::map<string,ID3D11ShaderResourceView*>, but the diffrent
is that this code down here insert the string instead with a null ID3D11ShaderResourceViewpointer. And I know its that line cause 
*/
ID3D11ShaderResourceView* pt;
pt = Model->Texture.Diffuse.Texture[Model->lastMaterial];	
Gfx->D3d11DevCon->PSSetShaderResources(0,1,&pt);//<---- Cause the next line here the map 
//had changed with one extra material with a null pointer. 

 

 


Map::Insert a COM Object question, about storing and releasing[Solved]

18 February 2013 - 02:28 AM

Hi,

This may seems as a weird question but, is this the correct way to "Store" a ID3D11ShaderResourceView* Pointer?

Am trying to store COM Object pointer inside a simple map with a std::string key.

I get no error's but when I quit the program it complains about unreleased objects.

Neither do I get a error when I try to release the "objects".

So I start to question my method about how to release it.

The reason why I am using a while loop with .empty(); is cause I can't seems to use the [] operator except for [0]. while am at it would appreciate if someone could explain that to >.<

 

		
ID3D11ShaderResourceView* t;
std::map<std::string,ID3D11ShaderResourceView*> TotalTexture;
std::vector<std::string> TotalTextureToLoad;
TotalTexture.insert
(
TotalTexture.end(),std::pair<std::string,ID3D11ShaderResourceView*>(TotalTextureToLoad[i],t)

);
while(!TotalTexture.empty())
{
	TotalTexture.begin()->second->Release();
	TotalTexture.erase(TotalTexture.begin());
}

 

 

 

 

 

    

Pointer array sizeof question?[Problem Found](Embarrassing problem)

29 January 2013 - 10:19 AM

Hi, I am trying to send the sizeof a array into the D3D11_BUFFER_DESC.ByteWidth By doing it like this [

 

code=:0]//Some other code

DWORD* indcies_D;indcies_D = new DWORD[Model.Total.Face * 3];

D3D11_BUFFER_DESC indexBufferDesc;ZeroMemory( &indexBufferDesc, sizeof(indexBufferDesc) );

indexBufferDesc.Usage = D3D11_USAGE_DEFAULT;

indexBufferDesc.ByteWidth = sizeof(DWORD) * Model.Total.Face * 3; //<---- This would be complained by the compiler for some reason but not if its * 4

indexBufferDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;

indexBufferDesc.CPUAccessFlags = 0;indexBufferDesc.MiscFlags = 0;

//some more code[/code]

 

am guessing my pointer takes up some extra memory? if so how would I get the size of a pointer o.o?

 

Problem:

was drawing 3 times as much, than what the buffer was created for  


PARTNERS