Remove ARB programs support completely
parent
b9d532a902
commit
6653929310
|
@ -221,7 +221,6 @@ ENGINE_SOURCES = \
|
|||
src/celengine/trajmanager.cpp \
|
||||
src/celengine/univcoord.cpp \
|
||||
src/celengine/universe.cpp \
|
||||
src/celengine/vertexprog.cpp \
|
||||
src/celengine/virtualtex.cpp \
|
||||
src/celengine/visibleregion.cpp
|
||||
|
||||
|
@ -297,7 +296,6 @@ ENGINE_HEADERS = \
|
|||
src/celengine/univcoord.h \
|
||||
src/celengine/universe.h \
|
||||
src/celengine/vecgl.h \
|
||||
src/celengine/vertexprog.h \
|
||||
src/celengine/virtualtex.h \
|
||||
src/celengine/visibleregion.h
|
||||
|
||||
|
|
|
@ -15,9 +15,6 @@
|
|||
using namespace std;
|
||||
|
||||
|
||||
static VertexProcessor* vpARB = nullptr;
|
||||
|
||||
|
||||
void GLContext::init(const vector<string>& ignoreExt)
|
||||
{
|
||||
auto* extensionsString = (char*) glGetString(GL_EXTENSIONS);
|
||||
|
@ -47,15 +44,6 @@ void GLContext::init(const vector<string>& ignoreExt)
|
|||
glGetIntegerv(GL_MAX_TEXTURE_UNITS,
|
||||
(GLint*) &maxSimultaneousTextures);
|
||||
|
||||
#ifdef VPROC
|
||||
if (GLEW_ARB_vertex_program && glGenProgramsARB)
|
||||
{
|
||||
DPRINTF(1, "Renderer: ARB vertex programs supported.\n");
|
||||
if (vpARB == nullptr)
|
||||
vpARB = vp::initARB();
|
||||
vertexProc = vpARB;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -64,17 +52,6 @@ bool GLContext::setRenderPath(GLRenderPath path)
|
|||
if (!renderPathSupported(path))
|
||||
return false;
|
||||
|
||||
#ifdef VPROC
|
||||
switch (path)
|
||||
{
|
||||
case GLPath_GLSL:
|
||||
vertexPath = VPath_ARB;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
renderPath = path;
|
||||
|
||||
return true;
|
||||
|
@ -123,17 +100,3 @@ bool GLContext::bumpMappingSupported() const
|
|||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
#ifdef VPROC
|
||||
GLContext::VertexPath GLContext::getVertexPath() const
|
||||
{
|
||||
return vertexPath;
|
||||
}
|
||||
|
||||
|
||||
VertexProcessor* GLContext::getVertexProcessor() const
|
||||
{
|
||||
return vertexProc;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#ifndef _CELENGINE_GLCONTEXT_H_
|
||||
#define _CELENGINE_GLCONTEXT_H_
|
||||
|
||||
#include <celengine/vertexprog.h>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
|
@ -25,13 +24,6 @@ class GLContext
|
|||
GLPath_GLSL = 8,
|
||||
};
|
||||
|
||||
#ifdef VPROC
|
||||
enum VertexPath
|
||||
{
|
||||
VPath_ARB = 2,
|
||||
};
|
||||
#endif
|
||||
|
||||
void init(const std::vector<std::string>& ignoreExt);
|
||||
|
||||
GLRenderPath getRenderPath() const { return renderPath; };
|
||||
|
@ -45,18 +37,8 @@ class GLContext
|
|||
bool hasMultitexture() const { return true; };
|
||||
bool bumpMappingSupported() const;
|
||||
|
||||
#ifdef VPROC
|
||||
VertexPath getVertexPath() const;
|
||||
|
||||
VertexProcessor* getVertexProcessor() const;
|
||||
#endif
|
||||
|
||||
private:
|
||||
GLRenderPath renderPath{ GLPath_GLSL };
|
||||
#ifdef VPROC
|
||||
VertexPath vertexPath{ VPath_ARB };
|
||||
VertexProcessor* vertexProc{ nullptr };
|
||||
#endif
|
||||
|
||||
int maxSimultaneousTextures { 1 };
|
||||
std::vector<std::string> extensions;
|
||||
|
|
|
@ -235,13 +235,6 @@ void LODSphereMesh::render(const GLContext& context,
|
|||
nTextures = 0;
|
||||
|
||||
|
||||
// Need to have vertex programs enabled in order to make
|
||||
// use of surface tangents.
|
||||
#ifdef VPROC
|
||||
if (!context.getVertexProcessor())
|
||||
attributes &= ~Tangents;
|
||||
#endif
|
||||
|
||||
RenderInfo ri(step, attributes, frustum, context);
|
||||
|
||||
// If one of the textures is split into subtextures, we may have to
|
||||
|
@ -366,14 +359,6 @@ void LODSphereMesh::render(const GLContext& context,
|
|||
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
|
||||
#ifdef VPROC
|
||||
if ((attributes & Tangents) != 0)
|
||||
{
|
||||
VertexProcessor* vproc = context.getVertexProcessor();
|
||||
vproc->enableAttribArray(6);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (split == 1)
|
||||
{
|
||||
renderSection(0, 0, thetaExtent, ri);
|
||||
|
@ -465,14 +450,6 @@ void LODSphereMesh::render(const GLContext& context,
|
|||
if ((attributes & Normals) != 0)
|
||||
glDisableClientState(GL_NORMAL_ARRAY);
|
||||
|
||||
#ifdef VPROC
|
||||
if ((attributes & Tangents) != 0)
|
||||
{
|
||||
VertexProcessor* vproc = context.getVertexProcessor();
|
||||
vproc->disableAttribArray(6);
|
||||
}
|
||||
#endif
|
||||
|
||||
for (i = 0; i < nTextures; i++)
|
||||
{
|
||||
tex[i]->endUsage();
|
||||
|
@ -737,7 +714,6 @@ void LODSphereMesh::renderSection(int phi0, int theta0, int extent,
|
|||
#endif // SHOW_PATCH_VISIBILITY
|
||||
|
||||
auto stride = (GLsizei) (vertexSize * sizeof(float));
|
||||
int tangentOffset = 3;
|
||||
int texCoordOffset = ((ri.attributes & Tangents) != 0) ? 6 : 3;
|
||||
float* vertexBase = useVertexBuffers ? (float*) nullptr : vertices;
|
||||
|
||||
|
@ -752,14 +728,6 @@ void LODSphereMesh::renderSection(int phi0, int theta0, int extent,
|
|||
glTexCoordPointer(2, GL_FLOAT, stride, vertexBase + (tc * 2) + texCoordOffset);
|
||||
}
|
||||
|
||||
#ifdef VPROC
|
||||
if ((ri.attributes & Tangents) != 0)
|
||||
{
|
||||
VertexProcessor* vproc = ri.context.getVertexProcessor();
|
||||
vproc->attribArray(6, 3, GL_FLOAT, stride, vertexBase + tangentOffset);
|
||||
}
|
||||
#endif
|
||||
|
||||
// assert(ri.step >= minStep);
|
||||
// assert(phi0 + extent <= maxDivisions);
|
||||
// assert(theta0 + extent / 2 < maxDivisions);
|
||||
|
|
|
@ -52,7 +52,6 @@ std::ofstream hdrlog;
|
|||
#include "spheremesh.h"
|
||||
#include "lodspheremesh.h"
|
||||
#include "geometry.h"
|
||||
#include "vertexprog.h"
|
||||
#include "texmanager.h"
|
||||
#include "meshmanager.h"
|
||||
#include "renderinfo.h"
|
||||
|
@ -275,8 +274,8 @@ class PointStarVertexBuffer
|
|||
public:
|
||||
PointStarVertexBuffer(unsigned int _capacity);
|
||||
~PointStarVertexBuffer();
|
||||
void startPoints(const GLContext&);
|
||||
void startSprites(const GLContext&);
|
||||
void startPoints();
|
||||
void startSprites();
|
||||
void render();
|
||||
void finish();
|
||||
inline void addStar(const Eigen::Vector3f& pos, const Color&, float);
|
||||
|
@ -294,9 +293,6 @@ private:
|
|||
unsigned int capacity;
|
||||
unsigned int nStars{ 0 };
|
||||
StarVertex* vertices{ nullptr };
|
||||
#ifdef VPROC
|
||||
const GLContext* context{ nullptr };
|
||||
#endif
|
||||
bool useSprites{ false };
|
||||
Texture* texture{ nullptr };
|
||||
};
|
||||
|
@ -312,12 +308,8 @@ PointStarVertexBuffer::~PointStarVertexBuffer()
|
|||
delete[] vertices;
|
||||
}
|
||||
|
||||
void PointStarVertexBuffer::startSprites(const GLContext& _context)
|
||||
void PointStarVertexBuffer::startSprites()
|
||||
{
|
||||
#ifdef VPROC
|
||||
context = &_context;
|
||||
assert(context->getVertexProcessor() != nullptr || !useSprites); // vertex shaders required for new star rendering
|
||||
#else
|
||||
ShaderProperties shadprop;
|
||||
shadprop.staticShader = true;
|
||||
shadprop.texUsage = ShaderProperties::PointSprite |
|
||||
|
@ -325,7 +317,6 @@ void PointStarVertexBuffer::startSprites(const GLContext& _context)
|
|||
CelestiaGLProgram* prog = GetShaderManager().getShader(shadprop);
|
||||
if (prog == nullptr)
|
||||
return;
|
||||
#endif
|
||||
|
||||
prog->use();
|
||||
prog->pointScale = 1.0f;
|
||||
|
@ -336,36 +327,21 @@ void PointStarVertexBuffer::startSprites(const GLContext& _context)
|
|||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
glColorPointer(4, GL_UNSIGNED_BYTE, stride, &vertices[0].color);
|
||||
|
||||
#ifdef VPROC
|
||||
VertexProcessor* vproc = context->getVertexProcessor();
|
||||
vproc->enable();
|
||||
vproc->use(vp::starDisc);
|
||||
vproc->enableAttribArray(6);
|
||||
vproc->attribArray(6, 1, GL_FLOAT, stride, &vertices[0].size);
|
||||
#else
|
||||
glEnableVertexAttribArray(CelestiaGLProgram::PointSizeAttributeIndex);
|
||||
glVertexAttribPointer(CelestiaGLProgram::PointSizeAttributeIndex,
|
||||
1, GL_FLOAT, GL_FALSE,
|
||||
stride, &vertices[0].size);
|
||||
#endif
|
||||
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glDisableClientState(GL_NORMAL_ARRAY);
|
||||
|
||||
glEnable(GL_POINT_SPRITE);
|
||||
#ifdef VPROC
|
||||
glTexEnvi(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_TRUE);
|
||||
#endif
|
||||
|
||||
useSprites = true;
|
||||
}
|
||||
|
||||
void PointStarVertexBuffer::startPoints(const GLContext& _context)
|
||||
void PointStarVertexBuffer::startPoints()
|
||||
{
|
||||
#ifdef VPROC
|
||||
context = &_context;
|
||||
#endif
|
||||
|
||||
unsigned int stride = sizeof(StarVertex);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glVertexPointer(3, GL_FLOAT, stride, &vertices[0].position);
|
||||
|
@ -406,14 +382,9 @@ void PointStarVertexBuffer::render()
|
|||
|
||||
if (useSprites)
|
||||
{
|
||||
#ifdef VPROC
|
||||
VertexProcessor* vproc = context->getVertexProcessor();
|
||||
vproc->attribArray(6, 1, GL_FLOAT, stride, &vertices[0].size);
|
||||
#else
|
||||
glVertexAttribPointer(CelestiaGLProgram::PointSizeAttributeIndex,
|
||||
1, GL_FLOAT, GL_FALSE,
|
||||
stride, &vertices[0].size);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (texture != nullptr)
|
||||
|
@ -432,14 +403,8 @@ void PointStarVertexBuffer::finish()
|
|||
|
||||
if (useSprites)
|
||||
{
|
||||
#ifdef VPROC
|
||||
VertexProcessor* vproc = context->getVertexProcessor();
|
||||
vproc->disableAttribArray(6);
|
||||
vproc->disable();
|
||||
#else
|
||||
glDisableVertexAttribArray(CelestiaGLProgram::PointSizeAttributeIndex);
|
||||
glUseProgram(0);
|
||||
#endif
|
||||
glDisable(GL_POINT_SPRITE);
|
||||
}
|
||||
else
|
||||
|
@ -489,15 +454,12 @@ Renderer::Renderer() :
|
|||
renderFlags(ShowStars | ShowPlanets),
|
||||
orbitMask(Body::Planet | Body::Moon | Body::Stellar),
|
||||
ambientLightLevel(0.1f),
|
||||
fragmentShaderEnabled(false),
|
||||
vertexShaderEnabled(false),
|
||||
brightnessBias(0.0f),
|
||||
saturationMagNight(1.0f),
|
||||
saturationMag(1.0f),
|
||||
starStyle(FuzzyPointStars),
|
||||
pointStarVertexBuffer(nullptr),
|
||||
glareVertexBuffer(nullptr),
|
||||
useVertexPrograms(false),
|
||||
textureResolution(medres),
|
||||
frameCount(0),
|
||||
lastOrbitCacheFlush(0),
|
||||
|
@ -1311,39 +1273,6 @@ void Renderer::setDistanceLimit(float distanceLimit_)
|
|||
}
|
||||
|
||||
|
||||
bool Renderer::getFragmentShaderEnabled() const
|
||||
{
|
||||
return fragmentShaderEnabled;
|
||||
}
|
||||
|
||||
void Renderer::setFragmentShaderEnabled(bool enable)
|
||||
{
|
||||
fragmentShaderEnabled = enable && fragmentShaderSupported();
|
||||
markSettingsChanged();
|
||||
}
|
||||
|
||||
bool Renderer::fragmentShaderSupported() const
|
||||
{
|
||||
return context->bumpMappingSupported();
|
||||
}
|
||||
|
||||
bool Renderer::getVertexShaderEnabled() const
|
||||
{
|
||||
return vertexShaderEnabled;
|
||||
}
|
||||
|
||||
void Renderer::setVertexShaderEnabled(bool enable)
|
||||
{
|
||||
vertexShaderEnabled = enable && vertexShaderSupported();
|
||||
markSettingsChanged();
|
||||
}
|
||||
|
||||
bool Renderer::vertexShaderSupported() const
|
||||
{
|
||||
return useVertexPrograms;
|
||||
}
|
||||
|
||||
|
||||
void Renderer::addAnnotation(vector<Annotation>& annotations,
|
||||
const MarkerRepresentation* markerRep,
|
||||
const string& labelText,
|
||||
|
@ -7244,11 +7173,11 @@ void Renderer::renderPointStars(const StarDatabase& starDB,
|
|||
starRenderer.starVertexBuffer->setTexture(gaussianDiscTex);
|
||||
starRenderer.glareVertexBuffer->setTexture(gaussianGlareTex);
|
||||
|
||||
starRenderer.glareVertexBuffer->startSprites(*context);
|
||||
starRenderer.glareVertexBuffer->startSprites();
|
||||
if (starStyle == PointStars)
|
||||
starRenderer.starVertexBuffer->startPoints(*context);
|
||||
starRenderer.starVertexBuffer->startPoints();
|
||||
else
|
||||
starRenderer.starVertexBuffer->startSprites(*context);
|
||||
starRenderer.starVertexBuffer->startSprites();
|
||||
|
||||
starDB.findVisibleStars(starRenderer,
|
||||
obsPos.cast<float>(),
|
||||
|
|
|
@ -217,13 +217,6 @@ class Renderer
|
|||
bool getVideoSync() const;
|
||||
void setVideoSync(bool);
|
||||
|
||||
bool getFragmentShaderEnabled() const;
|
||||
void setFragmentShaderEnabled(bool);
|
||||
bool fragmentShaderSupported() const;
|
||||
bool getVertexShaderEnabled() const;
|
||||
void setVertexShaderEnabled(bool);
|
||||
bool vertexShaderSupported() const;
|
||||
|
||||
#ifdef USE_HDR
|
||||
bool getBloomEnabled();
|
||||
void setBloomEnabled(bool);
|
||||
|
@ -624,8 +617,6 @@ class Renderer
|
|||
int renderFlags;
|
||||
int orbitMask;
|
||||
float ambientLightLevel;
|
||||
bool fragmentShaderEnabled;
|
||||
bool vertexShaderEnabled;
|
||||
float brightnessBias;
|
||||
|
||||
float brightnessScale;
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include "spheremesh.h"
|
||||
#include "lodspheremesh.h"
|
||||
#include "geometry.h"
|
||||
#include "vertexprog.h"
|
||||
#include "texmanager.h"
|
||||
#include "meshmanager.h"
|
||||
#include "renderinfo.h"
|
||||
|
|
Loading…
Reference in New Issue