47 lines
1.2 KiB
C++
47 lines
1.2 KiB
C++
|
|
#ifndef DISPLAY_GLCONTEXT_H
|
|
#define DISPLAY_GLCONTEXT_H
|
|
|
|
#include <Spectre/Math/Vector2.h>
|
|
|
|
namespace sp {
|
|
|
|
class PlatformDisplay;
|
|
|
|
// Platform independant interface for OpenGL Contexts.
|
|
|
|
class GLContext
|
|
{
|
|
public :
|
|
static GLContext* create();
|
|
|
|
virtual ~GLContext();
|
|
|
|
// Create a GLContext for this perticular display.
|
|
virtual bool create(const PlatformDisplay* display) = 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 /* DISPLAY_GLCONTEXT_H */
|