// Construct the display lists void MD5Surface::createDisplayLists() { // Release old display lists first releaseDisplayLists(); // Create the list for lighting mode _lightingList = glGenLists(1); assert(_lightingList != 0); glNewList(_lightingList, GL_COMPILE); glBegin(GL_TRIANGLES); for (Indices::const_iterator i = _indices.begin(); i != _indices.end(); ++i) { // Get the vertex for this index ArbitraryMeshVertex& v = _vertices[*i]; // Submit the vertex attributes and coordinate if (GLEW_ARB_vertex_program) { // Submit the vertex attributes and coordinate glVertexAttrib2dvARB(ATTR_TEXCOORD, v.texcoord); glVertexAttrib3dvARB(ATTR_TANGENT, v.tangent); glVertexAttrib3dvARB(ATTR_BITANGENT, v.bitangent); glVertexAttrib3dvARB(ATTR_NORMAL, v.normal); } glVertex3dv(v.vertex); } glEnd(); glEndList(); // Generate the list for flat-shaded (unlit) mode _normalList = glGenLists(1); assert(_normalList != 0); glNewList(_normalList, GL_COMPILE); glBegin(GL_TRIANGLES); for (Indices::const_iterator i = _indices.begin(); i != _indices.end(); ++i) { // Get the vertex for this index ArbitraryMeshVertex& v = _vertices[*i]; // Submit attributes glNormal3dv(v.normal); glTexCoord2dv(v.texcoord); glVertex3dv(v.vertex); } glEnd(); glEndList(); }
// Construct a list for GLProgram mode, either with or without vertex colour GLuint RenderablePicoSurface::compileProgramList(bool includeColour) { GLuint list = glGenLists(1); assert(list != 0); // check if we run out of display lists glNewList(list, GL_COMPILE); glBegin(GL_TRIANGLES); for (Indices::const_iterator i = _indices.begin(); i != _indices.end(); ++i) { // Get the vertex for this index ArbitraryMeshVertex& v = _vertices[*i]; // Submit the vertex attributes and coordinate if (GLEW_ARB_vertex_program) { glVertexAttrib2dvARB(ATTR_TEXCOORD, v.texcoord); glVertexAttrib3dvARB(ATTR_TANGENT, v.tangent); glVertexAttrib3dvARB(ATTR_BITANGENT, v.bitangent); glVertexAttrib3dvARB(ATTR_NORMAL, v.normal); } // Optional vertex colour if (includeColour) { glColor3dv(v.colour); } // Submit the vertex itself glVertex3dv(v.vertex); } glEnd(); glEndList(); return list; }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBVertexProgram_nglVertexAttrib3dvARB__IJ(JNIEnv *__env, jclass clazz, jint index, jlong vAddress) { glVertexAttrib3dvARBPROC glVertexAttrib3dvARB = (glVertexAttrib3dvARBPROC)tlsGetFunction(1416); intptr_t v = (intptr_t)vAddress; UNUSED_PARAM(clazz) glVertexAttrib3dvARB(index, v); }