X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=flavors%2Fgl%2Fsource%2Fglstate.cpp;h=f910b49cc041bd87ef2072f61837be3e41b2cfc6;hb=81f1ddee977603293d0c5710f2db69130dac6a96;hp=1459324232f36d3b6af583bfe1def2a3e0ffb22a;hpb=f53057ce9b5eb3c7256a4aca95b4944733e14503;p=gldbg.git diff --git a/flavors/gl/source/glstate.cpp b/flavors/gl/source/glstate.cpp index 1459324..f910b49 100644 --- a/flavors/gl/source/glstate.cpp +++ b/flavors/gl/source/glstate.cpp @@ -1,15 +1,14 @@ /* $Id$ This file is part of gldbg -Copyright © 2009-2010 Mikko Rasa, Mikkosoft Productions +Copyright © 2009-2011 Mikko Rasa, Mikkosoft Productions Distributed under the GPL */ -#include +#include #include "glstate.h" using namespace std; -using namespace Msp; namespace { @@ -127,6 +126,10 @@ GlState::GlState(): decoder->glBufferSubDataARB = glBufferSubData; decoder->glDeleteBuffers = glDeleteBuffers; decoder->glDeleteBuffersARB = glDeleteBuffers; + + decoder->glDrawElements = glDrawElements; + decoder->glDrawRangeElements = glDrawRangeElements; + decoder->glDrawRangeElementsEXT = glDrawRangeElements; } GlState::~GlState() @@ -143,7 +146,7 @@ const TextureState &GlState::get_texture(unsigned id) const { TextureMap::const_iterator i = textures.find(id); if(i==textures.end()) - throw KeyError("Unknown texture"); + throw runtime_error("Unknown texture"); return i->second; } @@ -151,7 +154,7 @@ const BufferState &GlState::get_buffer(unsigned id) const { BufferMap::const_iterator i = buffers.find(id); if(i==buffers.end()) - throw KeyError("Unknown buffer"); + throw runtime_error("Unknown buffer"); return i->second; } @@ -200,7 +203,7 @@ const ArrayState &GlState::get_array(GLenum array) const else if(array==GL_TEXTURE_COORD_ARRAY) return texcoord_arrays[client_active_tex]; else - throw InvalidParameterValue("Invalid array"); + throw logic_error("Invalid array"); } const ArrayState &GlState::get_texture_coord_array(unsigned index) const @@ -215,7 +218,7 @@ const ArrayState &GlState::get_attrib_array(unsigned index) const return i->second; // XXX Return a dummy? - throw KeyError("Unknown attribute array"); + throw runtime_error("Unknown attribute array"); } void GlState::set_current_texture(GLenum target, unsigned id) @@ -412,3 +415,15 @@ void GlState::glDeleteBuffers(void *user_data, int count, const unsigned *ids) for(int i=0; i(user_data)->buffers.erase(ids[i]); } + +void GlState::glDrawElements(void *user_data, GLenum, int, GLenum type, const void *) +{ + if(BufferState *buf = reinterpret_cast(user_data)->element_buffer) + buf->content.update_elements(type); +} + +void GlState::glDrawRangeElements(void *user_data, GLenum, unsigned, unsigned, int, GLenum type, const void *) +{ + if(BufferState *buf = reinterpret_cast(user_data)->element_buffer) + buf->content.update_elements(type); +}