i started programming about 1.5years ago, the only langue i know is c#.
thats why i chose for slimdx when i started working on my game, i have been able
to make basic triangles, squares, qube's, etc. implement rotation(on the cpu) and i made a basic game world in which i can move around.
uptil now i have used shader only to return a color, colering my world by giving each polygon another colered shader, but now i would like to use textures(image .bmp or .jpg or something like that) instead of colors for my polygons.
so my question is how do i get to use a image instead of a color to be drawn as my polygon?
i have been searching for 3days and so far i havent found any helpfull tuturial about the subject for slimdx, i have found a dx11 tuturial to place a texture on a cube. (http://msdn.microsoft.com/en-us/library/ff729724(VS.85).aspx)
and i have been trying to use it to put a texture on the simpletriangle slimdx tutorial, but the only thing i get are erors or just a plain blue background.
this i probably due to the fact that i dont understand c++ or hlsl.
so if anyone has/knows some working code/ tuturial to put a texture on a square, triangle or cube , i would realy apriciate that.
the thing i'm currently stuck on is this :
from the msdn dx11 tutrial mentioned above :
c++ code (i assume)
g_pImmediateContext->PSSetShaderResources( 0, 1, &g_pTextureRV );
g_pImmediateContext->PSSetSamplers( 0, 1, &g_pSamplerLinear );
hlsl code (i assume)
// Pixel Shader
float4 PS( PS_INPUT input) : SV_Target
{
return txDiffuse.Sample( samLinear, input.Tex ) * vMeshColor;
}
// Vertex Shader
PS_INPUT VS( VS_INPUT input )
{
PS_INPUT output = (PS_INPUT)0;
output.Pos = mul( input.Pos, World );
output.Pos = mul( output.Pos, View );
output.Pos = mul( output.Pos, Projection );
output.Tex = input.Tex;
return output;
}
i tryed transelating this code to slim dx and i seem to be able to work around most errors i get but i keep getting a txDiffuse doesent exist exeption.
exept for here (txDiffuse is the object storing our texture that we passed in from the code above, when we bound the resource view g_pTextureRV to it.)
the name txdiffuse isent mentioned any where else in the tuturial, leading me to assume that its not a varable but some kind of a keyword that exists in directx but not in slim dx.(i could be totaly rong here no clue how hlsl works just speculation.)
the g_pTextureRV thats mentioned in the "explenation" of the txdiffuse thingie,
is set here: g_pImmediateContext->PSSetShaderResources( 0, 1, &g_pTextureRV );
which i assume corresponds to this : device.ImmediateContext.PixelShader.SetShaderResource(resourceView, 0);
in slimdx but there doesent seem a way for me to pas g_pTextureRV there, this leaves me a bit confused.
i would apreciate it if anyone could offer me some help whit this problem.






