Ive got my int set up in my vertex datastructre called ConnectionX and Ive gota attribute in my vertex shader called int vConnectionX;
I want to get the value of ConnectionX into vConnectionX.
But I cant figure out how to send the int to the shader. Im messing around in COpenGLDiver.cpp
Code: Select all
//! draws a vertex primitive list
void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCount,
const void* indexList, u32 primitiveCount,
E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType, E_INDEX_TYPE iType)
{
.
.
.
switch (vType)
{
case EVT_STANDARD:
if (vertices)
{
glNormalPointer(GL_FLOAT, sizeof(S3DVertex), &(static_cast<const S3DVertex*>(vertices))[0].Normal);
glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertex), &(static_cast<const S3DVertex*>(vertices))[0].TCoords);
glVertexPointer(3, GL_FLOAT, sizeof(S3DVertex), &(static_cast<const S3DVertex*>(vertices))[0].Pos);
IShader* shader = getActiveShader();
if (shader) {
GLuint shaderProgram = shader->getProgram();
GLint vConnectionXLocation = glGetAttribLocation(shaderProgram, "vConnectionX");
if (vConnectionXLocation != -1) {
glVertexAttribPointer(vConnectionXLocation, 1, GL_INT, GL_FALSE, sizeof(S3DVertex), &(static_cast<const S3DVertex*>(vertices))[0].ConnectionX);
glEnableVertexAttribArray(vConnectionXLocation);
}
}
}
There is this code earlier in the driver
Code: Select all
//! Adds a new material renderer to the VideoDriver, using pixel and/or
//! vertex shaders to render geometry.
s32 COpenGLDriver::addShaderMaterial(const c8* vertexShaderProgram,
const c8* pixelShaderProgram,
IShaderConstantSetCallBack* callback,
E_MATERIAL_TYPE baseMaterial, s32 userData)
{
s32 nr = -1;
COpenGLShaderMaterialRenderer* r = new COpenGLShaderMaterialRenderer(
this, nr, vertexShaderProgram, pixelShaderProgram,
callback, baseMaterial, userData);
r->drop();
return nr;
}
That seems to reference the vertex shader program which is what I believe I want, but Im not sure how to get that reference into drawVertexPrimitiveList
Any help or guidance would be much appreciated thank you