From 09cf0ac2e9ec9e18c7099312265f9d51cdbb0f37 Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Thu, 18 Jun 2009 19:31:07 -0700 Subject: we were not fetching the texture coords in the copybit case, so we were using garbage --- opengl/libagl/copybit.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'opengl/libagl') diff --git a/opengl/libagl/copybit.cpp b/opengl/libagl/copybit.cpp index a663f75..cde8f8a 100644 --- a/opengl/libagl/copybit.cpp +++ b/opengl/libagl/copybit.cpp @@ -293,6 +293,7 @@ bool drawTriangleFanWithCopybit_impl(ogles_context_t* c, GLint first, GLsizei co return false; } + // FIXME: we should handle culling here c->arrays.compileElements(c, c->vc.vBuffer, 0, 4); // we detect if we're dealing with a rectangle, by comparing the @@ -316,6 +317,18 @@ bool drawTriangleFanWithCopybit_impl(ogles_context_t* c, GLint first, GLsizei co LOGD_IF(DEBUG_COPYBIT, "geometry not a rectangle"); return false; } + + // fetch and transform texture coordinates + // NOTE: maybe it would be better to have a "compileElementsAll" method + // that would ensure all vertex data are fetched and transformed + const transform_t& tr = c->transforms.texture[0].transform; + for (size_t i=0 ; i<4 ; i++) { + const GLubyte* tp = c->arrays.texture[0].element(i); + vertex_t* const v = &c->vc.vBuffer[i]; + c->arrays.texture[0].fetch(c, v->texture[0].v, tp); + // FIXME: we should bail if q!=1 + c->arrays.tex_transform[0](&tr, &v->texture[0], &v->texture[0]); + } const vec4_t& t0 = c->vc.vBuffer[0].texture[0]; const vec4_t& t1 = c->vc.vBuffer[1].texture[0]; @@ -333,7 +346,8 @@ bool drawTriangleFanWithCopybit_impl(ogles_context_t* c, GLint first, GLsizei co if ((txl != 0) || (txb != 0) || (txr != FIXED_ONE) || (txt != FIXED_ONE)) { // we could probably handle this case, if we wanted to - LOGD_IF(DEBUG_COPYBIT, "texture is cropped"); + LOGD_IF(DEBUG_COPYBIT, "texture is cropped: %08x,%08x,%08x,%08x", + txl, txb, txr, txt); return false; } -- cgit v1.1