Eiffel Media API
Overview Cluster Class Classes Index      Previous Next      Top Features

em.video.opengl

Class GL_SURFACE_TEXTURE


Direct ancestors

GL_TEXTURE, EM_SHARED_BITMAP_FACTORY, EM_SHARED_ERROR_HANDLER, EM_CONSTANTS, SDL_VIDEO_FUNCTIONS_EXTERNAL

Known direct descendants

GL_SURFACE_MIPMAP_TEXTURE

Creation

Features

Invariants

indexing

description

A texture which takes the content from an EM_SURFACE.
The texture is updated automatically when surface is modified.

The width and height of the texture will be the smallest
power of 2 which is greater than the dimensions of surface.

date

$Date$

revision

$Revision$

class

GL_SURFACE_TEXTURE

inherit

GL_TEXTURE

create

make_from_surface (a_surface: EM_SURFACE)

-- Initialise texture with a_surface.

require
a_surface_not_void: a_surface /= Void
ensure
surface_set: surface = a_surface
texture_created: is_valid

feature -- Access

id: INTEGER

-- OpenGL texture id

-- (From GL_TEXTURE)

surface: EM_SURFACE

-- Surface which is used for texture data

feature -- Measurement

height: INTEGER

-- Height of texture in pixels

-- (From GL_TEXTURE)

width: INTEGER

-- Width of texture in pixels

-- (From GL_TEXTURE)

feature -- Status report

is_not_freeing_texture: BOOLEAN

-- Is Current not freeing texture on disposal?

-- (From GL_TEXTURE)

is_valid: BOOLEAN

-- Is texture valid?

-- (From GL_TEXTURE)

feature -- Status setting

do_not_free_texture

-- Tell Current not to free texture on disposal.
-- If you call this, you will be responsible for freeing
-- the OpenGL texture yourself using gl_delete_textures!

-- (From GL_TEXTURE)

feature -- Element change

set_surface (a_surface: EM_SURFACE)

-- Set surface to a_surface.

require
a_surface_not_void: a_surface /= Void
ensure
surface_set: surface = a_surface

feature -- Basic Operations

save

-- Save texture in global textures list.
-- A saved texture will not be freed, even when you loose
-- the reference to the texture object. To free it later use
-- the global storage GL_TEXTURES.
-- TODO: maybe a mechanism to add an id would be nice.

-- (From GL_TEXTURE)

invariant

width_at_least_surface_width: width >= surface.width
hieght_at_least_surface_height: height >= surface.height

-- From GL_TEXTURE
width_not_negative: width >= 0
height_not_negative: height >= 0

-- From ANY
reflexive_equality: standard_is_equal (Current)
reflexive_conformance: conforms_to (Current)

end