Herculis
07-15-2011, 06:50 AM
Hello,
I am currently experiencing a problem with the GLUtesselator. The goal is to use tesselator to render concave polygons with textures on them.
I tried the following
gluTessCallback(tess, GLU_TESS_BEGIN, (void (__stdcall*) ()) &glBegin);
gluTessCallback(tess, GLU_TESS_END, (void (__stdcall*)(void)) &glEnd);
gluTessCallback(tess, GLU_TESS_VERTEX, (void (__stdcall*)(void)) &glVertex3dv);
glColor3f(1,1,1);
glBindTexture(GL_TEXTURE_2D, planetexture[i]);
gluTessBeginPolygon(tess, 0);
gluTessBeginContour(tess);
for (int j = 0; j < corners.size(); j++) {
GLdouble* d = new GLdouble[3];
d[0] = corners[j](0);
d[1] = corners[j](1);
d[2] = corners[j](2);
glTexCoord3dv(d); gluTessVertex(tess,d,d);
}
gluTessEndContour(tess);
gluTessEndPolygon(tess);
The result is a dark grey polygon, but no texture. Any idea why this is happening?
I also tried to change gluTessCallback(tess, GLU_TESS_VERTEX, (void (__stdcall*)(void)) &glVertex3dv); to my own callback function gluTessCallback(tess, GLU_TESS_VERTEX, (void (__stdcall*)(void)) &vertexCB); and put the glTexCoord and glVertex call in there, but I always get type conversion errors. This is the definition I used for the callback, which is in class Viewer: void CALLBACK tessVertexCB(const GLvoid *data); What conversion do I have to use in the gluTessCallback?
Any suggestions would be welcome.
Thank you very much!
I am currently experiencing a problem with the GLUtesselator. The goal is to use tesselator to render concave polygons with textures on them.
I tried the following
gluTessCallback(tess, GLU_TESS_BEGIN, (void (__stdcall*) ()) &glBegin);
gluTessCallback(tess, GLU_TESS_END, (void (__stdcall*)(void)) &glEnd);
gluTessCallback(tess, GLU_TESS_VERTEX, (void (__stdcall*)(void)) &glVertex3dv);
glColor3f(1,1,1);
glBindTexture(GL_TEXTURE_2D, planetexture[i]);
gluTessBeginPolygon(tess, 0);
gluTessBeginContour(tess);
for (int j = 0; j < corners.size(); j++) {
GLdouble* d = new GLdouble[3];
d[0] = corners[j](0);
d[1] = corners[j](1);
d[2] = corners[j](2);
glTexCoord3dv(d); gluTessVertex(tess,d,d);
}
gluTessEndContour(tess);
gluTessEndPolygon(tess);
The result is a dark grey polygon, but no texture. Any idea why this is happening?
I also tried to change gluTessCallback(tess, GLU_TESS_VERTEX, (void (__stdcall*)(void)) &glVertex3dv); to my own callback function gluTessCallback(tess, GLU_TESS_VERTEX, (void (__stdcall*)(void)) &vertexCB); and put the glTexCoord and glVertex call in there, but I always get type conversion errors. This is the definition I used for the callback, which is in class Viewer: void CALLBACK tessVertexCB(const GLvoid *data); What conversion do I have to use in the gluTessCallback?
Any suggestions would be welcome.
Thank you very much!