Stub GLX implementation

This commit is contained in:
Phillip Stephens 2015-04-18 14:22:32 -07:00
parent 52c73af8a6
commit ac010f5beb
7 changed files with 106 additions and 16 deletions

37
CGLXContext.cpp Normal file
View File

@ -0,0 +1,37 @@
#include "CGLXContext.hpp"
#include <iostream>
CGLXContext::CGLXContext()
{
std::cout << "Hello from GLX" << std::endl;
}
const std::string CGLXContext::version() const
{
return "Invalid version";
}
const std::string CGLXContext::name() const
{
return "GLX Context";
}
int CGLXContext::depthSize() const
{
return -1;
}
int CGLXContext::redDepth() const
{
return -1;
}
int CGLXContext::greenDepth() const
{
return -1;
}
int CGLXContext::blueDepth() const
{
return -1;
}

24
CGLXContext.hpp Normal file
View File

@ -0,0 +1,24 @@
#ifndef CGLXCONTEXT_HPP
#define CGLXCONTEXT_HPP
#include <GL/glx.h>
#include <IContext.hpp>
class CGLXContext : public IContext
{
public:
CGLXContext();
virtual ~CGLXContext() {}
const std::string version() const override;
const std::string name() const override;
int depthSize() const override;
int redDepth() const override;
int greenDepth() const override;
int blueDepth() const override;
};
#endif // CGLXCONTEXT_HPP

View File

@ -1,12 +0,0 @@
#include "CContext.hpp"
CContext::CContext()
{
}
CContext::~CContext()
{
}

View File

@ -1,12 +1,19 @@
#ifndef ICONTEXT_HPP
#define ICONTEXT_HPP
#include <string>
class IContext
{
public:
IContext();
~IContext();
virtual ~IContext() {}
virtual const std::string version() const=0;
virtual const std::string name() const=0;
virtual int depthSize() const=0;
virtual int redDepth() const=0;
virtual int greenDepth() const=0;
virtual int blueDepth() const=0;
};
#endif // ICONTEXT_HPP

16
libBoo.hpp Normal file
View File

@ -0,0 +1,16 @@
#ifndef LIBBOO_HPP
#define LIBBOO_HPP
#include "IContext.hpp"
#if defined(_WIN32)
#error "No support for WGL"
#elif defined(__APPLE__)
#error "No support for Apple GL"
#elif __linux__
#include "CGLXContext.hpp"
typedef CGLXContext CContext;
#endif
#endif // LIBBOO_HPP

View File

@ -1,5 +1,11 @@
CONFIG -= Qt
CONFIG += app c++11
HEADERS += \
IContext.hpp
IContext.hpp \
CGLXContext.hpp \
libBoo.hpp
SOURCES += \
IContext.cpp
CGLXContext.cpp \
main.cpp

12
main.cpp Normal file
View File

@ -0,0 +1,12 @@
#include "libBoo.hpp"
#include <iostream>
int main(int argc, char* argv[])
{
IContext* context = new CContext();
std::cout << context->name() << std::endl;
std::cout << context->version() << std::endl;
std::cout << context->depthSize() << std::endl;
delete context;
}