X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbatch.cpp;h=afb9787b4d7f8bd7f34c0491120f668efc3c163b;hb=6afbace895a7bbcf216ab8e48280ea0303ab5892;hp=b4b88176559a744ffa602fed13951ebd8a65b669;hpb=2e7f19b895424c3a77940e648639f8df2b395d0f;p=libs%2Fgl.git diff --git a/source/batch.cpp b/source/batch.cpp index b4b88176..afb9787b 100644 --- a/source/batch.cpp +++ b/source/batch.cpp @@ -2,7 +2,7 @@ #include "bindable.h" #include "buffer.h" #include "error.h" -#include "extension.h" +#include "ext_draw_range_elements.h" #include "nv_primitive_restart.h" #include "vertexarray.h" @@ -24,7 +24,11 @@ Batch::Batch(PrimitiveType t): next_in_ibuf(0), prev_in_ibuf(0), dirty(false) -{ } +{ + /* XXX Should probably provide a fallback to glDrawElements since this class + is pretty much required to render anything. */ + static Require _req(EXT_draw_range_elements); +} Batch::~Batch() { @@ -160,12 +164,12 @@ void Batch::append(const Batch &other) else if(prim_type==POLYGON) throw incompatible_data("Batch::append"); else if(prim_type==TRIANGLE_FAN) - static RequireExtension _ext("GL_NV_primitive_restart"); + static Require _req(NV_primitive_restart); if(other.data.empty()) return; - if(is_supported("GL_NV_primitive_restart")) + if(NV_primitive_restart) { restart = true; if(data_type==UNSIGNED_SHORT) @@ -244,7 +248,7 @@ void Batch::draw() const BufferAlias alias(*ibuf); Bind bind_ibuf(alias, true); - glDrawRangeElements(prim_type, min_index, max_index, size(), data_type, (void *)ibuf_offset); + glDrawRangeElements(prim_type, min_index, max_index, size(), data_type, reinterpret_cast(ibuf_offset)); } else glDrawRangeElements(prim_type, min_index, max_index, size(), data_type, &data[0]);