Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V4.0.0 import #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ Makefile
Default.geo
Default.wsp
Build
.gitignore
*.gcno
debugLog.txt
ImageVis3D.pro.user
Expand All @@ -27,3 +26,4 @@ Scripts/installer/GettingDataIntoImageVis3D.pdf
*.cached
*.xcodeproj
Info.plist
.DS_Store
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "Tuvok"]
path = Tuvok
url = https://github.com/SCIInstitute/Tuvok.git
branch = master
branch = IV3D-4.0.0-import
196 changes: 98 additions & 98 deletions BatchRenderer/BatchContext.cpp
Original file line number Diff line number Diff line change
@@ -1,98 +1,98 @@
/*
For more information, please see: http://software.sci.utah.edu

The MIT License

Copyright (c) 2010 Scientific Computing and Imaging Institute,
University of Utah.


Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/

/**
\file batchContext.cpp
\author Tom Fogal
SCI Institute
University of Utah
\brief Establishes an OpenGL context.
*/

#include <iostream>
#include <stdexcept>

#include <GLEW/GL/glew.h>

#include "Renderer/GL/GLStateManager.h"
#include "BatchContext.h"

#include "CGLContext.h"
#include "GLXContext.h"
#include "WGLContext.h"
#include "NSContext.h"

namespace tuvok
{

BatchContext::BatchContext() :
Context(0) // Tuvok specific
{
ctx = nullptr; // Tuvok specific
}

BatchContext* BatchContext::Create(uint32_t width, uint32_t height,
uint8_t color_bits, uint8_t depth_bits,
uint8_t stencil_bits, bool double_buffer,
bool visible)
{
BatchContext* bctx;
#ifdef DETECTED_OS_WINDOWS
bctx = new WGLContext(width, height, color_bits, depth_bits, stencil_bits,
double_buffer, visible);
#elif defined(DETECTED_OS_APPLE) && defined(USE_CGL)
bctx = new CGLContext(width, height, color_bits, depth_bits, stencil_bits,
double_buffer, visible);
#elif defined(DETECTED_OS_APPLE)
bctx = new NSContext(width, height, color_bits, depth_bits, stencil_bits,
double_buffer, visible);
#else
bctx = new GLXBatchContext(width, height, color_bits, depth_bits, stencil_bits,
double_buffer, visible);
#endif
if (bctx->makeCurrent() == false)
std::cerr << "Unable to make context current!" << std::endl;

GLenum glerr = glewInit();
if (GLEW_OK != glerr)
{
std::cerr << "Error initializing GLEW: " << glewGetErrorString(glerr) << "\n";
throw std::runtime_error("could not initialize GLEW.");
}

// Tuvok specific
bctx->m_pState = std::shared_ptr<StateManager>(new GLStateManager());

// Tuvok specific (this is really bad, but no one uses the pointer to the
// context anyways...).
bctx->ctx = (const void*)bctx;

return bctx;
}

}
/*
For more information, please see: http://software.sci.utah.edu
The MIT License
Copyright (c) 2010 Scientific Computing and Imaging Institute,
University of Utah.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
/**
\file batchContext.cpp
\author Tom Fogal
SCI Institute
University of Utah
\brief Establishes an OpenGL context.
*/
#include <iostream>
#include <stdexcept>
#include <GLEW/GL/glew.h>
#include "Renderer/GL/GLStateManager.h"
#include "BatchContext.h"
#include "CGLContext.h"
#include "GLXContext.h"
#include "WGLContext.h"
#include "NSContext.h"
namespace tuvok
{
BatchContext::BatchContext() :
Context(0) // Tuvok specific
{
ctx = nullptr; // Tuvok specific
}
BatchContext* BatchContext::Create(uint32_t width, uint32_t height,
uint8_t color_bits, uint8_t depth_bits,
uint8_t stencil_bits, bool double_buffer,
bool visible)
{
BatchContext* bctx;
#ifdef DETECTED_OS_WINDOWS
bctx = new WGLContext(width, height, color_bits, depth_bits, stencil_bits,
double_buffer, visible);
#elif defined(DETECTED_OS_APPLE) && defined(USE_CGL)
bctx = new CGLContext(width, height, color_bits, depth_bits, stencil_bits,
double_buffer, visible);
#elif defined(DETECTED_OS_APPLE)
bctx = new NSContext(width, height, color_bits, depth_bits, stencil_bits,
double_buffer, visible);
#else
bctx = new GLXBatchContext(width, height, color_bits, depth_bits, stencil_bits,
double_buffer, visible);
#endif
if (bctx->makeCurrent() == false)
std::cerr << "Unable to make context current!" << std::endl;
GLenum glerr = glewInit();
if (GLEW_OK != glerr)
{
std::cerr << "Error initializing GLEW: " << glewGetErrorString(glerr) << "\n";
throw std::runtime_error("could not initialize GLEW.");
}
// Tuvok specific
bctx->m_pState = std::shared_ptr<StateManager>(new GLStateManager());
// Tuvok specific (this is really bad, but no one uses the pointer to the
// context anyways...).
bctx->ctx = (const void*)bctx;
return bctx;
}
}
160 changes: 80 additions & 80 deletions BatchRenderer/BatchContext.h
Original file line number Diff line number Diff line change
@@ -1,80 +1,80 @@
/*
For more information, please see: http://software.sci.utah.edu

The MIT License

Copyright (c) 2010 Scientific Computing and Imaging Institute,
University of Utah.


Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/

/**
\file batchContext.cpp
\author Tom Fogal
SCI Institute
University of Utah
\brief Simple wrapper for establishing an OpenGL context.
*/

