Jump to content
Posted 16 November 2012 - 03:47 AM
Posted 16 November 2012 - 04:00 AM
Posted 16 November 2012 - 04:20 AM
mContext->PSSetShaderResources( 0, 1, i->first->GetTexture());Whether your temporary variable is dangerous or not depends on what the receiving function assumes and expects from it. For example, if it is only assumed to live for the duration of the function call then you're fine, but if it stores the pointer locally then your temporary variable may be destroyed before your mContext object is done with it.
Posted 16 November 2012 - 04:52 AM
Posted 16 November 2012 - 05:10 AM
mContext->PSSetShaderResources( 0, 1, static_cast<DXRenderer *>(i->first)->GetTexture());I assume you have a BasicRenderer class that has a GetTexture function that returns a BasicTexture, and both of the Basic-classes are derived with specific DX and GL variants. The above assumes that the renderer is a DXRenderer where you have a GetTexture that returns the proper type for PSSetShaderResource.
Posted 18 November 2012 - 08:04 PM