Source code
/*
* OpenGLList.h
* Copyright (c) 2015 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED.
*/
#pragma once
#include <viz++/opengl/OpenGLObject.h>
#include <viz++/Exception.h>
namespace VIZ {
class OpenGLList :public OpenGLObject {
private:
GLuint list;
GLenum mode;
public:
OpenGLList(GLuint list, GLenum mode)
:list(list),
mode(mode)
{
if (list <= 0) {
throw IException("Invalid list id:%d", list);
}
if (glIsList(list) == GL_TRUE) {
throw IException("Already used id:%d", list);
}
if (mode == GL_COMPILE || mode == GL_COMPILE_AND_EXECUTE) {
glNewList(list, mode);
} else {
throw IException("Invalid mode:%d", mode);
}
}
OpenGLList(GLuint list)
:list(list),
mode(0)
{
if (list <= 0) {
throw IException("Invalid list id:%d", list);
}
//Play displaylist
}
~OpenGLList()
{
if (mode != 0) {
save();
}
}
void save()
{
glEndList();
}
void call()
{
if (mode == 0) {
glCallList(list);
}
}
};
}
Last modified: 10 Feb 2017
Copyright (c) 2009-2017 Antillia.com ALL RIGHTS RESERVED.