I have a simple program i am using to try and use vertex programs. With vertex programming disabled, a torus is displayed, however with it enabled, nothing appears. What am I doing wrong?
My vertex program is stored in a .txt file:
!!VP1.0
c[0]-c[3] modelviewProjection matrix
compute position
DP4 o[HPOS].x, c[0], v[OPOS];
DP4 o[HPOS].y, c[1], v[OPOS];
DP4 o[HPOS].z, c[2], v[OPOS];
DP4 o[HPOS].w, c[3], v[OPOS];MOV o[COL0], c[1];
END
And is loaded in with:
//generate a vertex program
glGenProgramsNV(1, &vp);
if(!vp)
{
printf(“Unable to create a vertex program object”);
return false;
}
glBindProgramNV(GL_VERTEX_PROGRAM_NV, vp);//load from file
ifstream vpFile(“vp.txt”, ios::in | ios::nocreate);
if(vpFile.fail())
{
printf(“Unable to open vertex program”);
return false;
}//calculate the size of the file
vpFile.seekg(0, ios::end);
int vpSize=vpFile.tellg();
vpFile.seekg(0, ios::beg);//allocate memory
unsigned char * vpText=new unsigned char[vpSize];
if(!vpText)
{
printf(“Unable to allocate space for vertex program text”);
return false;
}//read file
memset(vpText, 0, vpSize);
vpFile.read(vpText, vpSize);
vpFile.close();printf("Vertex Program:
%s
", vpText);
//load program
glLoadProgramNV(GL_VERTEX_PROGRAM_NV, vp, vpSize, vpText);
glTrackMatrixNV(GL_VERTEX_PROGRAM_NV, 0, GL_MODELVIEW_PROJECTION_NV, GL_IDENTITY_NV);
glEnable(GL_VERTEX_PROGRAM_NV);
I simply then use gluLookAt and glutSolidTorus.
Thanks