def initialize(image, filter = :smooth, inform = :rgba, repeat = false)
validate(image)
@pixels = image.data
@w = image.w
@h = image.h
@pix_format = image.format
@filter = case filter
when Symbol: Filter[filter]
when Array: filter
end
raise(ArgumentError, "#{filter} is not a valid texture filter") unless @filter
@repeat = case repeat
when true: GL::REPEAT
when false: GL::CLAMP_TO_EDGE
when Fixnum: repeat
else raise(ArgumentError, "repeat must be a GL constant or boolean.")
end
@inform = case inform
when Symbol: Format[inform]
when Fixnum: inform
end
raise(ArgumentError, "#{inform} is not a valid texture format") unless @inform
@tex_id = 0
return load
end