Regarding Shader Attributes

I get the basic gist of how shaders work, but looking at Matt DesLauriers’ excellent tutorials, he’s using the SpriteBatch object for quite a bit… this left me wondering how you would “manually” pass in the Position, Color, and TexCoord attributes to the Vertex shader.

These are usually handled by the SpriteBatch object, but I’m using some old-school style rendering for the FBO as follows…

int attributeLoc = ARBShaderObjects.glGetUniformLocationARB(currentShader, "texture");
ARBShaderObjects.glUseProgramObjectARB(currentShader);								
ARBShaderObjects.glUniform1iARB(attributeLoc, fboTexture);

GL11.glColor4f(1, 1, 1, 1);
GL11.glBegin(GL11.GL_QUADS);
				
// Top Left
GL11.glTexCoord2f(0.0f, 1.0f); 
GL11.glVertex2i(x, y);  		
// Top Right
GL11.glTexCoord2f(1.0f, 1.0f); 
GL11.glVertex2i(x + width,  y); 		
// Bottom Right
GL11.glTexCoord2f(1.0f, 0.0f);
GL11.glVertex2i(x + width, y + height);		
// Bottom Left		
GL11.glTexCoord2f(0.0f, 0.0f); 		
GL11.glVertex2i(x, y + height);	
GL11.glEnd();

What variables can I attach to the shader attributes in place of what SpriteBatch would usually provide?

  • Steve