Loading...
Searching...
No Matches
State.h
Go to the documentation of this file.
#pragma once
#include <unordered_map>
#include <vector>
#include <glbinding/gl/types.h>
#include <globjects/base/Referenced.h>
#include <globjects/globjects_api.h>
#include <globjects/AbstractState.h>
namespace globjects
{
class StateSetting;
class Capability;
class GLOBJECTS_API State : public AbstractState, public Referenced
{
public:
enum Mode
{
DeferredMode,
ImmediateMode
};
public:
State(Mode = ImmediateMode);
static State * currentState();
void setMode(Mode mode);
Mode mode() const;
void apply();
virtual void enable(gl::GLenum capability) override;
virtual void disable(gl::GLenum capability) override;
virtual bool isEnabled(gl::GLenum capability) const override;
virtual void enable(gl::GLenum capability, int index) override;
virtual void disable(gl::GLenum capability, int index) override;
virtual bool isEnabled(gl::GLenum capability, int index) const override;
virtual void add(StateSetting * setting) override;
Capability * capability(gl::GLenum capability);
const Capability * capability(gl::GLenum capability) const;
std::vector<Capability *> capabilities() const;
StateSetting * setting(const StateSettingType & type);
const StateSetting * setting(const StateSettingType & type) const;
std::vector<StateSetting *> settings();
std::vector<const StateSetting *> settings() const;
protected:
void addCapability(Capability * capability);
Capability * getCapability(gl::GLenum capability);
const Capability * getCapability(gl::GLenum capability) const;
protected:
virtual ~State();
Mode m_mode;
std::unordered_map<gl::GLenum, Capability *> m_capabilities;
std::unordered_map<StateSettingType, StateSetting *> m_settings;
};
} // namespace globjects
AbstractState.h
Referenced.h
globjects::AbstractState
Definition AbstractState.h:18
globjects::Capability
Definition Capability.h:16
globjects::Referenced
Superclass for all classes that use reference counting in globjects.
Definition Referenced.h:23
globjects::State
Definition State.h:23
globjects::State::mode
Mode mode() const
globjects::State::capability
Capability * capability(gl::GLenum capability)
globjects::State::Mode
Mode
Definition State.h:26
globjects::State::DeferredMode
@ DeferredMode
Definition State.h:27
globjects::State::apply
void apply()
globjects::State::setMode
void setMode(Mode mode)
globjects::State::settings
std::vector< const StateSetting * > settings() const
globjects::State::enable
virtual void enable(gl::GLenum capability) override
globjects::State::add
virtual void add(StateSetting *setting) override
globjects::State::m_capabilities
std::unordered_map< gl::GLenum, Capability * > m_capabilities
Definition State.h:68
globjects::State::m_mode
Mode m_mode
Definition State.h:67
globjects::State::capabilities
std::vector< Capability * > capabilities() const
globjects::State::capability
const Capability * capability(gl::GLenum capability) const
globjects::State::State
State(Mode=ImmediateMode)
globjects::State::~State
virtual ~State()
globjects::State::getCapability
Capability * getCapability(gl::GLenum capability)
globjects::State::isEnabled
virtual bool isEnabled(gl::GLenum capability) const override
globjects::State::m_settings
std::unordered_map< StateSettingType, StateSetting * > m_settings
Definition State.h:69
globjects::State::addCapability
void addCapability(Capability *capability)
globjects::State::disable
virtual void disable(gl::GLenum capability, int index) override
globjects::State::isEnabled
virtual bool isEnabled(gl::GLenum capability, int index) const override
globjects::State::currentState
static State * currentState()
globjects::State::setting
const StateSetting * setting(const StateSettingType &type) const
globjects::State::disable
virtual void disable(gl::GLenum capability) override
globjects::State::settings
std::vector< StateSetting * > settings()
globjects::State::enable
virtual void enable(gl::GLenum capability, int index) override
globjects::State::setting
StateSetting * setting(const StateSettingType &type)
globjects::State::getCapability
const Capability * getCapability(gl::GLenum capability) const
globjects::StateSetting
Definition StateSetting.h:37
globjects::StateSettingType
Definition StateSetting.h:20
globjects
Contains all the classes that wrap OpenGL functionality.