OpenSceneGraph icon indicating copy to clipboard operation
OpenSceneGraph copied to clipboard

[Question] How can i locate the attribute's location in vertex shader?

Open showintime opened this issue 5 years ago • 0 comments

Vertex Shader:

                "uniform mat4 transform;"
		"uniform vec2 uv_offset;"
		"uniform vec2 uv_scale;"
		"uniform bool octant_mask[8];"
		"attribute vec3 position;"
		"attribute float octant;"	
		"attribute vec2 texcoords;"		
		"varying vec2 v_texcoords;"
		"void main() {"
		"	float mask = octant_mask[int(octant)] ? 0.0 : 1.0;"
		"	v_texcoords = (texcoords + uv_offset) * uv_scale * mask;"
		"	gl_Position = transform * vec4(position, 1.0) * mask;"
		"}",

In OpenGL, we can use glGetAttribLocation to locate an attribute location, so that it can be used in glVertexAttribPointer. Can i do the same work in OSG?

showintime avatar Jan 05 '21 10:01 showintime