From 289bc881aaec35cc127256137abc7dcf116afd48 Mon Sep 17 00:00:00 2001 From: reduz Date: Sun, 25 Dec 2016 08:05:23 -0300 Subject: [PATCH] now it really works on window for real --- drivers/gles3/rasterizer_storage_gles3.cpp | 38 ++++++++++++++++++++-- platform/windows/context_gl_win.cpp | 3 +- servers/visual/rasterizer.h | 8 +++++ 3 files changed, 45 insertions(+), 4 deletions(-) diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index ffcd462808c..698788316ce 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -2460,6 +2460,8 @@ RID RasterizerStorageGLES3::mesh_create(){ void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::PrimitiveType p_primitive,const DVector& p_array,int p_vertex_count,const DVector& p_index_array,int p_index_count,const AABB& p_aabb,const Vector >& p_blend_shapes,const Vector& p_bone_aabbs){ + DVector array = p_array; + Mesh *mesh = mesh_owner.getornull(p_mesh); ERR_FAIL_COND(!mesh); @@ -2657,7 +2659,35 @@ void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::P int array_size = stride * p_vertex_count; int index_array_size=0; - ERR_FAIL_COND(p_array.size()!=array_size); + print_line("desired size: "+itos(array_size)+" vcount "+itos(p_vertex_count)+" should be: "+itos(array.size()+p_vertex_count*2)+" but is "+itos(array.size())); + if (array.size()!=array_size && array.size()+p_vertex_count*2 == array_size) { + //old format, convert + array = DVector(); + + array.resize( p_array.size()+p_vertex_count*2 ); + + DVector::Write w = array.write(); + DVector::Read r = p_array.read(); + + uint16_t *w16 = (uint16_t*)w.ptr(); + const uint16_t *r16 = (uint16_t*)r.ptr(); + + uint16_t one = Math::make_half_float(1); + + for(int i=0;iactive=true; surface->array_len=p_vertex_count; surface->index_array_len=p_index_count; - surface->array_byte_size=p_array.size(); + surface->array_byte_size=array.size(); surface->index_array_byte_size=p_index_array.size(); surface->primitive=p_primitive; surface->mesh=mesh; @@ -2704,7 +2734,7 @@ void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::P { - DVector::Read vr = p_array.read(); + DVector::Read vr = array.read(); glGenBuffers(1,&surface->vertex_id); glBindBuffer(GL_ARRAY_BUFFER,surface->vertex_id); @@ -5907,7 +5937,9 @@ void RasterizerStorageGLES3::initialize() { { int max_extensions=0; + print_line("getting extensions"); glGetIntegerv(GL_NUM_EXTENSIONS,&max_extensions); + print_line("total "+itos(max_extensions)); for(int i=0;i