On Jun 23, 2013, at 4:52 PM, kilon <thekilon@yahoo.co.uk> wrote:
next question .
I have this method.
initializeProgram "create each shader and program"
| shaderList strVertexShader strFragmentShader |
strVertexShader := self createShader: GL_VERTEX_SHADER string: ( self vertexShader ). strFragmentShader := self createShader: GL_FRAGMENT_SHADER string: (self fragmentShader) . shaderList := #( strVertexShader strFragmentShader ). self createProgram: shaderList . shaderList do: [ :each | gl deleteShader: each ].
Each time I try to accept the code it complains that strVertexShader and strFragmentShader are unused and ask for removing them . Why ?
Is this an IDE bug ? Its clear from the code that I use those two local variables to pass them to the array shaderList. Am I missing something here ?
Yes: shaderList := #( strVertexShader strFragmentShader ). here the Array you create is a so called literal Array. It can not contain variables, only literals. The compiler sees is as #(#strVertexShader #strFragmentShader). What you need instead is a compile time evaluated Array: shaderList := {strVertexShader strFragmentShader}. Marcus