I am trying to understand more how the drawing and buffers are handled in eduke and the shaders. To do this I thought I would try and draw a simple triangle on the screen but certain points are still confusing me in how they are handled in eduke as most things seem to be compiled at run time.
Here is my code for drawing a simple triangle that I am just hooking into polymer.cpp in a place I know that is getting called:
glGenVertexArrays(1, &vao); glBindVertexArray(vao); glGenBuffers(1, &vbo); glBindBuffer(GL_ARRAY_BUFFER, vbo); // Create the buffer, but don't load anything yet glBufferData(GL_ARRAY_BUFFER, 7*3*sizeof(GLfloat), NULL, GL_STATIC_DRAW); // Load the vertex points glBufferSubData(GL_ARRAY_BUFFER, 0, 3*3*sizeof(GLfloat), vertices); // Load the colors right after that glBufferSubData(GL_ARRAY_BUFFER, 3*3*sizeof(GLfloat),3*4*sizeof(GLfloat), colors); // Find the position of the variables in the shader positionID = glGetAttribLocation(shaderProgramID, "s_vPosition"); colorID = glGetAttribLocation(shaderProgramID, "s_vColor"); glVertexAttribPointer(positionID, 3, GL_FLOAT, GL_FALSE, 0, 0); glVertexAttribPointer(colorID, 3, GL_FLOAT, GL_FALSE, 0, 0); glUseProgram(shaderProgramID); glEnableVertexAttribArray(positionID); glEnableVertexAttribArray(colorID); glDrawArrays(GL_TRIANGLES, 0, 3);
Main points of confusion being the vertex variables as I couldn't find what I was looking for in the vertex shader code, seems the variables are T, B, N, nextFrameData and nextFrameNormal but not sure what they are, could anyone help me correct this in to something that would run in polymer.cpp and draw the triangle to the screen?
Thanks!