I make unity program with GLSL shader.
I know how to use shader in openGL window programming, not unity.
in unity document, it say that ‘use built-in attribute’. but it’s so low version of GLSL.
high version, use like this.
layout(location = 0) in vec3 a_position;
layout(location = 1) in vec3 a_normal;
out vec3 v_position_EC;
out vec3 v_normal_EC;
upper version don’t support vayring variable and pre-defined variables.
if i set “#version 400”, it can be complie.
but any data goes.
i want convert this code to unity c# code.
glGenBuffers(1, &rectangle_VBO);
glBindBuffer(GL_ARRAY_BUFFER, rectangle_VBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(rectangle_vertices), &rectangle_vertices[0][0], GL_STATIC_DRAW);
// Initialize vertex array object.
glGenVertexArrays(1, &rectangle_VAO);
glBindVertexArray(rectangle_VAO);
glBindBuffer(GL_ARRAY_BUFFER, rectangle_VBO);
glVertexAttribPointer(LOC_POSITION, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), BUFFER_OFFSET(0));
glEnableVertexAttribArray(0);
glVertexAttribPointer(LOC_NORMAL, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), BUFFER_OFFSET(3 * sizeof(float)));
glEnableVertexAttribArray(1);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);
I cant find any document for ‘bind’ data in unity. it’s impossible?
i want solution or say it cant.
I already complete convert to low version.
but my boss want high version… please help me!