mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Integrated visualization modules to changelist 20202
p4#: 20204
This commit is contained in:
@@ -489,8 +489,11 @@ double Camera::aspectRatio() const
|
||||
/// This method calls Viewport::set() and then updates the projection matrix, as this is depending
|
||||
/// on the viewport dimensions.
|
||||
/// This method is usually used as a response to a Resize message from the window system
|
||||
///
|
||||
/// The window coordinates (x,y) are in OpenGL style coordinates, which means a right handed
|
||||
/// coordinate system with the origin in the lower left corner of the window.
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Camera::setViewport(uint x, uint y, uint width, uint height)
|
||||
void Camera::setViewport(int x, int y, uint width, uint height)
|
||||
{
|
||||
CVF_ASSERT(m_viewport.notNull());
|
||||
m_viewport->set(x, y, width, height);
|
||||
@@ -528,22 +531,19 @@ const Viewport* Camera::viewport() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Create a Ray from window coordinates
|
||||
///
|
||||
/// The coordinates (winCoordX & winCoordY) are assumed to be in the window coordinate system
|
||||
/// where <0,0> if in the top left corner.
|
||||
/// The window coordinates are in OpenGL style coordinates, which means a right handed
|
||||
/// coordinate system with the origin in the lower left corner of the window.
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
ref<Ray> Camera::rayFromWinCoord(int winCoordX, int winCoordY) const
|
||||
ref<Ray> Camera::rayFromWindowCoordinates(int x, int y) const
|
||||
{
|
||||
// Unproject works in OpenGL coord system with (0,0) in lower left corner, so flip the y-coordinate
|
||||
winCoordY = static_cast<int>(m_viewport->height()) - winCoordY;
|
||||
|
||||
Vec3d coord0(0, 0, 0);
|
||||
if (!unproject(Vec3d(static_cast<double>(winCoordX), static_cast<double>(winCoordY), 0), &coord0))
|
||||
if (!unproject(Vec3d(static_cast<double>(x), static_cast<double>(y), 0), &coord0))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Vec3d coord1(0, 0, 0);
|
||||
if (!unproject(Vec3d(static_cast<double>(winCoordX), static_cast<double>(winCoordY), 1), &coord1))
|
||||
if (!unproject(Vec3d(static_cast<double>(x), static_cast<double>(y), 1), &coord1))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@@ -563,22 +563,19 @@ ref<Ray> Camera::rayFromWinCoord(int winCoordX, int winCoordY) const
|
||||
///
|
||||
/// The plane will be constructed so that the specified line lies in the plane, and the plane
|
||||
/// normal will be pointing left when moving along the line from start to end.
|
||||
/// The coordinates (winCoordStart & winCoordEnd) are assumed to be in the window coordinate system
|
||||
/// where <0,0> is in the top left corner.
|
||||
///
|
||||
/// The window coordinates are in OpenGL style coordinates, which means a right handed
|
||||
/// coordinate system with the origin in the lower left corner of the window.
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
ref<Plane> Camera::planeFromLineWinCoord(Vec2i winCoordStart, Vec2i winCoordEnd) const
|
||||
ref<Plane> Camera::planeFromLineWindowCoordinates(Vec2i coordStart, Vec2i coordEnd) const
|
||||
{
|
||||
// Unproject works in OpenGL coord system with (0,0) in lower left corner, so flip the y-coordinates
|
||||
winCoordStart.y() = static_cast<int>(m_viewport->height()) - winCoordStart.y();
|
||||
winCoordEnd.y() = static_cast<int>(m_viewport->height()) - winCoordEnd.y();
|
||||
|
||||
Vec3d s0(0, 0, 0);
|
||||
Vec3d e0(0, 0, 0);
|
||||
Vec3d e1(0, 0, 0);
|
||||
bool unprojOk = true;
|
||||
unprojOk &= unproject(Vec3d(winCoordStart.x(), winCoordStart.y(), 0), &s0);
|
||||
unprojOk &= unproject(Vec3d(winCoordEnd.x(), winCoordEnd.y(), 0), &e0);
|
||||
unprojOk &= unproject(Vec3d(winCoordEnd.x(), winCoordEnd.y(), 1), &e1);
|
||||
unprojOk &= unproject(Vec3d(coordStart.x(), coordStart.y(), 0), &s0);
|
||||
unprojOk &= unproject(Vec3d(coordEnd.x(), coordEnd.y(), 0), &e0);
|
||||
unprojOk &= unproject(Vec3d(coordEnd.x(), coordEnd.y(), 1), &e1);
|
||||
if (!unprojOk)
|
||||
{
|
||||
return NULL;
|
||||
@@ -770,7 +767,7 @@ bool Camera::unproject(const Vec3d& coord, Vec3d* out) const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool Camera::project(const Vec3d& point, Vec3d* out) const
|
||||
{
|
||||
return GeometryUtils::project(m_cachedProjectionMultViewMatrix, Vec2ui(m_viewport->x(), m_viewport->y()), Vec2ui(m_viewport->width(), m_viewport->height()), point, out);
|
||||
return GeometryUtils::project(m_cachedProjectionMultViewMatrix, Vec2i(m_viewport->x(), m_viewport->y()), Vec2ui(m_viewport->width(), m_viewport->height()), point, out);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -81,12 +81,12 @@ public:
|
||||
double frontPlanePixelHeight() const;
|
||||
double distanceWhereObjectProjectsToPixelExtent(double objectExtentWorld, double objectExtentPixels) const;
|
||||
|
||||
void setViewport(uint x, uint y, uint width, uint height);
|
||||
void setViewport(int x, int y, uint width, uint height);
|
||||
Viewport* viewport();
|
||||
const Viewport* viewport() const;
|
||||
|
||||
ref<Ray> rayFromWinCoord(int winCoordX, int winCoordY) const;
|
||||
ref<Plane> planeFromLineWinCoord(Vec2i winCoordStart, Vec2i winCoordEnd) const;
|
||||
ref<Ray> rayFromWindowCoordinates(int x, int y) const;
|
||||
ref<Plane> planeFromLineWindowCoordinates(Vec2i coordStart, Vec2i coordEnd) const;
|
||||
bool unproject(const Vec3d& coord, Vec3d* out) const;
|
||||
bool project(const Vec3d& point, Vec3d* out) const;
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ MatrixState::MatrixState(const Camera& camera)
|
||||
m_modelMatrix(),
|
||||
m_modelMatrixIsSet(false),
|
||||
m_viewProjectionMatrix(m_projectionMatrix*m_viewMatrix),
|
||||
m_viewportPosition(static_cast<uint>(camera.viewport()->x()), static_cast<uint>(camera.viewport()->y())),
|
||||
m_viewportPosition(camera.viewport()->x(), camera.viewport()->y()),
|
||||
m_viewportSize(static_cast<uint>(camera.viewport()->width()), static_cast<uint>(camera.viewport()->height())),
|
||||
m_pixelHeightAtUnitDistance(0.0f),
|
||||
m_versionTick(1)
|
||||
@@ -59,7 +59,7 @@ MatrixState::MatrixState(const Camera& camera)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
MatrixState::MatrixState(const Vec2ui& viewportPosition, const Vec2ui& viewportSize, const Mat4d& projectionMatrix, const Mat4d& viewMatrix)
|
||||
MatrixState::MatrixState(const Vec2i& viewportPosition, const Vec2ui& viewportSize, const Mat4d& projectionMatrix, const Mat4d& viewMatrix)
|
||||
: m_projectionMatrix(projectionMatrix),
|
||||
m_viewMatrix(viewMatrix),
|
||||
m_modelMatrix(),
|
||||
@@ -295,7 +295,7 @@ float MatrixState::pixelHeightAtUnitDistance() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
Vec2ui MatrixState::viewportPosition() const
|
||||
Vec2i MatrixState::viewportPosition() const
|
||||
{
|
||||
return m_viewportPosition;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ class MatrixState
|
||||
{
|
||||
public:
|
||||
MatrixState(const Camera& camera);
|
||||
MatrixState(const Vec2ui& viewportPosition, const Vec2ui& viewportSize, const Mat4d& projectionMatrix, const Mat4d& viewMatrix);
|
||||
MatrixState(const Vec2i& viewportPosition, const Vec2ui& viewportSize, const Mat4d& projectionMatrix, const Mat4d& viewMatrix);
|
||||
|
||||
void setViewMatrix(const Mat4d& viewMatrix);
|
||||
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
Mat3f normalMatrix() const;
|
||||
|
||||
float pixelHeightAtUnitDistance() const;
|
||||
Vec2ui viewportPosition() const;
|
||||
Vec2i viewportPosition() const;
|
||||
Vec2ui viewportSize() const;
|
||||
|
||||
uint versionTick() const;
|
||||
@@ -71,7 +71,7 @@ private:
|
||||
bool m_modelMatrixIsSet; // Set to true when a model matrix is set, false when no model matrix is currently set
|
||||
Mat4f m_viewProjectionMatrix; // Combined view matrix and projection matrix
|
||||
|
||||
Vec2ui m_viewportPosition; // Position of the viewport
|
||||
Vec2i m_viewportPosition; // Position of the viewport
|
||||
Vec2ui m_viewportSize; // Size of the viewport
|
||||
float m_pixelHeightAtUnitDistance;// Height of a pixel at unit distance (distance of 1.0 from camera) in world system. For perspective projections this value must be multiplied by the distance to the point in question
|
||||
|
||||
|
||||
@@ -27,6 +27,14 @@
|
||||
|
||||
#include <memory.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#pragma warning (push)
|
||||
#pragma warning (disable: 4668)
|
||||
#include "glew/GL/wglew.h"
|
||||
#pragma warning (pop)
|
||||
#endif
|
||||
|
||||
|
||||
namespace cvf {
|
||||
|
||||
|
||||
@@ -46,7 +54,8 @@ namespace cvf {
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
OpenGLContextGroup::OpenGLContextGroup()
|
||||
: m_isInitialized(false),
|
||||
m_glewContextStruct(NULL)
|
||||
m_glewContextStruct(NULL),
|
||||
m_wglewContextStruct(NULL)
|
||||
{
|
||||
m_resourceManager = new OpenGLResourceManager;
|
||||
m_logger = new Logger;
|
||||
@@ -116,6 +125,14 @@ bool OpenGLContextGroup::initializeContextGroup(OpenGLContext* currentContext)
|
||||
}
|
||||
|
||||
configureCapablititesFromGLEW(currentContext);
|
||||
|
||||
#ifdef WIN32
|
||||
if (!initializeWGLEW(currentContext))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
m_isInitialized = true;
|
||||
@@ -138,8 +155,13 @@ void OpenGLContextGroup::uninitializeContextGroup()
|
||||
|
||||
#ifdef CVF_USE_GLEW
|
||||
delete m_glewContextStruct;
|
||||
|
||||
#ifdef WIN32
|
||||
delete m_wglewContextStruct;
|
||||
#endif
|
||||
#endif
|
||||
m_glewContextStruct = NULL;
|
||||
m_wglewContextStruct = NULL;
|
||||
|
||||
m_isInitialized = false;
|
||||
}
|
||||
@@ -231,6 +253,45 @@ bool OpenGLContextGroup::initializeGLEW(OpenGLContext* currentContext)
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Initializes GLEW for this context group
|
||||
///
|
||||
/// \warning The context passed in \a currentContext must be current!
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool OpenGLContextGroup::initializeWGLEW(OpenGLContext* currentContext)
|
||||
{
|
||||
CVF_ASSERT(currentContext);
|
||||
CVF_ASSERT(m_wglewContextStruct == NULL);
|
||||
|
||||
#if defined(CVF_USE_GLEW) && defined(WIN32)
|
||||
|
||||
// Since we're sometimes (when using Core OpenGL) seeing some OGL errors from GLEW, check before and after call to help find them
|
||||
CVF_CHECK_OGL(currentContext);
|
||||
|
||||
// Must allocate memory for struct first since glewInit() call below will try and retrieve it
|
||||
WGLEWContextStruct* theContextStruct = new WGLEWContextStruct;
|
||||
memset(theContextStruct, 0, sizeof(WGLEWContextStruct));
|
||||
GLenum err = wglewContextInit(theContextStruct);
|
||||
if (err != GLEW_OK)
|
||||
{
|
||||
delete theContextStruct;
|
||||
return false;
|
||||
}
|
||||
|
||||
m_wglewContextStruct = theContextStruct;
|
||||
|
||||
CVF_CHECK_OGL(currentContext);
|
||||
|
||||
#else
|
||||
|
||||
CVF_FAIL_MSG("Not implemented");
|
||||
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Configures the capabilities of this context group by querying GLEW
|
||||
///
|
||||
@@ -374,5 +435,24 @@ GLEWContextStruct* OpenGLContextGroup::glewContextStruct()
|
||||
}
|
||||
|
||||
|
||||
} // namespace cvf
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
WGLEWContextStruct* OpenGLContextGroup::wglewContextStruct()
|
||||
{
|
||||
#if defined(CVF_USE_GLEW) && defined(WIN32)
|
||||
|
||||
CVF_TIGHT_ASSERT(this);
|
||||
CVF_TIGHT_ASSERT(m_wglewContextStruct);
|
||||
return m_wglewContextStruct;
|
||||
|
||||
#else
|
||||
|
||||
CVF_FAIL_MSG("Not implemented");
|
||||
return NULL;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
} // namespace cvf
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "cvfLogger.h"
|
||||
|
||||
struct GLEWContextStruct;
|
||||
struct WGLEWContextStruct;
|
||||
|
||||
namespace cvf {
|
||||
|
||||
@@ -53,12 +54,14 @@ public:
|
||||
|
||||
OpenGLCapabilities* capabilities();
|
||||
GLEWContextStruct* glewContextStruct();
|
||||
WGLEWContextStruct* wglewContextStruct();
|
||||
|
||||
private:
|
||||
bool initializeContextGroup(OpenGLContext* currentContext);
|
||||
void uninitializeContextGroup();
|
||||
void contextAboutToBeShutdown(OpenGLContext* contextToShutdown);
|
||||
bool initializeGLEW(OpenGLContext* currentContext);
|
||||
bool initializeWGLEW(OpenGLContext* currentContext);
|
||||
void configureCapablititesFromGLEW(OpenGLContext* currentContext);
|
||||
void addContext(OpenGLContext* contextToAdd);
|
||||
|
||||
@@ -69,6 +72,7 @@ private:
|
||||
ref<Logger> m_logger;
|
||||
ref<OpenGLCapabilities> m_capabilities; // Capabilities of the contexts in this group context
|
||||
GLEWContextStruct* m_glewContextStruct; // Pointer to the GLEW context struct
|
||||
WGLEWContextStruct* m_wglewContextStruct; // Pointer to the GLEW context struct
|
||||
|
||||
friend class OpenGLContext;
|
||||
};
|
||||
@@ -76,5 +80,3 @@ private:
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ void OverlayAxisCross::setSize(const Vec2ui& size)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Hardware rendering using shader programs
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void OverlayAxisCross::render(OpenGLContext* oglContext, const Vec2ui& position, const Vec2ui& size)
|
||||
void OverlayAxisCross::render(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size)
|
||||
{
|
||||
Mat4d viewMatrix = m_camera->viewMatrix();
|
||||
render(oglContext, position, size, false, viewMatrix);
|
||||
@@ -150,7 +150,7 @@ void OverlayAxisCross::render(OpenGLContext* oglContext, const Vec2ui& position,
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Software rendering
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void OverlayAxisCross::renderSoftware(OpenGLContext* oglContext, const Vec2ui& position, const Vec2ui& size)
|
||||
void OverlayAxisCross::renderSoftware(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size)
|
||||
{
|
||||
Mat4d viewMatrix = m_camera->viewMatrix();
|
||||
render(oglContext, position, size, true, viewMatrix);
|
||||
@@ -160,7 +160,7 @@ void OverlayAxisCross::renderSoftware(OpenGLContext* oglContext, const Vec2ui& p
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Set up camera/viewport and render
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void OverlayAxisCross::render(OpenGLContext* oglContext, const Vec2ui& position, const Vec2ui& size, bool software, const Mat4d& viewMatrix)
|
||||
void OverlayAxisCross::render(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size, bool software, const Mat4d& viewMatrix)
|
||||
{
|
||||
if (size.x() <= 0 || size.y() <= 0)
|
||||
{
|
||||
|
||||
@@ -49,8 +49,8 @@ public:
|
||||
virtual Vec2ui maximumSize();
|
||||
virtual Vec2ui minimumSize();
|
||||
|
||||
virtual void render(OpenGLContext* oglContext, const Vec2ui& position, const Vec2ui& size);
|
||||
virtual void renderSoftware(OpenGLContext* oglContext, const Vec2ui& position, const Vec2ui& size);
|
||||
virtual void render(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size);
|
||||
virtual void renderSoftware(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size);
|
||||
|
||||
void setSize(const Vec2ui& size);
|
||||
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
void setAxisLabelsColor(const Color3f& color);
|
||||
|
||||
private:
|
||||
void render(OpenGLContext* oglContext, const Vec2ui& position, const Vec2ui& size, bool software, const Mat4d& viewMatrix);
|
||||
void render(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size, bool software, const Mat4d& viewMatrix);
|
||||
void createAxisGeometry(bool software);
|
||||
void renderAxis(OpenGLContext* oglContext, const MatrixState& matrixState);
|
||||
void renderAxisImmediateMode(OpenGLContext* oglContext, const MatrixState& matrixState);
|
||||
|
||||
@@ -198,7 +198,7 @@ String OverlayColorLegend::title() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Hardware rendering using shader programs
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void OverlayColorLegend::render(OpenGLContext* oglContext, const Vec2ui& position, const Vec2ui& size)
|
||||
void OverlayColorLegend::render(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size)
|
||||
{
|
||||
render(oglContext, position, size, false);
|
||||
}
|
||||
@@ -207,7 +207,7 @@ void OverlayColorLegend::render(OpenGLContext* oglContext, const Vec2ui& positio
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Software rendering using software
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void OverlayColorLegend::renderSoftware(OpenGLContext* oglContext, const Vec2ui& position, const Vec2ui& size)
|
||||
void OverlayColorLegend::renderSoftware(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size)
|
||||
{
|
||||
render(oglContext, position, size, true);
|
||||
}
|
||||
@@ -216,21 +216,21 @@ void OverlayColorLegend::renderSoftware(OpenGLContext* oglContext, const Vec2ui&
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool OverlayColorLegend::pick(uint oglXCoord, uint oglYCoord, const Vec2ui& position, const Vec2ui& size)
|
||||
bool OverlayColorLegend::pick(int x, int y, const Vec2i& position, const Vec2ui& size)
|
||||
{
|
||||
Rectui oglRect(position, size.x(), size.y());
|
||||
Recti oglRect(position, static_cast<int>(size.x()), static_cast<int>(size.y()));
|
||||
|
||||
OverlayColorLegendLayoutInfo layoutInViewPortCoords(oglRect.min(), Vec2ui(oglRect.width(), oglRect.height()));
|
||||
OverlayColorLegendLayoutInfo layoutInViewPortCoords(oglRect.min(), Vec2ui(static_cast<uint>(oglRect.width()), static_cast<uint>(oglRect.height())));
|
||||
layoutInfo(&layoutInViewPortCoords);
|
||||
|
||||
Vec2ui legendBarOrigin = oglRect.min();
|
||||
Vec2i legendBarOrigin = oglRect.min();
|
||||
legendBarOrigin.x() += static_cast<uint>(layoutInViewPortCoords.legendRect.min().x());
|
||||
legendBarOrigin.y() += static_cast<uint>(layoutInViewPortCoords.legendRect.min().y());
|
||||
|
||||
Rectui legendBarRect = Rectui(legendBarOrigin, static_cast<uint>(layoutInViewPortCoords.legendRect.width()), static_cast<uint>(layoutInViewPortCoords.legendRect.height()));
|
||||
Recti legendBarRect = Recti(legendBarOrigin, static_cast<int>(layoutInViewPortCoords.legendRect.width()), static_cast<int>(layoutInViewPortCoords.legendRect.height()));
|
||||
|
||||
if ((oglXCoord > legendBarRect.min().x()) && (oglXCoord < legendBarRect.max().x()) &&
|
||||
(oglYCoord > legendBarRect.min().y()) && (oglYCoord < legendBarRect.max().y()))
|
||||
if ((x > legendBarRect.min().x()) && (x < legendBarRect.max().x()) &&
|
||||
(y > legendBarRect.min().y()) && (y < legendBarRect.max().y()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -242,7 +242,7 @@ bool OverlayColorLegend::pick(uint oglXCoord, uint oglYCoord, const Vec2ui& posi
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Set up camera/viewport and render
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void OverlayColorLegend::render(OpenGLContext* oglContext, const Vec2ui& position, const Vec2ui& size, bool software)
|
||||
void OverlayColorLegend::render(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size, bool software)
|
||||
{
|
||||
if (size.x() <= 0 || size.y() <= 0)
|
||||
{
|
||||
|
||||
@@ -40,7 +40,7 @@ class TextDrawer;
|
||||
//==================================================================================================
|
||||
struct OverlayColorLegendLayoutInfo
|
||||
{
|
||||
OverlayColorLegendLayoutInfo(const Vec2ui& pos, const Vec2ui& setSize)
|
||||
OverlayColorLegendLayoutInfo(const Vec2i& pos, const Vec2ui& setSize)
|
||||
{
|
||||
position = pos;
|
||||
size = setSize;
|
||||
@@ -56,7 +56,7 @@ struct OverlayColorLegendLayoutInfo
|
||||
|
||||
ref<DoubleArray> tickPixelPos;
|
||||
|
||||
Vec2ui position;
|
||||
Vec2i position;
|
||||
Vec2ui size;
|
||||
};
|
||||
|
||||
@@ -76,9 +76,9 @@ public:
|
||||
virtual Vec2ui maximumSize();
|
||||
virtual Vec2ui minimumSize();
|
||||
|
||||
virtual void render(OpenGLContext* oglContext, const Vec2ui& position, const Vec2ui& size);
|
||||
virtual void renderSoftware(OpenGLContext* oglContext, const Vec2ui& position, const Vec2ui& size);
|
||||
virtual bool pick(uint oglXCoord, uint oglYCoord, const Vec2ui& position, const Vec2ui& size);
|
||||
virtual void render(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size);
|
||||
virtual void renderSoftware(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size);
|
||||
virtual bool pick(int x, int y, const Vec2i& position, const Vec2ui& size);
|
||||
|
||||
void configureLevels(const Color3ubArray& levelColors, const DoubleArray& tickValues);
|
||||
|
||||
@@ -96,7 +96,7 @@ public:
|
||||
String title() const;
|
||||
|
||||
protected:
|
||||
void render(OpenGLContext* oglContext, const Vec2ui& position, const Vec2ui& size, bool software);
|
||||
void render(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size, bool software);
|
||||
virtual void renderLegend(OpenGLContext* oglContext, OverlayColorLegendLayoutInfo* layout, const MatrixState& matrixState);
|
||||
virtual void renderLegendImmediateMode(OpenGLContext* oglContext, OverlayColorLegendLayoutInfo* layout);
|
||||
virtual void setupTextDrawer(TextDrawer* textDrawer, OverlayColorLegendLayoutInfo* layout);
|
||||
|
||||
@@ -111,7 +111,7 @@ cvf::Vec2ui OverlayImage::minimumSize()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Render using Shaders
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void OverlayImage::render(OpenGLContext* oglContext, const Vec2ui& position, const Vec2ui& size)
|
||||
void OverlayImage::render(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size)
|
||||
{
|
||||
render(oglContext, position, size, false);
|
||||
}
|
||||
@@ -120,7 +120,7 @@ void OverlayImage::render(OpenGLContext* oglContext, const Vec2ui& position, con
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Render using Fixed Function
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void OverlayImage::renderSoftware(OpenGLContext* oglContext, const Vec2ui& position, const Vec2ui& size)
|
||||
void OverlayImage::renderSoftware(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size)
|
||||
{
|
||||
render(oglContext, position, size, true);
|
||||
}
|
||||
@@ -129,7 +129,7 @@ void OverlayImage::renderSoftware(OpenGLContext* oglContext, const Vec2ui& posit
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void OverlayImage::render(OpenGLContext* oglContext, const Vec2ui& position, const Vec2ui& size, bool software)
|
||||
void OverlayImage::render(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size, bool software)
|
||||
{
|
||||
CVF_CALLSITE_OPENGL(oglContext);
|
||||
|
||||
@@ -262,6 +262,12 @@ void OverlayImage::render(OpenGLContext* oglContext, const Vec2ui& position, con
|
||||
RenderStateBlending blend;
|
||||
blend.applyOpenGL(oglContext);
|
||||
}
|
||||
|
||||
if (!software)
|
||||
{
|
||||
glDisableVertexAttribArray(ShaderProgram::VERTEX);
|
||||
glDisableVertexAttribArray(ShaderProgram::TEX_COORD_2F_0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -52,8 +52,8 @@ public:
|
||||
virtual Vec2ui maximumSize();
|
||||
virtual Vec2ui minimumSize();
|
||||
|
||||
virtual void render(OpenGLContext* oglContext, const Vec2ui& position, const Vec2ui& size);
|
||||
virtual void renderSoftware(OpenGLContext* oglContext, const Vec2ui& position, const Vec2ui& size);
|
||||
virtual void render(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size);
|
||||
virtual void renderSoftware(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size);
|
||||
|
||||
void setImage(TextureImage* image);
|
||||
void setPixelSize(const Vec2ui& size);
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
const TextureImage* image() const;
|
||||
|
||||
private:
|
||||
void render(OpenGLContext* oglContext, const Vec2ui& position, const Vec2ui& size, bool software);
|
||||
void render(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size, bool software);
|
||||
|
||||
private:
|
||||
Vec2ui m_size;
|
||||
|
||||
@@ -46,12 +46,12 @@ namespace cvf {
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Do hit test on the overlay item. Base class only does a check
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool OverlayItem::pick(uint oglXCoord, uint oglYCoord, const Vec2ui& position, const Vec2ui& size)
|
||||
bool OverlayItem::pick(int x, int y, const Vec2i& position, const Vec2ui& size)
|
||||
{
|
||||
Rectui oglRect(position, size.x(), size.y());
|
||||
Recti oglRect(position, static_cast<int>(size.x()), static_cast<int>(size.y()));
|
||||
|
||||
if ((oglXCoord > oglRect.min().x()) && (oglXCoord < oglRect.max().x()) &&
|
||||
(oglYCoord > oglRect.min().y()) && (oglYCoord < oglRect.max().y()))
|
||||
if ((x > oglRect.min().x()) && (x < oglRect.max().x()) &&
|
||||
(y > oglRect.min().y()) && (y < oglRect.max().y()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -57,9 +57,9 @@ public:
|
||||
virtual Vec2ui maximumSize() = 0; // In Pixels
|
||||
virtual Vec2ui minimumSize() = 0; // In Pixels
|
||||
|
||||
virtual void render(OpenGLContext* oglContext, const Vec2ui& position, const Vec2ui& size) = 0;
|
||||
virtual void renderSoftware(OpenGLContext* oglContext, const Vec2ui& position, const Vec2ui& size) = 0;
|
||||
virtual bool pick(uint oglXCoord, uint oglYCoord, const Vec2ui& position, const Vec2ui& size);
|
||||
virtual void render(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size) = 0;
|
||||
virtual void renderSoftware(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size) = 0;
|
||||
virtual bool pick(int oglXCoord, int oglYCoord, const Vec2i& position, const Vec2ui& size);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ void OverlayNavigationCube::setSize(const Vec2ui& size)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Hardware rendering using shader programs
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void OverlayNavigationCube::render(OpenGLContext* oglContext, const Vec2ui& position, const Vec2ui& size)
|
||||
void OverlayNavigationCube::render(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size)
|
||||
{
|
||||
Mat4d viewMatrix = m_camera->viewMatrix();
|
||||
render(oglContext, position, size, false, viewMatrix);
|
||||
@@ -155,7 +155,7 @@ void OverlayNavigationCube::render(OpenGLContext* oglContext, const Vec2ui& posi
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Software rendering
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void OverlayNavigationCube::renderSoftware(OpenGLContext* oglContext, const Vec2ui& position, const Vec2ui& size)
|
||||
void OverlayNavigationCube::renderSoftware(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size)
|
||||
{
|
||||
Mat4d viewMatrix = m_camera->viewMatrix();
|
||||
render(oglContext, position, size, true, viewMatrix);
|
||||
@@ -165,7 +165,7 @@ void OverlayNavigationCube::renderSoftware(OpenGLContext* oglContext, const Vec2
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Set up camera/viewport and render
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void OverlayNavigationCube::render(OpenGLContext* oglContext, const Vec2ui& position, const Vec2ui& size, bool software, const Mat4d& viewMatrix)
|
||||
void OverlayNavigationCube::render(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size, bool software, const Mat4d& viewMatrix)
|
||||
{
|
||||
if (size.x() <= 0 || size.y() <= 0)
|
||||
{
|
||||
|
||||
@@ -119,8 +119,8 @@ public:
|
||||
virtual Vec2ui maximumSize();
|
||||
virtual Vec2ui minimumSize();
|
||||
|
||||
virtual void render(OpenGLContext* oglContext, const Vec2ui& position, const Vec2ui& size);
|
||||
virtual void renderSoftware(OpenGLContext* oglContext, const Vec2ui& position, const Vec2ui& size);
|
||||
virtual void render(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size);
|
||||
virtual void renderSoftware(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size);
|
||||
|
||||
void setSize(const Vec2ui& size);
|
||||
void updateHighlight(int winCoordX, int winCoordY);
|
||||
@@ -130,7 +130,7 @@ public:
|
||||
void setAxisLabelsColor(const Color3f& color);
|
||||
|
||||
private:
|
||||
void render(OpenGLContext* oglContext, const Vec2ui& position, const Vec2ui& size, bool software, const Mat4d& viewMatrix);
|
||||
void render(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size, bool software, const Mat4d& viewMatrix);
|
||||
void createAxisGeometry(bool software);
|
||||
void renderAxis(OpenGLContext* oglContext, const MatrixState& matrixState);
|
||||
void renderAxisImmediateMode(OpenGLContext* oglContext, const MatrixState& matrixState);
|
||||
|
||||
@@ -198,7 +198,7 @@ String OverlayScalarMapperLegend::title() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Hardware rendering using shader programs
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void OverlayScalarMapperLegend::render(OpenGLContext* oglContext, const Vec2ui& position, const Vec2ui& size)
|
||||
void OverlayScalarMapperLegend::render(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size)
|
||||
{
|
||||
render(oglContext, position, size, false);
|
||||
}
|
||||
@@ -207,7 +207,7 @@ void OverlayScalarMapperLegend::render(OpenGLContext* oglContext, const Vec2ui&
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Software rendering using software
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void OverlayScalarMapperLegend::renderSoftware(OpenGLContext* oglContext, const Vec2ui& position, const Vec2ui& size)
|
||||
void OverlayScalarMapperLegend::renderSoftware(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size)
|
||||
{
|
||||
render(oglContext, position, size, true);
|
||||
}
|
||||
@@ -216,18 +216,18 @@ void OverlayScalarMapperLegend::renderSoftware(OpenGLContext* oglContext, const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool OverlayScalarMapperLegend::pick(uint oglXCoord, uint oglYCoord, const Vec2ui& position, const Vec2ui& size)
|
||||
bool OverlayScalarMapperLegend::pick(int oglXCoord, int oglYCoord, const Vec2i& position, const Vec2ui& size)
|
||||
{
|
||||
Rectui oglRect(position, size.x(), size.y());
|
||||
Recti oglRect(position, size.x(), size.y());
|
||||
|
||||
OverlayColorLegendLayoutInfo layoutInViewPortCoords(oglRect.min(), Vec2ui(oglRect.width(), oglRect.height()));
|
||||
layoutInfo(&layoutInViewPortCoords);
|
||||
|
||||
Vec2ui legendBarOrigin = oglRect.min();
|
||||
Vec2i legendBarOrigin = oglRect.min();
|
||||
legendBarOrigin.x() += static_cast<uint>(layoutInViewPortCoords.legendRect.min().x());
|
||||
legendBarOrigin.y() += static_cast<uint>(layoutInViewPortCoords.legendRect.min().y());
|
||||
|
||||
Rectui legendBarRect = Rectui(legendBarOrigin, static_cast<uint>(layoutInViewPortCoords.legendRect.width()), static_cast<uint>(layoutInViewPortCoords.legendRect.height()));
|
||||
Recti legendBarRect = Recti(legendBarOrigin, static_cast<uint>(layoutInViewPortCoords.legendRect.width()), static_cast<uint>(layoutInViewPortCoords.legendRect.height()));
|
||||
|
||||
if ((oglXCoord > legendBarRect.min().x()) && (oglXCoord < legendBarRect.max().x()) &&
|
||||
(oglYCoord > legendBarRect.min().y()) && (oglYCoord < legendBarRect.max().y()))
|
||||
@@ -242,7 +242,7 @@ bool OverlayScalarMapperLegend::pick(uint oglXCoord, uint oglYCoord, const Vec2u
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Set up camera/viewport and render
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void OverlayScalarMapperLegend::render(OpenGLContext* oglContext, const Vec2ui& position, const Vec2ui& size, bool software)
|
||||
void OverlayScalarMapperLegend::render(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size, bool software)
|
||||
{
|
||||
if (size.x() <= 0 || size.y() <= 0)
|
||||
{
|
||||
|
||||
@@ -50,9 +50,9 @@ public:
|
||||
virtual Vec2ui minimumSize();
|
||||
void setScalarMapper(const ScalarMapper* scalarMapper);
|
||||
|
||||
virtual void render(OpenGLContext* oglContext, const Vec2ui& position, const Vec2ui& size);
|
||||
virtual void renderSoftware(OpenGLContext* oglContext, const Vec2ui& position, const Vec2ui& size);
|
||||
virtual bool pick(uint oglXCoord, uint oglYCoord, const Vec2ui& position, const Vec2ui& size);
|
||||
virtual void render(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size);
|
||||
virtual void renderSoftware(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size);
|
||||
virtual bool pick(int oglXCoord, int oglYCoord, const Vec2i& position, const Vec2ui& size);
|
||||
|
||||
|
||||
void setSizeHint(const Vec2ui& size);
|
||||
@@ -77,7 +77,7 @@ protected:
|
||||
//==================================================================================================
|
||||
struct OverlayColorLegendLayoutInfo
|
||||
{
|
||||
OverlayColorLegendLayoutInfo(const Vec2ui& pos, const Vec2ui& setSize)
|
||||
OverlayColorLegendLayoutInfo(const Vec2i& pos, const Vec2ui& setSize)
|
||||
{
|
||||
position = pos;
|
||||
size = setSize;
|
||||
@@ -93,12 +93,12 @@ protected:
|
||||
|
||||
ref<DoubleArray> tickPixelPos;
|
||||
|
||||
Vec2ui position;
|
||||
Vec2i position;
|
||||
Vec2ui size;
|
||||
};
|
||||
|
||||
|
||||
void render(OpenGLContext* oglContext, const Vec2ui& position, const Vec2ui& size, bool software);
|
||||
void render(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size, bool software);
|
||||
virtual void renderLegend(OpenGLContext* oglContext, OverlayColorLegendLayoutInfo* layout, const MatrixState& matrixState);
|
||||
virtual void renderLegendImmediateMode(OpenGLContext* oglContext, OverlayColorLegendLayoutInfo* layout);
|
||||
virtual void setupTextDrawer(TextDrawer* textDrawer, OverlayColorLegendLayoutInfo* layout);
|
||||
|
||||
@@ -104,7 +104,7 @@ cvf::Vec2ui OverlayTextBox::minimumSize()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Render using Shaders
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void OverlayTextBox::render(OpenGLContext* oglContext, const Vec2ui& position, const Vec2ui& size)
|
||||
void OverlayTextBox::render(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size)
|
||||
{
|
||||
render(oglContext, position, size, false);
|
||||
}
|
||||
@@ -113,7 +113,7 @@ void OverlayTextBox::render(OpenGLContext* oglContext, const Vec2ui& position, c
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Render using Fixed Function
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void OverlayTextBox::renderSoftware(OpenGLContext* oglContext, const Vec2ui& position, const Vec2ui& size)
|
||||
void OverlayTextBox::renderSoftware(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size)
|
||||
{
|
||||
render(oglContext, position, size, true);
|
||||
}
|
||||
@@ -122,7 +122,7 @@ void OverlayTextBox::renderSoftware(OpenGLContext* oglContext, const Vec2ui& pos
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void OverlayTextBox::render(OpenGLContext* oglContext, const Vec2ui& position, const Vec2ui& size, bool software)
|
||||
void OverlayTextBox::render(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size, bool software)
|
||||
{
|
||||
Mat4d ident;
|
||||
MatrixState matrixState(position, size, ident, ident);
|
||||
@@ -157,7 +157,7 @@ void OverlayTextBox::render(OpenGLContext* oglContext, const Vec2ui& position, c
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void OverlayTextBox::renderBackgroundAndBorder(OpenGLContext* oglContext, const Vec2ui& position, const Vec2ui& size, bool software)
|
||||
void OverlayTextBox::renderBackgroundAndBorder(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size, bool software)
|
||||
{
|
||||
CVF_CALLSITE_OPENGL(oglContext);
|
||||
|
||||
|
||||
@@ -44,8 +44,8 @@ public:
|
||||
virtual Vec2ui maximumSize();
|
||||
virtual Vec2ui minimumSize();
|
||||
|
||||
virtual void render(OpenGLContext* oglContext, const Vec2ui& position, const Vec2ui& size);
|
||||
virtual void renderSoftware(OpenGLContext* oglContext, const Vec2ui& position, const Vec2ui& size);
|
||||
virtual void render(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size);
|
||||
virtual void renderSoftware(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size);
|
||||
|
||||
void setText(const String& text);
|
||||
void setPixelSize(const Vec2ui& size);
|
||||
@@ -66,8 +66,8 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
void render(OpenGLContext* oglContext, const Vec2ui& position, const Vec2ui& size, bool software);
|
||||
void renderBackgroundAndBorder(OpenGLContext* oglContext, const Vec2ui& position, const Vec2ui& size, bool software);
|
||||
void render(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size, bool software);
|
||||
void renderBackgroundAndBorder(OpenGLContext* oglContext, const Vec2i& position, const Vec2ui& size, bool software);
|
||||
|
||||
private:
|
||||
Vec2ui m_size;
|
||||
|
||||
@@ -748,12 +748,21 @@ void ShaderProgram::discoverActiveUniforms(OpenGLContext* oglContext)
|
||||
|
||||
if (numCharsInName > 0)
|
||||
{
|
||||
const char* uniformName = uniformNameBuffer.ptr();
|
||||
int location = glGetUniformLocation(m_oglRcProgram->oglId(), uniformName);
|
||||
std::string uniformName = uniformNameBuffer.ptr();
|
||||
|
||||
// Added this code to fix a bug in the Nvidia drivers that reports arrays as xxx[0], like u_ecClipPlanes reported as u_ecClipPlanes[0]
|
||||
size_t bracketPos = uniformName.find('[');
|
||||
if (bracketPos != std::string::npos)
|
||||
{
|
||||
uniformName.resize(bracketPos);
|
||||
}
|
||||
|
||||
int location = glGetUniformLocation(m_oglRcProgram->oglId(), uniformName.c_str());
|
||||
CVF_CHECK_OGL(oglContext);
|
||||
|
||||
|
||||
FixedUniform fixedUniform;
|
||||
if (ShaderProgram::mapUniformNameToFixedUniformEnum(uniformName, &fixedUniform))
|
||||
if (ShaderProgram::mapUniformNameToFixedUniformEnum(uniformName.c_str(), &fixedUniform))
|
||||
{
|
||||
m_fixedUniformsMap[fixedUniform] = location;
|
||||
m_fixedUniformsNameLocationMap[uniformName] = location;
|
||||
|
||||
@@ -125,7 +125,7 @@ void ShaderSourceProvider::addFileSearchDirectory(String directory)
|
||||
bool ShaderSourceProvider::loadFile(const String& fullFileName, CharArray* fileContents)
|
||||
{
|
||||
#ifdef WIN32
|
||||
std::ifstream file(fullFileName.ptr());
|
||||
std::ifstream file(fullFileName.c_str());
|
||||
#else
|
||||
std::ifstream file(fullFileName.toUtf8().ptr());
|
||||
#endif
|
||||
|
||||
@@ -53,7 +53,7 @@ bool ShaderSourceRepositoryFile::rawShaderSource(ShaderIdent shaderIdent, CharAr
|
||||
String fullFileName = fileNameFromIdent(shaderIdent);
|
||||
|
||||
#ifdef WIN32
|
||||
std::ifstream file(fullFileName.ptr());
|
||||
std::ifstream file(fullFileName.c_str());
|
||||
#else
|
||||
std::ifstream file(fullFileName.toUtf8().ptr());
|
||||
#endif
|
||||
|
||||
@@ -1018,6 +1018,10 @@ static const char vs_Minimal_inl[] =
|
||||
" \n"
|
||||
"uniform mat4 cvfu_modelViewProjectionMatrix; \n"
|
||||
" \n"
|
||||
"#ifdef CVF_CALC_CLIP_DISTANCES_IMPL \n"
|
||||
"uniform mat4 cvfu_modelViewMatrix; \n"
|
||||
"#endif \n"
|
||||
" \n"
|
||||
"attribute vec4 cvfa_vertex; \n"
|
||||
" \n"
|
||||
"//-------------------------------------------------------------------------------------------------- \n"
|
||||
@@ -1027,6 +1031,11 @@ static const char vs_Minimal_inl[] =
|
||||
"{ \n"
|
||||
" gl_Position = cvfu_modelViewProjectionMatrix*cvfa_vertex; \n"
|
||||
" \n"
|
||||
"#ifdef CVF_CALC_CLIP_DISTANCES_IMPL \n"
|
||||
" vec3 ecPosition = (cvfu_modelViewMatrix * cvfa_vertex).xyz; \n"
|
||||
" calcClipDistances(vec4(ecPosition, 1)); \n"
|
||||
"#endif \n"
|
||||
" \n"
|
||||
"#ifdef CVF_OPENGL_ES \n"
|
||||
" gl_PointSize = 1.0; \n"
|
||||
"#endif \n"
|
||||
@@ -1039,6 +1048,10 @@ static const char vs_Minimal_inl[] =
|
||||
static const char vs_MinimalTexture_inl[] =
|
||||
"uniform mat4 cvfu_modelViewProjectionMatrix; \n"
|
||||
" \n"
|
||||
"#ifdef CVF_CALC_CLIP_DISTANCES_IMPL \n"
|
||||
"uniform mat4 cvfu_modelViewMatrix; \n"
|
||||
"#endif \n"
|
||||
" \n"
|
||||
"attribute vec2 cvfa_texCoord; \n"
|
||||
"attribute vec4 cvfa_vertex; \n"
|
||||
" \n"
|
||||
@@ -1052,6 +1065,11 @@ static const char vs_MinimalTexture_inl[] =
|
||||
" v_texCoord = cvfa_texCoord; \n"
|
||||
" gl_Position = cvfu_modelViewProjectionMatrix * cvfa_vertex; \n"
|
||||
" \n"
|
||||
"#ifdef CVF_CALC_CLIP_DISTANCES_IMPL \n"
|
||||
" vec3 ecPosition = (cvfu_modelViewMatrix * cvfa_vertex).xyz; \n"
|
||||
" calcClipDistances(vec4(ecPosition, 1)); \n"
|
||||
"#endif \n"
|
||||
" \n"
|
||||
"#ifdef CVF_OPENGL_ES \n"
|
||||
" gl_PointSize = 1.0; \n"
|
||||
"#endif \n"
|
||||
|
||||
@@ -363,6 +363,8 @@ void TextDrawer::doRender2d(OpenGLContext* oglContext, const MatrixState& matrix
|
||||
if (softwareRendering)
|
||||
{
|
||||
#ifndef CVF_OPENGL_ES
|
||||
glEnable(GL_COLOR_MATERIAL);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glColor4fv(m_backgroundColor.ptr());
|
||||
glBegin(GL_TRIANGLE_FAN);
|
||||
glVertex3fv(v1);
|
||||
|
||||
@@ -56,8 +56,11 @@ Viewport::Viewport()
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Specify the position and dimensions of the viewport
|
||||
///
|
||||
/// The window coordinates (x,y) are in OpenGL style coordinates, which means a right handed
|
||||
/// coordinate system with the origin in the lower left corner of the window.
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Viewport::set(uint x, uint y, uint width, uint height)
|
||||
void Viewport::set(int x, int y, uint width, uint height)
|
||||
{
|
||||
m_x = x;
|
||||
m_y = y;
|
||||
@@ -84,7 +87,7 @@ void Viewport::setClearColor(Color4f color)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Get the x coordinate of the lower left corner of the viewport
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
uint Viewport::x() const
|
||||
int Viewport::x() const
|
||||
{
|
||||
return m_x;
|
||||
}
|
||||
@@ -93,7 +96,7 @@ uint Viewport::x() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Get the y coordinate of the lower left corner of the viewport
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
uint Viewport::y() const
|
||||
int Viewport::y() const
|
||||
{
|
||||
return m_y;
|
||||
}
|
||||
@@ -245,7 +248,7 @@ void Viewport::applyOpenGL(OpenGLContext* oglContext, ClearMode clearMode)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
String Viewport::toString() const
|
||||
String Viewport::debugString() const
|
||||
{
|
||||
String str = "Viewport: ";
|
||||
|
||||
|
||||
@@ -52,10 +52,10 @@ public:
|
||||
public:
|
||||
Viewport();
|
||||
|
||||
void set(uint x, uint y, uint width, uint height);
|
||||
void set(int x, int y, uint width, uint height);
|
||||
|
||||
uint x() const;
|
||||
uint y() const;
|
||||
int x() const;
|
||||
int y() const;
|
||||
uint width() const;
|
||||
uint height() const;
|
||||
double aspectRatio() const;
|
||||
@@ -65,16 +65,16 @@ public:
|
||||
|
||||
void applyOpenGL(OpenGLContext* oglContext, ClearMode clearMode);
|
||||
|
||||
String toString() const;
|
||||
String debugString() const;
|
||||
|
||||
private:
|
||||
cvfGLbitfield clearFlagsOpenGL(ClearMode clearMode);
|
||||
|
||||
private:
|
||||
uint m_x;
|
||||
uint m_y;
|
||||
uint m_width;
|
||||
uint m_height;
|
||||
int m_x;
|
||||
int m_y;
|
||||
uint m_width;
|
||||
uint m_height;
|
||||
|
||||
Color4f m_clearColor;
|
||||
double m_clearDepth;
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
|
||||
uniform mat4 cvfu_modelViewProjectionMatrix;
|
||||
|
||||
#ifdef CVF_CALC_CLIP_DISTANCES_IMPL
|
||||
uniform mat4 cvfu_modelViewMatrix;
|
||||
#endif
|
||||
|
||||
attribute vec4 cvfa_vertex;
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -10,6 +14,11 @@ void main ()
|
||||
{
|
||||
gl_Position = cvfu_modelViewProjectionMatrix*cvfa_vertex;
|
||||
|
||||
#ifdef CVF_CALC_CLIP_DISTANCES_IMPL
|
||||
vec3 ecPosition = (cvfu_modelViewMatrix * cvfa_vertex).xyz;
|
||||
calcClipDistances(vec4(ecPosition, 1));
|
||||
#endif
|
||||
|
||||
#ifdef CVF_OPENGL_ES
|
||||
gl_PointSize = 1.0;
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
uniform mat4 cvfu_modelViewProjectionMatrix;
|
||||
|
||||
#ifdef CVF_CALC_CLIP_DISTANCES_IMPL
|
||||
uniform mat4 cvfu_modelViewMatrix;
|
||||
#endif
|
||||
|
||||
attribute vec2 cvfa_texCoord;
|
||||
attribute vec4 cvfa_vertex;
|
||||
|
||||
@@ -13,6 +17,11 @@ void main ()
|
||||
v_texCoord = cvfa_texCoord;
|
||||
gl_Position = cvfu_modelViewProjectionMatrix * cvfa_vertex;
|
||||
|
||||
#ifdef CVF_CALC_CLIP_DISTANCES_IMPL
|
||||
vec3 ecPosition = (cvfu_modelViewMatrix * cvfa_vertex).xyz;
|
||||
calcClipDistances(vec4(ecPosition, 1));
|
||||
#endif
|
||||
|
||||
#ifdef CVF_OPENGL_ES
|
||||
gl_PointSize = 1.0;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user