#ifndef BATCH_RENDERER_CONTEXT_H
#define BATCH_RENDERER_CONTEXT_H

#include <exception>

#include "Renderer/Context.h" // Tuvok specific

namespace tuvok
{

class BatchContext : public Context // Tuvok specific
{
public:
/// This virtual constructor will create the appropriate context based
/// on the current operating system.
static BatchContext* Create(uint32_t width, uint32_t height,
uint8_t color_bits=32, uint8_t depth_bits=24,
uint8_t stencil_bits=8, bool double_buffer=true,
bool visible=false);
virtual ~BatchContext() {}

virtual bool isValid() const=0;
virtual bool makeCurrent()=0;
virtual bool swapBuffers()=0;

protected:

BatchContext();

};

class NoAvailableContext : public std::exception
{
public:
virtual ~NoAvailableContext() throw() {}
virtual const char* what() const throw()
{
return "No context was available to utilize.";
}
};

}

#endif // BATCH_RENDERER_CONTEXT_H
/*
For more information, please see: http://software.sci.utah.edu
The MIT License
Copyright (c) 2010 Scientific Computing and Imaging Institute,
University of Utah.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
/**
\file batchContext.cpp
\author Tom Fogal
SCI Institute
University of Utah
\brief Simple wrapper for establishing an OpenGL context.
*/
#ifndef BATCH_RENDERER_CONTEXT_H
#define BATCH_RENDERER_CONTEXT_H
#include <exception>
#include "Renderer/Context.h" // Tuvok specific
namespace tuvok
{
class BatchContext : public Context // Tuvok specific
{
public:
/// This virtual constructor will create the appropriate context based
/// on the current operating system.
static BatchContext* Create(uint32_t width, uint32_t height,
uint8_t color_bits=32, uint8_t depth_bits=24,
uint8_t stencil_bits=8, bool double_buffer=true,
bool visible=false);
virtual ~BatchContext() {}
virtual bool isValid() const=0;
virtual bool makeCurrent()=0;
virtual bool swapBuffers()=0;
protected:
BatchContext();
};
class NoAvailableContext : public std::exception
{
public:
virtual ~NoAvailableContext() throw() {}
virtual const char* what() const throw()
{
return "No context was available to utilize.";
}
};
}
#endif // BATCH_RENDERER_CONTEXT_H
Loading