Don't use GL13 and ARB_vertex_shader constants in BaseReferences if they're not supported

This commit is contained in:
Elias Naur 2007-06-06 12:07:45 +00:00
parent 1986b75e82
commit ddfae1512d
2 changed files with 15 additions and 4 deletions

View File

@ -46,11 +46,21 @@ class BaseReferences {
BaseReferences(ContextCapabilities caps) {
IntBuffer temp = caps.scratch_int_buffer;
GL11.glGetInteger(ARBVertexShader.GL_MAX_VERTEX_ATTRIBS_ARB, temp);
glVertexAttribPointer_buffer = new Buffer[temp.get(0)];
int max_vertex_attribs;
if (caps.GL_ARB_vertex_shader) {
GL11.glGetInteger(ARBVertexShader.GL_MAX_VERTEX_ATTRIBS_ARB, temp);
max_vertex_attribs = temp.get(0);
} else
max_vertex_attribs = 0;
glVertexAttribPointer_buffer = new Buffer[max_vertex_attribs];
GL11.glGetInteger(GL13.GL_MAX_TEXTURE_UNITS, temp);
glTexCoordPointer_buffer = new Buffer[temp.get(0)];
int max_texture_units;
if (caps.OpenGL13) {
GL11.glGetInteger(GL13.GL_MAX_TEXTURE_UNITS, temp);
max_texture_units = temp.get(0);
} else
max_texture_units = 0;
glTexCoordPointer_buffer = new Buffer[max_texture_units];
}
void clear() {

View File

@ -168,6 +168,7 @@ public class ContextGeneratorProcessorFactory implements AnnotationProcessorFact
if (Utils.isFinal(interface_decl))
ContextCapabilitiesGenerator.generateInitializer(writer, interface_decl);
}
writer.println("\t\ttracker = new StateTracker();");
writer.println("\t}");
writer.println("}");
writer.close();