Skip to main content
GameDev.net gamedev.net
🔒 Locked

My shader problem

Started by lly20000 Feb 27, 2005 at 8:10 PM 1 replies 750+ views
Original Post
lly20000
lly20000
I want implement a effect in my program in my code must read shader file in my shader file have 2 extern matrix variable in my program this is my code: ID3DXConstantTable* OutlineConstTable; ID3DXBuffer* outlineCompiledCode = 0; ID3DXBuffer* outlineErrorBuffer = 0; hr = D3DXCompileShaderFromFile( shaderfile, 0, 0, "Main", "vs_1_1", D3DXSHADER_DEBUG, &outlineCompiledCode, &outlineErrorBuffer, &OutlineConstTable); if(outlineErrorBuffer) { MessageBox(0,(char*)outlineErrorBuffer->GetBufferPointer(),0,0); SAFE_RELEASE(outlineErrorBuffer); } if(FAILED(hr)) { MessageBox(0,"D3DXCompileShaderFromFile() - FAILED",0,0); return false; } hr = pd3dDevice->CreateVertexShader( (DWORD*)outlineCompiledCode->GetBufferPointer(), &OutlineShader); if(FAILED(hr)) { MessageBox(0,"CreateVertexShader - FAILED",0,0); return false; } OutlineWorldViewHandle = OutlineConstTable->GetConstantByName(0,"WorldViewMatrix"); OutlineProjHandle = OutlineConstTable->GetConstantByName(0,"ProjMatrix"); OutlineConstTable->SetDefaults(pd3dDevice); SAFE_RELEASE(outlineCompiledCode); but I found OutlineWorldViewHandle variable can't Get constant worldviewmatrix varible in shader file this is my shader file code: extern matrix WorldViewMatrix; extern matrix ProjMatrix;
ehsan_the_tiamat
ehsan_the_tiamat
i didnt find any problem for what you posted
you do not need to use extern word in your shader code because they are extern by default.hope i could be of help.
/* rate me high! */
lly20000
lly20000
But When I run this code in my program in this
OutlineConstTable->SetMatrix(pd3dDevice,
OutlineWorldViewHandle,
&worldView);

the error will be display
OutlineWorldViewHandle 0x00000000 const char *


Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.