void GLTexture::Draw(PixelScalar dest_x, PixelScalar dest_y, UPixelScalar dest_width, UPixelScalar dest_height, PixelScalar src_x, PixelScalar src_y, UPixelScalar src_width, UPixelScalar src_height) const { #ifdef HAVE_OES_DRAW_TEXTURE if (OpenGL::oes_draw_texture) { DrawOES(dest_x, dest_y, dest_width, dest_height, src_x, src_y, src_width, src_height); return; } #endif const RasterPoint vertices[] = { { dest_x, dest_y }, { dest_x + int(dest_width), dest_y }, { dest_x, dest_y + int(dest_height) }, { dest_x + int(dest_width), dest_y + int(dest_height) }, }; const ScopeVertexPointer vp(vertices); const PixelSize allocated = GetAllocatedSize(); GLfloat x0 = (GLfloat)src_x / allocated.cx; GLfloat y0 = (GLfloat)src_y / allocated.cy; GLfloat x1 = (GLfloat)(src_x + src_width) / allocated.cx; GLfloat y1 = (GLfloat)(src_y + src_height) / allocated.cy; const GLfloat coord[] = { x0, y0, x1, y0, x0, y1, x1, y1, }; #ifdef USE_GLSL glEnableVertexAttribArray(OpenGL::Attribute::TEXCOORD); glVertexAttribPointer(OpenGL::Attribute::TEXCOORD, 2, GL_FLOAT, GL_FALSE, 0, coord); #else glEnableClientState(GL_TEXTURE_COORD_ARRAY); glTexCoordPointer(2, GL_FLOAT, 0, coord); #endif glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); #ifdef USE_GLSL glDisableVertexAttribArray(OpenGL::Attribute::TEXCOORD); OpenGL::solid_shader->Use(); #else glDisableClientState(GL_TEXTURE_COORD_ARRAY); #endif }
void GLTexture::DrawFlipped(PixelRect dest, PixelRect src) const { #ifdef HAVE_OES_DRAW_TEXTURE if (OpenGL::oes_draw_texture) { DrawFlippedOES(dest, src); return; } #endif const RasterPoint vertices[] = { dest.GetTopLeft(), dest.GetTopRight(), dest.GetBottomLeft(), dest.GetBottomRight(), }; const ScopeVertexPointer vp(vertices); const PixelSize allocated = GetAllocatedSize(); GLfloat x0 = (GLfloat)src.left / allocated.cx; GLfloat y0 = (GLfloat)src.top / allocated.cy; GLfloat x1 = (GLfloat)src.right / allocated.cx; GLfloat y1 = (GLfloat)src.bottom / allocated.cy; const GLfloat coord[] = { x0, y1, x1, y1, x0, y0, x1, y0, }; #ifdef USE_GLSL glEnableVertexAttribArray(OpenGL::Attribute::TEXCOORD); glVertexAttribPointer(OpenGL::Attribute::TEXCOORD, 2, GL_FLOAT, GL_FALSE, 0, coord); #else glEnableClientState(GL_TEXTURE_COORD_ARRAY); glTexCoordPointer(2, GL_FLOAT, 0, coord); #endif glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); #ifdef USE_GLSL glDisableVertexAttribArray(OpenGL::Attribute::TEXCOORD); OpenGL::solid_shader->Use(); #else glDisableClientState(GL_TEXTURE_COORD_ARRAY); #endif }
void GLTexture::ResizeDiscard(PixelSize new_size) { const PixelSize validated_size = ValidateTextureSize(new_size); const PixelSize old_size = GetAllocatedSize(); width = new_size.cx; height = new_size.cy; if (validated_size == old_size) return; allocated_width = validated_size.cx; allocated_height = validated_size.cy; Bind(); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, validated_size.cx, validated_size.cy, 0, GL_RGB, GetType(), nullptr); }
void GLTexture::DrawFlipped(PixelRect dest, PixelRect src) const { #ifdef HAVE_OES_DRAW_TEXTURE if (OpenGL::oes_draw_texture) { DrawFlippedOES(dest, src); return; } #endif const RasterPoint vertices[] = { dest.GetTopLeft(), dest.GetTopRight(), dest.GetBottomLeft(), dest.GetBottomRight(), }; glVertexPointer(2, GL_VALUE, 0, vertices); const PixelSize allocated = GetAllocatedSize(); GLfloat x0 = (GLfloat)src.left / allocated.cx; GLfloat y0 = (GLfloat)src.top / allocated.cy; GLfloat x1 = (GLfloat)src.right / allocated.cx; GLfloat y1 = (GLfloat)src.bottom / allocated.cy; const GLfloat coord[] = { x0, y1, x1, y1, x0, y0, x1, y0, }; glEnableClientState(GL_TEXTURE_COORD_ARRAY); glTexCoordPointer(2, GL_FLOAT, 0, coord); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); glDisableClientState(GL_TEXTURE_COORD_ARRAY); }
virtual uint32 GetMemoryFootprint( void ) const override { return( sizeof( *this ) + GetAllocatedSize() ); }
uint32 FTextRenderSceneProxy::GetMemoryFootprint() const { return( sizeof( *this ) + GetAllocatedSize() ); }
uint32 FNiagaraSceneProxy::GetMemoryFootprint() const { return (sizeof(*this) + GetAllocatedSize()); }
uint32 FNavLinkRenderingProxy::GetMemoryFootprint( void ) const { return( sizeof( *this ) + GetAllocatedSize() ); }
uint32 FGeometryCacheSceneProxy::GetMemoryFootprint(void) const { return(sizeof(*this) + GetAllocatedSize()); }
uint32 FPaperBatchSceneProxy::GetMemoryFootprint() const { return sizeof(*this) + GetAllocatedSize(); }
virtual uint32 GetMemoryFootprint( void ) const { return sizeof( *this ) + GetAllocatedSize(); }