1
0
Fork 0
spectre/include/Spectre/Window/GLContext.h

45 lines
1.2 KiB
C++

#ifndef SPECTRE_WINDOW_GLCONTEXT_H
#define SPECTRE_WINDOW_GLCONTEXT_H
#include <Spectre/Math/Vector2.h>
namespace sp {
class PlatformWindow;
// Platform independant interface for OpenGL Contexts.
class GLContext
{
public :
virtual ~GLContext();
// Create a GLContext for this perticular window.
virtual bool create(const PlatformWindow* window) = 0;
virtual void destroy() = 0;
// Activate this context.
virtual bool activate() = 0;
// Deactivate this context.
virtual bool deactivate() = 0;
// Returns true if this context is the active one. false otherwise.
// There can only be one GL context active per thread.
virtual bool isActive() const = 0;
// Set the interval for when the front and back framebuffers should be swapped.
// The interval is the number of v-blanks that the gpu must wait before swapping buffers.
// 0 means that the gpu never waits, 1 means after exactly 1 v-blank and so on.
// This is usually refered to as enabling/disabling vertical synchronization.
virtual bool setSwapInterval(int interval) = 0;
// Swap front with back buffer and vice versa.
virtual void swapBuffers() = 0;
};
} // namespace sp
#endif /* SPECTRE_WINDOW_GLCONTEXT_H */