Switched from using custom GL extension handling code to GLEW library.
parent
78803c21e2
commit
9d373fd041
|
@ -37,7 +37,7 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=".\src;.\windows\inc;.\windows\inc\libintl;.\windows\inc\libpng;.\windows\inc\libz;.\windows\inc\spice;".\windows\inc\lua-5.1";.\windows\inc\libjpeg;.\thirdparty\Eigen;.\thirdparty\curveplot\include"
|
||||
AdditionalIncludeDirectories=".\src;.\windows\inc;.\windows\inc\libintl;.\windows\inc\libpng;.\windows\inc\libz;.\windows\inc\spice;".\windows\inc\lua-5.1";.\windows\inc\libjpeg;.\thirdparty\Eigen;.\thirdparty\glew\include;.\thirdparty\curveplot\include"
|
||||
PreprocessorDefinitions="CELX;LUA_VER=0x050100;USE_SPICE;WINVER=0x0400;_WIN32_WINNT=0x0400;_CRT_SECURE_NO_DEPRECATE;NOMINMAX"
|
||||
RuntimeLibrary="3"
|
||||
DebugInformationFormat="3"
|
||||
|
@ -735,6 +735,14 @@
|
|||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="glew"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\thirdparty\glew\src\glew.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="curveplot"
|
||||
>
|
||||
|
|
|
@ -99,8 +99,8 @@ static bool LoadNvFragmentProgram(const string& filename, unsigned int& id)
|
|||
return false;
|
||||
}
|
||||
|
||||
glx::glGenProgramsNV(1, (GLuint*) &id);
|
||||
glx::glLoadProgramNV(GL_FRAGMENT_PROGRAM_NV,
|
||||
glGenProgramsNV(1, (GLuint*) &id);
|
||||
glLoadProgramNV(GL_FRAGMENT_PROGRAM_NV,
|
||||
id,
|
||||
source->length(),
|
||||
reinterpret_cast<const GLubyte*>(source->c_str()));
|
||||
|
@ -200,19 +200,19 @@ void FragmentProcessorNV::disable()
|
|||
|
||||
void FragmentProcessorNV::use(unsigned int prog)
|
||||
{
|
||||
glx::glBindProgramNV(GL_FRAGMENT_PROGRAM_NV, prog);
|
||||
glBindProgramNV(GL_FRAGMENT_PROGRAM_NV, prog);
|
||||
}
|
||||
|
||||
void FragmentProcessorNV::parameter(fp::Parameter param,
|
||||
float x, float y, float z, float w)
|
||||
{
|
||||
glx::glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_NV,
|
||||
glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_NV,
|
||||
param, x, y, z, w);
|
||||
}
|
||||
|
||||
void FragmentProcessorNV::parameter(fp::Parameter param, const float* fv)
|
||||
{
|
||||
glx::glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_NV, param, fv);
|
||||
glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_NV, param, fv);
|
||||
}
|
||||
|
||||
|
||||
|
@ -238,17 +238,17 @@ void FragmentProcessorARB::disable()
|
|||
|
||||
void FragmentProcessorARB::use(unsigned int /*prog*/)
|
||||
{
|
||||
//glx::glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prog);
|
||||
//glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prog);
|
||||
}
|
||||
|
||||
void FragmentProcessorARB::parameter(fp::Parameter /*param*/,
|
||||
float /*x*/, float /*y*/,
|
||||
float /*z*/, float /*w*/)
|
||||
{
|
||||
//glx::glProgramEnvParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, param, x, y, z, w);
|
||||
//glProgramEnvParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, param, x, y, z, w);
|
||||
}
|
||||
|
||||
void FragmentProcessorARB::parameter(fp::Parameter /*param*/, const float* /*fv*/)
|
||||
{
|
||||
//glx::glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, param, fv);
|
||||
//glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, param, fv);
|
||||
}
|
||||
|
|
|
@ -12,9 +12,12 @@
|
|||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
|
||||
#ifndef _GL_H_
|
||||
#define _GL_H_
|
||||
#ifndef _CELENGINE_GL_H_
|
||||
#define _CELENGINE_GL_H_
|
||||
|
||||
#include <GL/glew.h>
|
||||
|
||||
#if 0
|
||||
#ifdef _WIN32
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
@ -40,6 +43,7 @@
|
|||
#include <OpenGL/gl.h>
|
||||
#include <OpenGL/glu.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // _GL_H_
|
||||
#endif // _CELENGINE_GL_H_
|
||||
|
||||
|
|
|
@ -77,23 +77,20 @@ void GLContext::init(const vector<string>& ignoreExt)
|
|||
InitExtension(iter->c_str());
|
||||
}
|
||||
|
||||
if (extensionSupported("GL_ARB_multitexture") &&
|
||||
glx::glActiveTextureARB != NULL)
|
||||
if (GLEW_ARB_multitexture && glActiveTextureARB != NULL)
|
||||
{
|
||||
glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB,
|
||||
(GLint*) &maxSimultaneousTextures);
|
||||
}
|
||||
|
||||
if (extensionSupported("GL_ARB_vertex_program") &&
|
||||
glx::glGenProgramsARB)
|
||||
if (GLEW_ARB_vertex_program && glGenProgramsARB)
|
||||
{
|
||||
DPRINTF(1, "Renderer: ARB vertex programs supported.\n");
|
||||
if (vpARB == NULL)
|
||||
vpARB = vp::initARB();
|
||||
vertexProc = vpARB;
|
||||
}
|
||||
else if (extensionSupported("GL_NV_vertex_program") &&
|
||||
glx::glGenProgramsNV)
|
||||
else if (GLEW_NV_vertex_program && glGenProgramsNV)
|
||||
{
|
||||
DPRINTF(1, "Renderer: nVidia vertex programs supported.\n");
|
||||
if (vpNV == NULL)
|
||||
|
@ -101,8 +98,7 @@ void GLContext::init(const vector<string>& ignoreExt)
|
|||
vertexProc = vpNV;
|
||||
}
|
||||
|
||||
if (extensionSupported("GL_NV_fragment_program") &&
|
||||
glx::glGenProgramsNV)
|
||||
if (GLEW_NV_fragment_program && glGenProgramsNV)
|
||||
{
|
||||
DPRINTF(1, "Renderer: nVidia fragment programs supported.\n");
|
||||
if (fpNV == NULL)
|
||||
|
@ -156,8 +152,7 @@ bool GLContext::renderPathSupported(GLRenderPath path) const
|
|||
|
||||
case GLPath_Multitexture:
|
||||
return (maxSimultaneousTextures > 1 &&
|
||||
( extensionSupported("GL_EXT_texture_env_combine") ||
|
||||
extensionSupported("GL_ARB_texture_env_combine")) );
|
||||
(GLEW_EXT_texture_env_combine || GLEW_ARB_texture_env_combine));
|
||||
|
||||
case GLPath_NvCombiner:
|
||||
return false;
|
||||
|
@ -165,48 +160,40 @@ bool GLContext::renderPathSupported(GLRenderPath path) const
|
|||
// No longer supported; all recent NVIDIA drivers also support
|
||||
// the vertex_program extension, so the combiners-only path
|
||||
// isn't necessary.
|
||||
return extensionSupported("GL_NV_register_combiners");
|
||||
return GLEW_NV_register_combiners;
|
||||
*/
|
||||
|
||||
case GLPath_DOT3_ARBVP:
|
||||
return (extensionSupported("GL_ARB_texture_env_dot3") &&
|
||||
extensionSupported("GL_ARB_vertex_program") &&
|
||||
vertexProc != NULL);
|
||||
return GLEW_ARB_texture_env_dot3 &&
|
||||
GLEW_ARB_vertex_program &&
|
||||
vertexProc != NULL;
|
||||
|
||||
case GLPath_NvCombiner_NvVP:
|
||||
// If ARB_vertex_program is supported, don't report support for
|
||||
// this render path.
|
||||
return (extensionSupported("GL_NV_register_combiners") &&
|
||||
extensionSupported("GL_NV_vertex_program") &&
|
||||
!extensionSupported("GL_ARB_vertex_program") &&
|
||||
vertexProc != NULL);
|
||||
return GLEW_NV_register_combiners &&
|
||||
GLEW_NV_vertex_program &&
|
||||
!GLEW_ARB_vertex_program &&
|
||||
vertexProc != NULL;
|
||||
|
||||
case GLPath_NvCombiner_ARBVP:
|
||||
return (extensionSupported("GL_NV_register_combiners") &&
|
||||
extensionSupported("GL_ARB_vertex_program") &&
|
||||
vertexProc != NULL);
|
||||
return GLEW_NV_register_combiners &&
|
||||
GLEW_ARB_vertex_program &&
|
||||
vertexProc != NULL;
|
||||
|
||||
case GLPath_ARBFP_ARBVP:
|
||||
return false;
|
||||
/*
|
||||
return (extensionSupported("GL_ARB_vertex_program") &&
|
||||
extensionSupported("GL_ARB_fragment_program") &&
|
||||
vertexProc != NULL);
|
||||
return GLEW_ARB_vertex_program &&
|
||||
GLEW_ARB_fragment_program &&
|
||||
vertexProc != NULL;
|
||||
*/
|
||||
|
||||
case GLPath_NV30:
|
||||
/* This render path is deprecated; GLSL is now preferred */
|
||||
return false;
|
||||
/*
|
||||
return (extensionSupported("GL_ARB_vertex_program") &&
|
||||
extensionSupported("GL_NV_fragment_program"));
|
||||
*/
|
||||
|
||||
case GLPath_GLSL:
|
||||
return (extensionSupported("GL_ARB_shader_objects") &&
|
||||
extensionSupported("GL_ARB_shading_language_100") &&
|
||||
extensionSupported("GL_ARB_vertex_shader") &&
|
||||
extensionSupported("GL_ARB_fragment_shader"));
|
||||
return GLEW_ARB_shader_objects &&
|
||||
GLEW_ARB_shading_language_100 &&
|
||||
GLEW_ARB_vertex_shader &&
|
||||
GLEW_ARB_fragment_shader;
|
||||
|
||||
default:
|
||||
return false;
|
||||
|
|
|
@ -10,7 +10,9 @@
|
|||
#include <string.h>
|
||||
#include "gl.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
// Assume that this is a UNIX/X11 system if it's not Windows or Mac OS X.
|
||||
#ifndef TARGET_OS_MAC
|
||||
#include "GL/glx.h"
|
||||
|
@ -892,6 +894,8 @@ static void InitExt_EXT_framebuffer_object()
|
|||
|
||||
void InitExtension(const char* ext)
|
||||
{
|
||||
return;
|
||||
#if 0
|
||||
if (!strcmp(ext, "GL_NV_fragment_program"))
|
||||
InitExt_NV_fragment_program();
|
||||
else if (!strcmp(ext, "GL_ARB_vertex_program"))
|
||||
|
@ -924,6 +928,7 @@ void InitExtension(const char* ext)
|
|||
InitExt_ARB_color_buffer_float();
|
||||
else if (!strcmp(ext, "GL_EXT_framebuffer_object"))
|
||||
InitExt_EXT_framebuffer_object();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -46,14 +46,14 @@ GLShader::compile(const vector<string>& source)
|
|||
sourceStrings[i] = source[i].c_str();
|
||||
|
||||
// Copy shader source to OpenGL
|
||||
glx::glShaderSourceARB(id, source.size(), sourceStrings, NULL);
|
||||
glShaderSourceARB(id, source.size(), sourceStrings, NULL);
|
||||
delete[] sourceStrings;
|
||||
|
||||
// Actually compile the shader
|
||||
glx::glCompileShaderARB(id);
|
||||
glCompileShaderARB(id);
|
||||
|
||||
GLint compileSuccess;
|
||||
glx::glGetObjectParameterivARB(id, GL_OBJECT_COMPILE_STATUS_ARB,
|
||||
glGetObjectParameterivARB(id, GL_OBJECT_COMPILE_STATUS_ARB,
|
||||
&compileSuccess);
|
||||
if (compileSuccess == GL_FALSE)
|
||||
return ShaderStatus_CompileError;
|
||||
|
@ -64,7 +64,7 @@ GLShader::compile(const vector<string>& source)
|
|||
|
||||
GLShader::~GLShader()
|
||||
{
|
||||
glx::glDeleteObjectARB(id);
|
||||
glDeleteObjectARB(id);
|
||||
}
|
||||
|
||||
|
||||
|
@ -78,14 +78,14 @@ FloatShaderParameter::FloatShaderParameter() :
|
|||
|
||||
FloatShaderParameter::FloatShaderParameter(GLhandleARB obj, const char* name)
|
||||
{
|
||||
slot = glx::glGetUniformLocationARB(obj, name);
|
||||
slot = glGetUniformLocationARB(obj, name);
|
||||
}
|
||||
|
||||
FloatShaderParameter&
|
||||
FloatShaderParameter::operator=(float f)
|
||||
{
|
||||
if (slot != -1)
|
||||
glx::glUniform1fARB(slot, f);
|
||||
glUniform1fARB(slot, f);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -97,14 +97,14 @@ Vec3ShaderParameter::Vec3ShaderParameter() :
|
|||
|
||||
Vec3ShaderParameter::Vec3ShaderParameter(GLhandleARB obj, const char* name)
|
||||
{
|
||||
slot = glx::glGetUniformLocationARB(obj, name);
|
||||
slot = glGetUniformLocationARB(obj, name);
|
||||
}
|
||||
|
||||
Vec3ShaderParameter&
|
||||
Vec3ShaderParameter::operator=(const Eigen::Vector3f& v)
|
||||
{
|
||||
if (slot != -1)
|
||||
glx::glUniform3fvARB(slot, 1, v.data());
|
||||
glUniform3fvARB(slot, 1, v.data());
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -115,14 +115,14 @@ Vec4ShaderParameter::Vec4ShaderParameter() :
|
|||
|
||||
Vec4ShaderParameter::Vec4ShaderParameter(GLhandleARB obj, const char* name)
|
||||
{
|
||||
slot = glx::glGetUniformLocationARB(obj, name);
|
||||
slot = glGetUniformLocationARB(obj, name);
|
||||
}
|
||||
|
||||
Vec4ShaderParameter&
|
||||
Vec4ShaderParameter::operator=(const Eigen::Vector4f& v)
|
||||
{
|
||||
if (slot != -1)
|
||||
glx::glUniform4fvARB(slot, 1, v.data());
|
||||
glUniform4fvARB(slot, 1, v.data());
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -137,31 +137,31 @@ GLProgram::GLProgram(GLhandleARB _id) :
|
|||
|
||||
GLProgram::~GLProgram()
|
||||
{
|
||||
glx::glDeleteObjectARB(id);
|
||||
glDeleteObjectARB(id);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
GLProgram::use() const
|
||||
{
|
||||
glx::glUseProgramObjectARB(id);
|
||||
glUseProgramObjectARB(id);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
GLProgram::attach(const GLShader& shader)
|
||||
{
|
||||
glx::glAttachObjectARB(id, shader.getID());
|
||||
glAttachObjectARB(id, shader.getID());
|
||||
}
|
||||
|
||||
|
||||
GLShaderStatus
|
||||
GLProgram::link()
|
||||
{
|
||||
glx::glLinkProgramARB(id);
|
||||
glLinkProgramARB(id);
|
||||
|
||||
GLint linkSuccess;
|
||||
glx::glGetObjectParameterivARB(id, GL_OBJECT_LINK_STATUS_ARB,
|
||||
glGetObjectParameterivARB(id, GL_OBJECT_LINK_STATUS_ARB,
|
||||
&linkSuccess);
|
||||
if (linkSuccess == GL_FALSE)
|
||||
{
|
||||
|
@ -183,7 +183,7 @@ GLShaderStatus
|
|||
GLShaderLoader::CreateVertexShader(const vector<string>& source,
|
||||
GLVertexShader** vs)
|
||||
{
|
||||
GLhandleARB vsid = glx::glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB);
|
||||
GLhandleARB vsid = glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB);
|
||||
|
||||
GLVertexShader* shader = new GLVertexShader(vsid);
|
||||
if (!shader)
|
||||
|
@ -210,7 +210,7 @@ GLShaderStatus
|
|||
GLShaderLoader::CreateFragmentShader(const vector<string>& source,
|
||||
GLFragmentShader** fs)
|
||||
{
|
||||
GLhandleARB fsid = glx::glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB);
|
||||
GLhandleARB fsid = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB);
|
||||
|
||||
GLFragmentShader* shader = new GLFragmentShader(fsid);
|
||||
if (!shader)
|
||||
|
@ -259,7 +259,7 @@ GLShaderLoader::CreateProgram(const GLVertexShader& vs,
|
|||
const GLFragmentShader& fs,
|
||||
GLProgram** progOut)
|
||||
{
|
||||
GLhandleARB progid = glx::glCreateProgramObjectARB();
|
||||
GLhandleARB progid = glCreateProgramObjectARB();
|
||||
|
||||
GLProgram* prog = new GLProgram(progid);
|
||||
if (!prog)
|
||||
|
@ -331,7 +331,7 @@ GetInfoLog(GLhandleARB obj)
|
|||
GLint logLength = 0;
|
||||
GLsizei charsWritten = 0;
|
||||
|
||||
glx::glGetObjectParameterivARB(obj, GL_OBJECT_INFO_LOG_LENGTH_ARB,
|
||||
glGetObjectParameterivARB(obj, GL_OBJECT_INFO_LOG_LENGTH_ARB,
|
||||
&logLength);
|
||||
if (logLength <= 0)
|
||||
return string();
|
||||
|
@ -340,7 +340,7 @@ GetInfoLog(GLhandleARB obj)
|
|||
if (log == NULL)
|
||||
return string();
|
||||
|
||||
glx::glGetInfoLogARB(obj, logLength, &charsWritten, log);
|
||||
glGetInfoLogARB(obj, logLength, &charsWritten, log);
|
||||
|
||||
string s(log, charsWritten);
|
||||
delete[] log;
|
||||
|
|
|
@ -248,7 +248,7 @@ void LODSphereMesh::render(const GLContext& context,
|
|||
textures[i] = tex[i];
|
||||
subtextures[i] = 0;
|
||||
if (nTextures > 1)
|
||||
glx::glActiveTextureARB(GL_TEXTURE0_ARB + i);
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB + i);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
|
@ -260,22 +260,22 @@ void LODSphereMesh::render(const GLContext& context,
|
|||
// would only cause problems if we rendered in two different contexts
|
||||
// and only one had vertex buffer objects.
|
||||
vertexBuffersInitialized = true;
|
||||
if (context.extensionSupported("GL_ARB_vertex_buffer_object"))
|
||||
if (GLEW_ARB_vertex_buffer_object)
|
||||
{
|
||||
for (int i = 0; i < NUM_SPHERE_VERTEX_BUFFERS; i++)
|
||||
{
|
||||
GLuint vbname = 0;
|
||||
glx::glGenBuffersARB(1, &vbname);
|
||||
glGenBuffersARB(1, &vbname);
|
||||
vertexBuffers[i] = (unsigned int) vbname;
|
||||
glx::glBindBufferARB(GL_ARRAY_BUFFER_ARB, vertexBuffers[i]);
|
||||
glx::glBufferDataARB(GL_ARRAY_BUFFER_ARB,
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, vertexBuffers[i]);
|
||||
glBufferDataARB(GL_ARRAY_BUFFER_ARB,
|
||||
maxVertices * MaxVertexSize * sizeof(float),
|
||||
NULL,
|
||||
GL_STREAM_DRAW_ARB);
|
||||
}
|
||||
glx::glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
|
||||
|
||||
glx::glGenBuffersARB(1, &indexBuffer);
|
||||
glGenBuffersARB(1, &indexBuffer);
|
||||
|
||||
useVertexBuffers = true;
|
||||
|
||||
|
@ -289,7 +289,7 @@ void LODSphereMesh::render(const GLContext& context,
|
|||
if (useVertexBuffers)
|
||||
{
|
||||
currentVB = 0;
|
||||
glx::glBindBufferARB(GL_ARRAY_BUFFER_ARB, vertexBuffers[currentVB]);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, vertexBuffers[currentVB]);
|
||||
}
|
||||
|
||||
// Set up the mesh vertices
|
||||
|
@ -309,8 +309,8 @@ void LODSphereMesh::render(const GLContext& context,
|
|||
|
||||
if (useVertexBuffers)
|
||||
{
|
||||
glx::glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, indexBuffer);
|
||||
glx::glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB,
|
||||
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, indexBuffer);
|
||||
glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB,
|
||||
nIndices * sizeof(indices[0]),
|
||||
indices,
|
||||
GL_DYNAMIC_DRAW_ARB);
|
||||
|
@ -330,7 +330,7 @@ void LODSphereMesh::render(const GLContext& context,
|
|||
for (i = 0; i < nTextures; i++)
|
||||
{
|
||||
if (nTextures > 1)
|
||||
glx::glClientActiveTextureARB(GL_TEXTURE0_ARB + i);
|
||||
glClientActiveTextureARB(GL_TEXTURE0_ARB + i);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
}
|
||||
|
||||
|
@ -419,8 +419,8 @@ void LODSphereMesh::render(const GLContext& context,
|
|||
|
||||
if (nTextures > 1)
|
||||
{
|
||||
glx::glClientActiveTextureARB(GL_TEXTURE0_ARB + i);
|
||||
glx::glActiveTextureARB(GL_TEXTURE0_ARB + i);
|
||||
glClientActiveTextureARB(GL_TEXTURE0_ARB + i);
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB + i);
|
||||
}
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
if (i > 0)
|
||||
|
@ -429,14 +429,14 @@ void LODSphereMesh::render(const GLContext& context,
|
|||
|
||||
if (nTextures > 1)
|
||||
{
|
||||
glx::glClientActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
glx::glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
glClientActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
}
|
||||
|
||||
if (useVertexBuffers)
|
||||
{
|
||||
glx::glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
|
||||
glx::glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
|
||||
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
|
||||
vertices = NULL;
|
||||
}
|
||||
|
||||
|
@ -653,7 +653,7 @@ void LODSphereMesh::renderSection(int phi0, int theta0, int extent,
|
|||
for (int tc = 0; tc < nTexturesUsed; tc++)
|
||||
{
|
||||
if (nTexturesUsed > 1)
|
||||
glx::glClientActiveTextureARB(GL_TEXTURE0_ARB + tc);
|
||||
glClientActiveTextureARB(GL_TEXTURE0_ARB + tc);
|
||||
glTexCoordPointer(2, GL_FLOAT, stride, vertexBase + (tc * 2) + texCoordOffset);
|
||||
}
|
||||
|
||||
|
@ -686,12 +686,12 @@ void LODSphereMesh::renderSection(int phi0, int theta0, int extent,
|
|||
// is a hint to OpenGL that previous contents of vertex buffer will
|
||||
// be discarded and overwritten. It enables renaming in the driver,
|
||||
// hopefully resulting in performance gains.
|
||||
glx::glBufferDataARB(GL_ARRAY_BUFFER_ARB,
|
||||
glBufferDataARB(GL_ARRAY_BUFFER_ARB,
|
||||
maxVertices * vertexSize * sizeof(float),
|
||||
NULL,
|
||||
GL_STREAM_DRAW_ARB);
|
||||
|
||||
vertices = reinterpret_cast<float*>(glx::glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB));
|
||||
vertices = reinterpret_cast<float*>(glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB));
|
||||
if (vertices == NULL)
|
||||
return;
|
||||
}
|
||||
|
@ -730,7 +730,7 @@ void LODSphereMesh::renderSection(int phi0, int theta0, int extent,
|
|||
v /= patchesPerVSubtex;
|
||||
|
||||
if (nTexturesUsed > 1)
|
||||
glx::glActiveTextureARB(GL_TEXTURE0_ARB + tex);
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB + tex);
|
||||
TextureTile tile = textures[tex]->getTile(ri.texLOD[tex],
|
||||
uTexSplit - u - 1,
|
||||
vTexSplit - v - 1);
|
||||
|
@ -807,7 +807,7 @@ void LODSphereMesh::renderSection(int phi0, int theta0, int extent,
|
|||
if (useVertexBuffers)
|
||||
{
|
||||
vertices = NULL;
|
||||
if (!glx::glUnmapBufferARB(GL_ARRAY_BUFFER_ARB))
|
||||
if (!glUnmapBufferARB(GL_ARRAY_BUFFER_ARB))
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -830,6 +830,6 @@ void LODSphereMesh::renderSection(int phi0, int theta0, int extent,
|
|||
currentVB++;
|
||||
if (currentVB == NUM_SPHERE_VERTEX_BUFFERS)
|
||||
currentVB = 0;
|
||||
glx::glBindBufferARB(GL_ARRAY_BUFFER_ARB, vertexBuffers[currentVB]);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, vertexBuffers[currentVB]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -226,7 +226,7 @@ Mesh::~Mesh()
|
|||
|
||||
if (vbObject != 0)
|
||||
{
|
||||
glx::glDeleteBuffersARB(1, &vbObject);
|
||||
glDeleteBuffersARB(1, &vbObject);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -516,11 +516,11 @@ Mesh::render(const std::vector<const Material*>& materials,
|
|||
|
||||
if (nVertices * vertexDesc.stride > MinVBOSize)
|
||||
{
|
||||
glx::glGenBuffersARB(1, &vbObject);
|
||||
glGenBuffersARB(1, &vbObject);
|
||||
if (vbObject != 0)
|
||||
{
|
||||
glx::glBindBufferARB(GL_ARRAY_BUFFER_ARB, vbObject);
|
||||
glx::glBufferDataARB(GL_ARRAY_BUFFER_ARB,
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, vbObject);
|
||||
glBufferDataARB(GL_ARRAY_BUFFER_ARB,
|
||||
nVertices * vertexDesc.stride,
|
||||
vertices,
|
||||
GL_STATIC_DRAW_ARB);
|
||||
|
@ -530,7 +530,7 @@ Mesh::render(const std::vector<const Material*>& materials,
|
|||
|
||||
if (vbObject != 0)
|
||||
{
|
||||
glx::glBindBufferARB(GL_ARRAY_BUFFER_ARB, vbObject);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, vbObject);
|
||||
rc.setVertexArrays(vertexDesc, NULL);
|
||||
}
|
||||
else
|
||||
|
@ -555,7 +555,7 @@ Mesh::render(const std::vector<const Material*>& materials,
|
|||
}
|
||||
|
||||
if (vbObject != 0)
|
||||
glx::glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ void Nebula::render(const GLContext& glcontext,
|
|||
GLSLUnlit_RenderContext rc(getRadius());
|
||||
rc.setPointScale(2.0f * getRadius() / pixelSize);
|
||||
g->render(rc);
|
||||
glx::glUseProgramObjectARB(0);
|
||||
glUseProgramObjectARB(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -61,7 +61,7 @@ void rc::parameter(GLenum which, Color color)
|
|||
f[1] = color.green();
|
||||
f[2] = color.blue();
|
||||
f[3] = color.alpha();
|
||||
glx::glCombinerParameterfvNV(which, f);
|
||||
glCombinerParameterfvNV(which, f);
|
||||
}
|
||||
|
||||
void SetupCombinersBumpMap(Texture& bumpTexture,
|
||||
|
@ -71,72 +71,72 @@ void SetupCombinersBumpMap(Texture& bumpTexture,
|
|||
glEnable(GL_REGISTER_COMBINERS_NV);
|
||||
|
||||
glDisable(GL_LIGHTING);
|
||||
glx::glActiveTextureARB(GL_TEXTURE1_ARB);
|
||||
glActiveTextureARB(GL_TEXTURE1_ARB);
|
||||
glEnable(GL_TEXTURE_CUBE_MAP_ARB);
|
||||
normalizationTexture.bind();
|
||||
|
||||
glx::glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
bumpTexture.bind();
|
||||
|
||||
// Just a single combiner stage required . . .
|
||||
glx::glCombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, 1);
|
||||
glCombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, 1);
|
||||
|
||||
float ambient[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
|
||||
ambient[0] = ambientColor.red();
|
||||
ambient[1] = ambientColor.green();
|
||||
ambient[2] = ambientColor.blue();
|
||||
glx::glCombinerParameterfvNV(GL_CONSTANT_COLOR0_NV, ambient);
|
||||
glCombinerParameterfvNV(GL_CONSTANT_COLOR0_NV, ambient);
|
||||
|
||||
// Compute N dot L in the RGB portion of combiner 0
|
||||
// Load register A with a normal N from the normal map
|
||||
glx::glCombinerInputNV(GL_COMBINER0_NV, GL_RGB,
|
||||
glCombinerInputNV(GL_COMBINER0_NV, GL_RGB,
|
||||
GL_VARIABLE_A_NV, GL_TEXTURE0_ARB,
|
||||
GL_EXPAND_NORMAL_NV, GL_RGB);
|
||||
|
||||
// Load register B with the normalized light direction L
|
||||
glx::glCombinerInputNV(GL_COMBINER0_NV, GL_RGB,
|
||||
glCombinerInputNV(GL_COMBINER0_NV, GL_RGB,
|
||||
GL_VARIABLE_B_NV, GL_TEXTURE1_ARB,
|
||||
GL_EXPAND_NORMAL_NV, GL_RGB);
|
||||
|
||||
// Compute N dot L
|
||||
glx::glCombinerOutputNV(GL_COMBINER0_NV, GL_RGB,
|
||||
glCombinerOutputNV(GL_COMBINER0_NV, GL_RGB,
|
||||
GL_SPARE0_NV, GL_DISCARD_NV, GL_DISCARD_NV,
|
||||
GL_NONE, GL_NONE, GL_TRUE, GL_FALSE, GL_FALSE);
|
||||
|
||||
// Compute the self-shadowing term in the alpha portion of combiner 0
|
||||
// A = 1
|
||||
glx::glCombinerInputNV(GL_COMBINER0_NV, GL_ALPHA, GL_VARIABLE_A_NV,
|
||||
glCombinerInputNV(GL_COMBINER0_NV, GL_ALPHA, GL_VARIABLE_A_NV,
|
||||
GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_ALPHA);
|
||||
// B = L.z
|
||||
glx::glCombinerInputNV(GL_COMBINER0_NV, GL_ALPHA, GL_VARIABLE_B_NV,
|
||||
glCombinerInputNV(GL_COMBINER0_NV, GL_ALPHA, GL_VARIABLE_B_NV,
|
||||
GL_TEXTURE1_ARB, GL_EXPAND_NORMAL_NV, GL_BLUE);
|
||||
// C = 1
|
||||
glx::glCombinerInputNV(GL_COMBINER0_NV, GL_ALPHA, GL_VARIABLE_C_NV,
|
||||
glCombinerInputNV(GL_COMBINER0_NV, GL_ALPHA, GL_VARIABLE_C_NV,
|
||||
GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_ALPHA);
|
||||
// D = L.z
|
||||
glx::glCombinerInputNV(GL_COMBINER0_NV, GL_ALPHA, GL_VARIABLE_D_NV,
|
||||
glCombinerInputNV(GL_COMBINER0_NV, GL_ALPHA, GL_VARIABLE_D_NV,
|
||||
GL_TEXTURE1_ARB, GL_EXPAND_NORMAL_NV, GL_BLUE);
|
||||
|
||||
// Create a steep ramp function for self-shadowing
|
||||
// SPARE0 = 4*(A*B+C*D) = 4*(1*L.z + 1*L.z) = 8 * L.z
|
||||
glx::glCombinerOutputNV(GL_COMBINER0_NV, GL_ALPHA,
|
||||
glCombinerOutputNV(GL_COMBINER0_NV, GL_ALPHA,
|
||||
GL_DISCARD_NV, GL_DISCARD_NV, GL_SPARE0_NV,
|
||||
GL_SCALE_BY_FOUR_NV, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE);
|
||||
|
||||
// A = SPARE0_alpha = per-pixel self-shadowing term
|
||||
glx::glFinalCombinerInputNV(GL_VARIABLE_A_NV,
|
||||
glFinalCombinerInputNV(GL_VARIABLE_A_NV,
|
||||
GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_ALPHA);
|
||||
glx::glFinalCombinerInputNV(GL_VARIABLE_B_NV,
|
||||
glFinalCombinerInputNV(GL_VARIABLE_B_NV,
|
||||
GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
|
||||
// C = zero
|
||||
glx::glFinalCombinerInputNV(GL_VARIABLE_C_NV,
|
||||
glFinalCombinerInputNV(GL_VARIABLE_C_NV,
|
||||
GL_ZERO, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
|
||||
// D = ambient color
|
||||
glx::glFinalCombinerInputNV(GL_VARIABLE_D_NV,
|
||||
glFinalCombinerInputNV(GL_VARIABLE_D_NV,
|
||||
GL_CONSTANT_COLOR0_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
|
||||
// G = diffuse illumination contribution = L dot N
|
||||
glx::glFinalCombinerInputNV(GL_VARIABLE_G_NV,
|
||||
glFinalCombinerInputNV(GL_VARIABLE_G_NV,
|
||||
GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_ALPHA);
|
||||
}
|
||||
|
||||
|
@ -154,68 +154,68 @@ void SetupCombinersSmooth(Texture& baseTexture,
|
|||
glEnable(GL_REGISTER_COMBINERS_NV);
|
||||
|
||||
glDisable(GL_LIGHTING);
|
||||
glx::glActiveTextureARB(GL_TEXTURE1_ARB);
|
||||
glActiveTextureARB(GL_TEXTURE1_ARB);
|
||||
glEnable(GL_TEXTURE_CUBE_MAP_ARB);
|
||||
normalizationTexture.bind();
|
||||
glx::glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
baseTexture.bind();
|
||||
|
||||
// Just a single combiner stage required . . .
|
||||
glx::glCombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, 1);
|
||||
glCombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, 1);
|
||||
|
||||
float ambient[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
|
||||
ambient[0] = ambientColor.red();
|
||||
ambient[1] = ambientColor.green();
|
||||
ambient[2] = ambientColor.blue();
|
||||
glx::glCombinerParameterfvNV(GL_CONSTANT_COLOR0_NV, ambient);
|
||||
glCombinerParameterfvNV(GL_CONSTANT_COLOR0_NV, ambient);
|
||||
|
||||
// A = primary color
|
||||
glx::glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_A_NV,
|
||||
glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_A_NV,
|
||||
GL_PRIMARY_COLOR_NV, GL_UNSIGNED_IDENTITY_NV,
|
||||
GL_RGB);
|
||||
// B = base texture color
|
||||
glx::glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV,
|
||||
glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV,
|
||||
GL_TEXTURE0_ARB, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
|
||||
// SPARE1_rgb = primary * texture
|
||||
glx::glCombinerOutputNV(GL_COMBINER0_NV, GL_RGB,
|
||||
glCombinerOutputNV(GL_COMBINER0_NV, GL_RGB,
|
||||
GL_SPARE1_NV, GL_DISCARD_NV, GL_DISCARD_NV,
|
||||
GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE);
|
||||
|
||||
// A = 1
|
||||
glx::glCombinerInputNV(GL_COMBINER0_NV, GL_ALPHA, GL_VARIABLE_A_NV,
|
||||
glCombinerInputNV(GL_COMBINER0_NV, GL_ALPHA, GL_VARIABLE_A_NV,
|
||||
GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_ALPHA);
|
||||
// B = L.z
|
||||
glx::glCombinerInputNV(GL_COMBINER0_NV, GL_ALPHA, GL_VARIABLE_B_NV,
|
||||
glCombinerInputNV(GL_COMBINER0_NV, GL_ALPHA, GL_VARIABLE_B_NV,
|
||||
GL_TEXTURE1_ARB, GL_EXPAND_NORMAL_NV,
|
||||
GL_BLUE);
|
||||
// SPARE0_alpha = 1 * L.z
|
||||
glx::glCombinerOutputNV(GL_COMBINER0_NV, GL_ALPHA,
|
||||
glCombinerOutputNV(GL_COMBINER0_NV, GL_ALPHA,
|
||||
GL_SPARE0_NV, GL_DISCARD_NV, GL_DISCARD_NV,
|
||||
GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE);
|
||||
|
||||
// E = SPARE1_rgb = base texture color * primary
|
||||
glx::glFinalCombinerInputNV(GL_VARIABLE_E_NV,
|
||||
glFinalCombinerInputNV(GL_VARIABLE_E_NV,
|
||||
GL_SPARE1_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
|
||||
// F = ambient color
|
||||
glx::glFinalCombinerInputNV(GL_VARIABLE_F_NV,
|
||||
glFinalCombinerInputNV(GL_VARIABLE_F_NV,
|
||||
GL_CONSTANT_COLOR0_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
|
||||
// A = SPARE1_rgb = base texture color * primary
|
||||
glx::glFinalCombinerInputNV(GL_VARIABLE_A_NV,
|
||||
glFinalCombinerInputNV(GL_VARIABLE_A_NV,
|
||||
GL_SPARE1_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
|
||||
// B = SPARE0_alpha = L.z
|
||||
glx::glFinalCombinerInputNV(GL_VARIABLE_B_NV,
|
||||
glFinalCombinerInputNV(GL_VARIABLE_B_NV,
|
||||
GL_SPARE0_NV,
|
||||
invert ? GL_UNSIGNED_INVERT_NV : GL_UNSIGNED_IDENTITY_NV,
|
||||
GL_ALPHA);
|
||||
// C = zero
|
||||
glx::glFinalCombinerInputNV(GL_VARIABLE_C_NV,
|
||||
glFinalCombinerInputNV(GL_VARIABLE_C_NV,
|
||||
GL_ZERO, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
|
||||
// D = SPARE1_rgb = E*F = texture * primary * ambient color
|
||||
glx::glFinalCombinerInputNV(GL_VARIABLE_D_NV,
|
||||
glFinalCombinerInputNV(GL_VARIABLE_D_NV,
|
||||
GL_E_TIMES_F_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
|
||||
// G = 1
|
||||
glx::glFinalCombinerInputNV(GL_VARIABLE_G_NV,
|
||||
glFinalCombinerInputNV(GL_VARIABLE_G_NV,
|
||||
GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_ALPHA);
|
||||
|
||||
}
|
||||
|
@ -228,14 +228,14 @@ void SetupCombinersDecalAndBumpMap(Texture& /*bumpTexture*/,
|
|||
Color diffuseColor)
|
||||
{
|
||||
glEnable(GL_REGISTER_COMBINERS_NV);
|
||||
glx::glCombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, 2);
|
||||
glCombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, 2);
|
||||
|
||||
rc::parameter(GL_CONSTANT_COLOR0_NV, ambientColor);
|
||||
rc::parameter(GL_CONSTANT_COLOR1_NV, diffuseColor);
|
||||
|
||||
// Compute N dot L in the RGB portion of combiner 0
|
||||
// Load register A with a normal N from the bump map
|
||||
glx::glCombinerInputNV(GL_COMBINER0_NV, GL_RGB,
|
||||
glCombinerInputNV(GL_COMBINER0_NV, GL_RGB,
|
||||
GL_VARIABLE_A_NV, GL_TEXTURE1_ARB,
|
||||
GL_EXPAND_NORMAL_NV, GL_RGB);
|
||||
|
||||
|
@ -244,80 +244,80 @@ void SetupCombinersDecalAndBumpMap(Texture& /*bumpTexture*/,
|
|||
// across triangles, the direction may become denormalized; however, in
|
||||
// Celestia, planet surfaces are tessellated finely enough that this
|
||||
// is not a problem.
|
||||
glx::glCombinerInputNV(GL_COMBINER0_NV, GL_RGB,
|
||||
glCombinerInputNV(GL_COMBINER0_NV, GL_RGB,
|
||||
GL_VARIABLE_B_NV, GL_PRIMARY_COLOR_NV,
|
||||
GL_EXPAND_NORMAL_NV, GL_RGB);
|
||||
|
||||
// Product C*D computes diffuse color * texture
|
||||
glx::glCombinerInputNV(GL_COMBINER0_NV, GL_RGB,
|
||||
glCombinerInputNV(GL_COMBINER0_NV, GL_RGB,
|
||||
GL_VARIABLE_C_NV, GL_TEXTURE0_ARB,
|
||||
GL_UNSIGNED_IDENTITY_NV, GL_RGB);
|
||||
glx::glCombinerInputNV(GL_COMBINER0_NV, GL_RGB,
|
||||
glCombinerInputNV(GL_COMBINER0_NV, GL_RGB,
|
||||
GL_VARIABLE_D_NV, GL_CONSTANT_COLOR1_NV,
|
||||
GL_UNSIGNED_IDENTITY_NV, GL_RGB);
|
||||
|
||||
// Compute N dot L in spare0 and diffuse * decal texture in spare1
|
||||
glx::glCombinerOutputNV(GL_COMBINER0_NV, GL_RGB,
|
||||
glCombinerOutputNV(GL_COMBINER0_NV, GL_RGB,
|
||||
GL_SPARE0_NV, GL_SPARE1_NV, GL_DISCARD_NV,
|
||||
GL_NONE, GL_NONE, GL_TRUE, GL_FALSE, GL_FALSE);
|
||||
|
||||
// Compute the self-shadowing term in the alpha portion of combiner 0
|
||||
// A = 1
|
||||
glx::glCombinerInputNV(GL_COMBINER0_NV, GL_ALPHA, GL_VARIABLE_A_NV,
|
||||
glCombinerInputNV(GL_COMBINER0_NV, GL_ALPHA, GL_VARIABLE_A_NV,
|
||||
GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_ALPHA);
|
||||
// B = L.z
|
||||
glx::glCombinerInputNV(GL_COMBINER0_NV, GL_ALPHA, GL_VARIABLE_B_NV,
|
||||
glCombinerInputNV(GL_COMBINER0_NV, GL_ALPHA, GL_VARIABLE_B_NV,
|
||||
GL_PRIMARY_COLOR_NV, GL_EXPAND_NORMAL_NV, GL_BLUE);
|
||||
// C = 1
|
||||
glx::glCombinerInputNV(GL_COMBINER0_NV, GL_ALPHA, GL_VARIABLE_C_NV,
|
||||
glCombinerInputNV(GL_COMBINER0_NV, GL_ALPHA, GL_VARIABLE_C_NV,
|
||||
GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_ALPHA);
|
||||
// D = L.z
|
||||
glx::glCombinerInputNV(GL_COMBINER0_NV, GL_ALPHA, GL_VARIABLE_D_NV,
|
||||
glCombinerInputNV(GL_COMBINER0_NV, GL_ALPHA, GL_VARIABLE_D_NV,
|
||||
GL_PRIMARY_COLOR_NV, GL_EXPAND_NORMAL_NV, GL_BLUE);
|
||||
|
||||
// Create a steep ramp function for self-shadowing
|
||||
// SPARE0 = 4*(A*B+C*D) = 4*(1*L.z + 1*L.z) = 8 * L.z
|
||||
glx::glCombinerOutputNV(GL_COMBINER0_NV, GL_ALPHA,
|
||||
glCombinerOutputNV(GL_COMBINER0_NV, GL_ALPHA,
|
||||
GL_DISCARD_NV, GL_DISCARD_NV, GL_SPARE0_NV,
|
||||
GL_SCALE_BY_FOUR_NV, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE);
|
||||
|
||||
// In the second combiner, sum the ambient color and product of the
|
||||
// diffuse and self-shadowing terms.
|
||||
glx::glCombinerInputNV(GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_A_NV,
|
||||
glCombinerInputNV(GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_A_NV,
|
||||
GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_ALPHA);
|
||||
glx::glCombinerInputNV(GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_B_NV,
|
||||
glCombinerInputNV(GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_B_NV,
|
||||
GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
|
||||
glx::glCombinerInputNV(GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_C_NV,
|
||||
glCombinerInputNV(GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_C_NV,
|
||||
GL_CONSTANT_COLOR0_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
|
||||
glx::glCombinerInputNV(GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_D_NV,
|
||||
glCombinerInputNV(GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_D_NV,
|
||||
GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_RGB);
|
||||
glx::glCombinerOutputNV(GL_COMBINER1_NV, GL_RGB,
|
||||
glCombinerOutputNV(GL_COMBINER1_NV, GL_RGB,
|
||||
GL_DISCARD_NV, GL_DISCARD_NV, GL_SPARE0_NV,
|
||||
GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE);
|
||||
|
||||
// E = SPARE0 = fragment brightness, including ambient, diffuse, and
|
||||
// self shadowing.
|
||||
glx::glFinalCombinerInputNV(GL_VARIABLE_E_NV,
|
||||
glFinalCombinerInputNV(GL_VARIABLE_E_NV,
|
||||
GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
|
||||
// F = spare1 = decal texture rgb * diffuse color
|
||||
glx::glFinalCombinerInputNV(GL_VARIABLE_F_NV,
|
||||
glFinalCombinerInputNV(GL_VARIABLE_F_NV,
|
||||
GL_SPARE1_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
|
||||
|
||||
// A = fog factor
|
||||
glx::glFinalCombinerInputNV(GL_VARIABLE_A_NV,
|
||||
glFinalCombinerInputNV(GL_VARIABLE_A_NV,
|
||||
GL_FOG, GL_UNSIGNED_IDENTITY_NV, GL_ALPHA);
|
||||
// B = color
|
||||
glx::glFinalCombinerInputNV(GL_VARIABLE_B_NV,
|
||||
glFinalCombinerInputNV(GL_VARIABLE_B_NV,
|
||||
GL_E_TIMES_F_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
|
||||
// C = fog color
|
||||
glx::glFinalCombinerInputNV(GL_VARIABLE_C_NV,
|
||||
glFinalCombinerInputNV(GL_VARIABLE_C_NV,
|
||||
GL_FOG, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
|
||||
// D = zero
|
||||
glx::glFinalCombinerInputNV(GL_VARIABLE_D_NV,
|
||||
glFinalCombinerInputNV(GL_VARIABLE_D_NV,
|
||||
GL_ZERO, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
|
||||
|
||||
// G = diffuse illumination contribution = L dot N
|
||||
glx::glFinalCombinerInputNV(GL_VARIABLE_G_NV,
|
||||
glFinalCombinerInputNV(GL_VARIABLE_G_NV,
|
||||
GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_ALPHA);
|
||||
}
|
||||
|
||||
|
@ -328,49 +328,49 @@ void SetupCombinersGlossMap(int glossMap)
|
|||
glEnable(GL_REGISTER_COMBINERS_NV);
|
||||
|
||||
// Just a single combiner stage required . . .
|
||||
glx::glCombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, 1);
|
||||
glCombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, 1);
|
||||
|
||||
// A = primary color
|
||||
glx::glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_A_NV,
|
||||
glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_A_NV,
|
||||
GL_PRIMARY_COLOR_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
|
||||
// B = base texture color
|
||||
glx::glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV,
|
||||
glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV,
|
||||
GL_TEXTURE0_ARB, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
|
||||
// C = secondary color
|
||||
glx::glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_C_NV,
|
||||
glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_C_NV,
|
||||
GL_SECONDARY_COLOR_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
|
||||
if (glossMap != 0)
|
||||
{
|
||||
// D = texture1 rgb (gloss mask)
|
||||
glx::glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_D_NV,
|
||||
glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_D_NV,
|
||||
glossMap, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
|
||||
}
|
||||
else
|
||||
{
|
||||
// D = texture alpha (gloss mask)
|
||||
glx::glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_D_NV,
|
||||
glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_D_NV,
|
||||
GL_TEXTURE0_ARB, GL_UNSIGNED_IDENTITY_NV, GL_ALPHA);
|
||||
}
|
||||
|
||||
// SPARE0_rgb = primary * texture.rgb + secondary * texture.alpha
|
||||
glx::glCombinerOutputNV(GL_COMBINER0_NV, GL_RGB,
|
||||
glCombinerOutputNV(GL_COMBINER0_NV, GL_RGB,
|
||||
GL_DISCARD_NV, GL_DISCARD_NV, GL_SPARE0_NV,
|
||||
GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE);
|
||||
|
||||
// A = SPARE0_rgb
|
||||
glx::glFinalCombinerInputNV(GL_VARIABLE_A_NV,
|
||||
glFinalCombinerInputNV(GL_VARIABLE_A_NV,
|
||||
GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
|
||||
// B = 1
|
||||
glx::glFinalCombinerInputNV(GL_VARIABLE_B_NV,
|
||||
glFinalCombinerInputNV(GL_VARIABLE_B_NV,
|
||||
GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_RGB);
|
||||
// C = zero
|
||||
glx::glFinalCombinerInputNV(GL_VARIABLE_C_NV,
|
||||
glFinalCombinerInputNV(GL_VARIABLE_C_NV,
|
||||
GL_ZERO, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
|
||||
// D = zero
|
||||
glx::glFinalCombinerInputNV(GL_VARIABLE_D_NV,
|
||||
glFinalCombinerInputNV(GL_VARIABLE_D_NV,
|
||||
GL_ZERO, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
|
||||
// G = 1
|
||||
glx::glFinalCombinerInputNV(GL_VARIABLE_G_NV,
|
||||
glFinalCombinerInputNV(GL_VARIABLE_G_NV,
|
||||
GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_ALPHA);
|
||||
}
|
||||
|
||||
|
@ -381,49 +381,49 @@ void SetupCombinersGlossMapWithFog(int glossMap)
|
|||
glEnable(GL_REGISTER_COMBINERS_NV);
|
||||
|
||||
// Just a single combiner stage required . . .
|
||||
glx::glCombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, 1);
|
||||
glCombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, 1);
|
||||
|
||||
// A = primary color
|
||||
glx::glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_A_NV,
|
||||
glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_A_NV,
|
||||
GL_PRIMARY_COLOR_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
|
||||
// B = base texture color
|
||||
glx::glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV,
|
||||
glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV,
|
||||
GL_TEXTURE0_ARB, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
|
||||
// C = secondary color
|
||||
glx::glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_C_NV,
|
||||
glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_C_NV,
|
||||
GL_SECONDARY_COLOR_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
|
||||
if (glossMap != 0)
|
||||
{
|
||||
// D = texture1 rgb (gloss mask)
|
||||
glx::glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_D_NV,
|
||||
glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_D_NV,
|
||||
glossMap, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
|
||||
}
|
||||
else
|
||||
{
|
||||
// D = texture alpha (gloss mask)
|
||||
glx::glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_D_NV,
|
||||
glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_D_NV,
|
||||
GL_TEXTURE0_ARB, GL_UNSIGNED_IDENTITY_NV, GL_ALPHA);
|
||||
}
|
||||
|
||||
// SPARE0_rgb = primary * texture.rgb + secondary * texture.alpha
|
||||
glx::glCombinerOutputNV(GL_COMBINER0_NV, GL_RGB,
|
||||
glCombinerOutputNV(GL_COMBINER0_NV, GL_RGB,
|
||||
GL_DISCARD_NV, GL_DISCARD_NV, GL_SPARE0_NV,
|
||||
GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE);
|
||||
|
||||
// A = fog factor
|
||||
glx::glFinalCombinerInputNV(GL_VARIABLE_A_NV,
|
||||
glFinalCombinerInputNV(GL_VARIABLE_A_NV,
|
||||
GL_FOG, GL_UNSIGNED_IDENTITY_NV, GL_ALPHA);
|
||||
// B = spare0_rgb
|
||||
glx::glFinalCombinerInputNV(GL_VARIABLE_B_NV,
|
||||
glFinalCombinerInputNV(GL_VARIABLE_B_NV,
|
||||
GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
|
||||
// C = fog color
|
||||
glx::glFinalCombinerInputNV(GL_VARIABLE_C_NV,
|
||||
glFinalCombinerInputNV(GL_VARIABLE_C_NV,
|
||||
GL_FOG, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
|
||||
// D = zero
|
||||
glx::glFinalCombinerInputNV(GL_VARIABLE_D_NV,
|
||||
glFinalCombinerInputNV(GL_VARIABLE_D_NV,
|
||||
GL_ZERO, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
|
||||
// G = 1
|
||||
glx::glFinalCombinerInputNV(GL_VARIABLE_G_NV,
|
||||
glFinalCombinerInputNV(GL_VARIABLE_G_NV,
|
||||
GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_ALPHA);
|
||||
}
|
||||
|
||||
|
@ -431,8 +431,8 @@ void SetupCombinersGlossMapWithFog(int glossMap)
|
|||
void DisableCombiners()
|
||||
{
|
||||
glDisable(GL_REGISTER_COMBINERS_NV);
|
||||
glx::glActiveTextureARB(GL_TEXTURE1_ARB);
|
||||
glActiveTextureARB(GL_TEXTURE1_ARB);
|
||||
glDisable(GL_TEXTURE_CUBE_MAP_ARB);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glx::glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
}
|
||||
|
|
|
@ -165,7 +165,7 @@ RenderContext::drawGroup(const Mesh::PrimitiveGroup& group)
|
|||
if (group.prim == Mesh::SpriteList)
|
||||
{
|
||||
glEnable(GL_POINT_SPRITE_ARB);
|
||||
glx::glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
glTexEnvi(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE);
|
||||
glEnable(GL_VERTEX_PROGRAM_POINT_SIZE_ARB);
|
||||
}
|
||||
|
@ -483,8 +483,8 @@ setExtendedVertexArrays(const Mesh::VertexDescription& desc,
|
|||
switch (tangent.format)
|
||||
{
|
||||
case Mesh::Float3:
|
||||
glx::glEnableVertexAttribArrayARB(TangentAttributeIndex);
|
||||
glx::glVertexAttribPointerARB(TangentAttributeIndex,
|
||||
glEnableVertexAttribArrayARB(TangentAttributeIndex);
|
||||
glVertexAttribPointerARB(TangentAttributeIndex,
|
||||
GLComponentCounts[(int) tangent.format],
|
||||
GLComponentTypes[(int) tangent.format],
|
||||
GL_FALSE,
|
||||
|
@ -492,7 +492,7 @@ setExtendedVertexArrays(const Mesh::VertexDescription& desc,
|
|||
vertices + tangent.offset);
|
||||
break;
|
||||
default:
|
||||
glx::glDisableVertexAttribArrayARB(TangentAttributeIndex);
|
||||
glDisableVertexAttribArrayARB(TangentAttributeIndex);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -500,8 +500,8 @@ setExtendedVertexArrays(const Mesh::VertexDescription& desc,
|
|||
switch (pointsize.format)
|
||||
{
|
||||
case Mesh::Float1:
|
||||
glx::glEnableVertexAttribArrayARB(PointSizeAttributeIndex);
|
||||
glx::glVertexAttribPointerARB(PointSizeAttributeIndex,
|
||||
glEnableVertexAttribArrayARB(PointSizeAttributeIndex);
|
||||
glVertexAttribPointerARB(PointSizeAttributeIndex,
|
||||
GLComponentCounts[(int) pointsize.format],
|
||||
GLComponentTypes[(int) pointsize.format],
|
||||
GL_FALSE,
|
||||
|
@ -509,7 +509,7 @@ setExtendedVertexArrays(const Mesh::VertexDescription& desc,
|
|||
vertices + pointsize.offset);
|
||||
break;
|
||||
default:
|
||||
glx::glDisableVertexAttribArrayARB(PointSizeAttributeIndex);
|
||||
glDisableVertexAttribArrayARB(PointSizeAttributeIndex);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -535,8 +535,8 @@ GLSL_RenderContext::~GLSL_RenderContext()
|
|||
glDisableClientState(GL_NORMAL_ARRAY);
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glx::glDisableVertexAttribArrayARB(TangentAttributeIndex);
|
||||
glx::glDisableVertexAttribArrayARB(PointSizeAttributeIndex);
|
||||
glDisableVertexAttribArrayARB(TangentAttributeIndex);
|
||||
glDisableVertexAttribArrayARB(PointSizeAttributeIndex);
|
||||
}
|
||||
|
||||
|
||||
|
@ -668,7 +668,7 @@ GLSL_RenderContext::makeCurrent(const Mesh::Material& m)
|
|||
|
||||
for (unsigned int i = 0; i < nTextures; i++)
|
||||
{
|
||||
glx::glActiveTextureARB(GL_TEXTURE0_ARB + i);
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB + i);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
textures[i]->bind();
|
||||
}
|
||||
|
@ -809,8 +809,8 @@ GLSLUnlit_RenderContext::~GLSLUnlit_RenderContext()
|
|||
glDisableClientState(GL_NORMAL_ARRAY);
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glx::glDisableVertexAttribArrayARB(TangentAttributeIndex);
|
||||
glx::glDisableVertexAttribArrayARB(PointSizeAttributeIndex);
|
||||
glDisableVertexAttribArrayARB(TangentAttributeIndex);
|
||||
glDisableVertexAttribArrayARB(PointSizeAttributeIndex);
|
||||
}
|
||||
|
||||
|
||||
|
@ -859,7 +859,7 @@ GLSLUnlit_RenderContext::makeCurrent(const Mesh::Material& m)
|
|||
|
||||
for (unsigned int i = 0; i < nTextures; i++)
|
||||
{
|
||||
glx::glActiveTextureARB(GL_TEXTURE0_ARB + i);
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB + i);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
textures[i]->bind();
|
||||
}
|
||||
|
|
|
@ -1072,7 +1072,7 @@ bool Renderer::init(GLContext* _context,
|
|||
// shadowTex->setMaxMipMapLevel(3);
|
||||
Texture::AddressMode shadowTexAddress = Texture::EdgeClamp;
|
||||
Texture::MipMapMode shadowTexMip = Texture::NoMipMaps;
|
||||
useClampToBorder = context->extensionSupported("GL_ARB_texture_border_clamp");
|
||||
useClampToBorder = GLEW_ARB_texture_border_clamp;
|
||||
if (useClampToBorder)
|
||||
{
|
||||
shadowTexAddress = Texture::BorderClamp;
|
||||
|
@ -1122,7 +1122,7 @@ bool Renderer::init(GLContext* _context,
|
|||
PenumbraFunctionEval,
|
||||
Texture::EdgeClamp);
|
||||
|
||||
if (context->extensionSupported("GL_ARB_texture_cube_map"))
|
||||
if (GLEW_ARB_texture_cube_map)
|
||||
{
|
||||
normalizationTex = CreateProceduralCubeMap(64, GL_RGB, IllumMapEval);
|
||||
#if ADVANCED_CLOUD_SHADOWS
|
||||
|
@ -1138,7 +1138,7 @@ bool Renderer::init(GLContext* _context,
|
|||
}
|
||||
|
||||
#if 0
|
||||
if (context->extensionSupported("GL_ARB_multisample"))
|
||||
if (GLEW_ARB_multisample)
|
||||
{
|
||||
int nSamples = 0;
|
||||
int sampleBuffers = 0;
|
||||
|
@ -1153,7 +1153,7 @@ bool Renderer::init(GLContext* _context,
|
|||
}
|
||||
#endif
|
||||
|
||||
if (context->extensionSupported("GL_EXT_rescale_normal"))
|
||||
if (GLEW_EXT_rescale_normal)
|
||||
{
|
||||
// We need this enabled because we use glScale, but only
|
||||
// with uniform scale factors.
|
||||
|
@ -1162,13 +1162,13 @@ bool Renderer::init(GLContext* _context,
|
|||
glEnable(GL_RESCALE_NORMAL_EXT);
|
||||
}
|
||||
|
||||
if (context->extensionSupported("GL_ARB_point_sprite"))
|
||||
if (GLEW_ARB_point_sprite)
|
||||
{
|
||||
DPRINTF(1, "Renderer: point sprites supported.\n");
|
||||
usePointSprite = true;
|
||||
}
|
||||
|
||||
if (context->extensionSupported("GL_EXT_separate_specular_color"))
|
||||
if (GLEW_EXT_separate_specular_color)
|
||||
{
|
||||
glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL_EXT, GL_SEPARATE_SPECULAR_COLOR_EXT);
|
||||
}
|
||||
|
@ -1226,7 +1226,7 @@ bool Renderer::init(GLContext* _context,
|
|||
}
|
||||
|
||||
#ifdef USE_HDR
|
||||
useBlendSubtract = context->extensionSupported("GL_EXT_blend_subtract");
|
||||
useBlendSubtract = GLEW_EXT_blend_subtract;
|
||||
Image *testImg = new Image(GL_LUMINANCE_ALPHA, 1, 1);
|
||||
ImageTexture *testTex = new ImageTexture(*testImg,
|
||||
Texture::EdgeClamp,
|
||||
|
@ -2305,7 +2305,7 @@ void Renderer::renderToBlurTexture(int blurLevel)
|
|||
{
|
||||
const GLfloat bias = -0.5f;
|
||||
glBlendFunc(GL_ONE, GL_ONE);
|
||||
glx::glBlendEquationEXT(GL_FUNC_REVERSE_SUBTRACT_EXT);
|
||||
glBlendEquationEXT(GL_FUNC_REVERSE_SUBTRACT_EXT);
|
||||
glColor4f(-bias, -bias, -bias, 0.0f);
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
@ -2324,7 +2324,7 @@ void Renderer::renderToBlurTexture(int blurLevel)
|
|||
|
||||
// Scale back up hdr part
|
||||
{
|
||||
glx::glBlendEquationEXT(GL_FUNC_ADD_EXT);
|
||||
glBlendEquationEXT(GL_FUNC_ADD_EXT);
|
||||
glBlendFunc(GL_DST_COLOR, GL_ONE);
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
|
@ -3854,12 +3854,14 @@ void Renderer::draw(const Observer& observer,
|
|||
}
|
||||
#endif
|
||||
|
||||
if (videoSync && glx::glXWaitVideoSyncSGI != NULL)
|
||||
#if VIDEO_SYNC
|
||||
if (videoSync && glXWaitVideoSyncSGI != NULL)
|
||||
{
|
||||
unsigned int count;
|
||||
glx::glXGetVideoSyncSGI(&count);
|
||||
glx::glXWaitVideoSyncSGI(2, (count+1) & 1, &count);
|
||||
glXGetVideoSyncSGI(&count);
|
||||
glXWaitVideoSyncSGI(2, (count+1) & 1, &count);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -4238,7 +4240,7 @@ static void renderBumpMappedMesh(const GLContext& context,
|
|||
// isn't as general as transforming the light direction by an
|
||||
// orthonormal basis for each mesh vertex, but it works well enough
|
||||
// for spheres illuminated by directional light sources.
|
||||
glx::glActiveTextureARB(GL_TEXTURE1_ARB);
|
||||
glActiveTextureARB(GL_TEXTURE1_ARB);
|
||||
|
||||
// Set up GL_NORMAL_MAP_EXT texture coordinate generation. This
|
||||
// mode is part of the cube map extension.
|
||||
|
@ -4255,7 +4257,7 @@ static void renderBumpMappedMesh(const GLContext& context,
|
|||
glScalef(-1.0f, 1.0f, 1.0f);
|
||||
glRotate(lightOrientation * orientation.conjugate());
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glx::glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
|
||||
g_lodSphere->render(context,
|
||||
LODSphereMesh::Normals | LODSphereMesh::TexCoords0,
|
||||
|
@ -4263,7 +4265,7 @@ static void renderBumpMappedMesh(const GLContext& context,
|
|||
&bumpTexture);
|
||||
|
||||
// Reset the second texture unit
|
||||
glx::glActiveTextureARB(GL_TEXTURE1_ARB);
|
||||
glActiveTextureARB(GL_TEXTURE1_ARB);
|
||||
glMatrixMode(GL_TEXTURE);
|
||||
glLoadIdentity();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
@ -4306,7 +4308,7 @@ static void renderSmoothMesh(const GLContext& context,
|
|||
// isn't as general as transforming the light direction by an
|
||||
// orthonormal basis for each mesh vertex, but it works well enough
|
||||
// for spheres illuminated by directional light sources.
|
||||
glx::glActiveTextureARB(GL_TEXTURE1_ARB);
|
||||
glActiveTextureARB(GL_TEXTURE1_ARB);
|
||||
|
||||
// Set up GL_NORMAL_MAP_EXT texture coordinate generation. This
|
||||
// mode is part of the cube map extension.
|
||||
|
@ -4322,7 +4324,7 @@ static void renderSmoothMesh(const GLContext& context,
|
|||
glMatrixMode(GL_TEXTURE);
|
||||
glRotate(lightOrientation * orientation.conjugate());
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glx::glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
|
||||
textures[0] = &baseTexture;
|
||||
g_lodSphere->render(context,
|
||||
|
@ -4331,7 +4333,7 @@ static void renderSmoothMesh(const GLContext& context,
|
|||
textures, 1);
|
||||
|
||||
// Reset the second texture unit
|
||||
glx::glActiveTextureARB(GL_TEXTURE1_ARB);
|
||||
glActiveTextureARB(GL_TEXTURE1_ARB);
|
||||
glMatrixMode(GL_TEXTURE);
|
||||
glLoadIdentity();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
@ -4791,7 +4793,7 @@ static void setupBumpTexenv()
|
|||
|
||||
// In the final stage, modulate the lighting value by the
|
||||
// base texture color.
|
||||
glx::glActiveTextureARB(GL_TEXTURE1_ARB);
|
||||
glActiveTextureARB(GL_TEXTURE1_ARB);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_MODULATE);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_TEXTURE);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_EXT, GL_SRC_COLOR);
|
||||
|
@ -4799,7 +4801,7 @@ static void setupBumpTexenv()
|
|||
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_SRC_COLOR);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
glx::glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
}
|
||||
|
||||
|
||||
|
@ -4818,7 +4820,7 @@ static void setupBumpTexenvAmbient(Color ambientColor)
|
|||
// The primary color contains the light direction in surface
|
||||
// space, and texture0 is a normal map. The lighting is
|
||||
// calculated by computing the dot product.
|
||||
glx::glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_DOT3_RGB_ARB);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_PRIMARY_COLOR_EXT);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_EXT, GL_SRC_COLOR);
|
||||
|
@ -4826,7 +4828,7 @@ static void setupBumpTexenvAmbient(Color ambientColor)
|
|||
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_SRC_COLOR);
|
||||
|
||||
// Add in the ambient color
|
||||
glx::glActiveTextureARB(GL_TEXTURE1_ARB);
|
||||
glActiveTextureARB(GL_TEXTURE1_ARB);
|
||||
glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, texenvConst);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_ADD);
|
||||
|
@ -4838,7 +4840,7 @@ static void setupBumpTexenvAmbient(Color ambientColor)
|
|||
|
||||
// In the final stage, modulate the lighting value by the
|
||||
// base texture color.
|
||||
glx::glActiveTextureARB(GL_TEXTURE2_ARB);
|
||||
glActiveTextureARB(GL_TEXTURE2_ARB);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_MODULATE);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_PREVIOUS_EXT);
|
||||
|
@ -4847,7 +4849,7 @@ static void setupBumpTexenvAmbient(Color ambientColor)
|
|||
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_SRC_COLOR);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
glx::glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -4859,7 +4861,7 @@ static void setupTexenvAmbient(Color ambientColor)
|
|||
// The primary color contains the light direction in surface
|
||||
// space, and texture0 is a normal map. The lighting is
|
||||
// calculated by computing the dot product.
|
||||
glx::glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, ambientColor.toVector4().data());
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_MODULATE);
|
||||
|
@ -5214,9 +5216,9 @@ static void renderSphere_DOT3_VP(const RenderInfo& ri,
|
|||
}
|
||||
else
|
||||
{
|
||||
glx::glActiveTextureARB(GL_TEXTURE1_ARB);
|
||||
glActiveTextureARB(GL_TEXTURE1_ARB);
|
||||
ri.baseTex->bind();
|
||||
glx::glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
ri.bumpTex->bind();
|
||||
setupBumpTexenv();
|
||||
g_lodSphere->render(context,
|
||||
|
@ -5774,12 +5776,12 @@ static void renderShadowedGeometryDefault(Geometry* geometry,
|
|||
|
||||
if (useShadowMask)
|
||||
{
|
||||
glx::glActiveTextureARB(GL_TEXTURE1_ARB);
|
||||
glActiveTextureARB(GL_TEXTURE1_ARB);
|
||||
glEnable(GL_TEXTURE_GEN_S);
|
||||
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
|
||||
glTexGenfv(GL_S, GL_OBJECT_PLANE,
|
||||
Vector4f(lightDir.x(), lightDir.y(), lightDir.z(), 0.5f).data());
|
||||
glx::glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
}
|
||||
|
||||
glColor4f(1, 1, 1, 1);
|
||||
|
@ -5800,9 +5802,9 @@ static void renderShadowedGeometryDefault(Geometry* geometry,
|
|||
|
||||
if (useShadowMask)
|
||||
{
|
||||
glx::glActiveTextureARB(GL_TEXTURE1_ARB);
|
||||
glActiveTextureARB(GL_TEXTURE1_ARB);
|
||||
glDisable(GL_TEXTURE_GEN_S);
|
||||
glx::glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
}
|
||||
glDisable(GL_TEXTURE_GEN_S);
|
||||
glDisable(GL_TEXTURE_GEN_T);
|
||||
|
@ -5885,7 +5887,7 @@ static void renderRings(RingSystem& rings,
|
|||
// distance to the sun is very large relative to its diameter.
|
||||
if (renderShadow)
|
||||
{
|
||||
glx::glActiveTextureARB(GL_TEXTURE1_ARB);
|
||||
glActiveTextureARB(GL_TEXTURE1_ARB);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
shadowTex->bind();
|
||||
|
||||
|
@ -5955,7 +5957,7 @@ static void renderRings(RingSystem& rings,
|
|||
glTexGenfv(GL_T, GL_EYE_PLANE, tPlane.data());
|
||||
}
|
||||
|
||||
glx::glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
|
||||
if (fproc != NULL)
|
||||
{
|
||||
|
@ -6029,11 +6031,11 @@ static void renderRings(RingSystem& rings,
|
|||
// Disable the second texture unit if it was used
|
||||
if (renderShadow)
|
||||
{
|
||||
glx::glActiveTextureARB(GL_TEXTURE1_ARB);
|
||||
glActiveTextureARB(GL_TEXTURE1_ARB);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glDisable(GL_TEXTURE_GEN_S);
|
||||
glDisable(GL_TEXTURE_GEN_T);
|
||||
glx::glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
|
||||
if (fproc != NULL)
|
||||
fproc->disable();
|
||||
|
@ -6138,7 +6140,7 @@ renderEclipseShadows(Geometry* geometry,
|
|||
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_ADD);
|
||||
|
||||
// The second texture unit has the shadow 'mask'
|
||||
glx::glActiveTextureARB(GL_TEXTURE1_ARB);
|
||||
glActiveTextureARB(GL_TEXTURE1_ARB);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
shadowMaskTexture->bind();
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
|
||||
|
@ -6147,7 +6149,7 @@ renderEclipseShadows(Geometry* geometry,
|
|||
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_EXT, GL_SRC_COLOR);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_TEXTURE);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_SRC_COLOR);
|
||||
glx::glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
}
|
||||
|
||||
// Since invariance between nVidia's vertex programs and the
|
||||
|
@ -6173,10 +6175,10 @@ renderEclipseShadows(Geometry* geometry,
|
|||
if (ri.useTexEnvCombine)
|
||||
{
|
||||
// Disable second texture unit
|
||||
glx::glActiveTextureARB(GL_TEXTURE1_ARB);
|
||||
glActiveTextureARB(GL_TEXTURE1_ARB);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
glx::glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
|
||||
float color[4] = { 0, 0, 0, 0 };
|
||||
glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, color);
|
||||
|
@ -7033,12 +7035,12 @@ void Renderer::renderObject(const Vector3f& pos,
|
|||
|
||||
for (unsigned int i = 1; i < 8;/*context->getMaxTextures();*/ i++)
|
||||
{
|
||||
glx::glActiveTextureARB(GL_TEXTURE0_ARB + i);
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB + i);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
glx::glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glx::glUseProgramObjectARB(0);
|
||||
glUseProgramObjectARB(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -7844,7 +7846,7 @@ void Renderer::renderCometTail(const Body& body,
|
|||
glPushMatrix();
|
||||
glTranslate(pos);
|
||||
|
||||
// glx::glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
// glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glDisable(GL_LIGHTING);
|
||||
glDepthMask(GL_FALSE);
|
||||
|
|
|
@ -124,7 +124,7 @@ void renderSphere_GLSL(const RenderInfo& ri,
|
|||
Texture* ringsTex = rings->texture.find(textureRes);
|
||||
if (ringsTex != NULL)
|
||||
{
|
||||
glx::glActiveTextureARB(GL_TEXTURE0_ARB + nTextures);
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB + nTextures);
|
||||
ringsTex->bind();
|
||||
nTextures++;
|
||||
|
||||
|
@ -134,7 +134,7 @@ void renderSphere_GLSL(const RenderInfo& ri,
|
|||
glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, bc);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,
|
||||
GL_CLAMP_TO_BORDER_ARB);
|
||||
glx::glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
|
||||
shadprop.texUsage |= ShaderProperties::RingShadowTexture;
|
||||
}
|
||||
|
@ -186,9 +186,9 @@ void renderSphere_GLSL(const RenderInfo& ri,
|
|||
{
|
||||
shadprop.texUsage |= ShaderProperties::CloudShadowTexture;
|
||||
textures[nTextures++] = cloudTex;
|
||||
glx::glActiveTextureARB(GL_TEXTURE0_ARB + nTextures);
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB + nTextures);
|
||||
cloudTex->bind();
|
||||
glx::glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -256,7 +256,7 @@ void renderSphere_GLSL(const RenderInfo& ri,
|
|||
frustum, ri.pixWidth,
|
||||
textures[0], textures[1], textures[2], textures[3]);
|
||||
|
||||
glx::glUseProgramObjectARB(0);
|
||||
glUseProgramObjectARB(0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -307,7 +307,7 @@ void renderGeometry_GLSL(Geometry* geometry,
|
|||
geometry->render(rc, tsec);
|
||||
}
|
||||
|
||||
glx::glUseProgramObjectARB(0);
|
||||
glUseProgramObjectARB(0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -347,7 +347,7 @@ void renderGeometry_GLSL_Unlit(Geometry* geometry,
|
|||
geometry->render(rc, tsec);
|
||||
}
|
||||
|
||||
glx::glUseProgramObjectARB(0);
|
||||
glUseProgramObjectARB(0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -395,7 +395,7 @@ void renderClouds_GLSL(const RenderInfo& ri,
|
|||
Texture* ringsTex = rings->texture.find(textureRes);
|
||||
if (ringsTex != NULL)
|
||||
{
|
||||
glx::glActiveTextureARB(GL_TEXTURE0_ARB + nTextures);
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB + nTextures);
|
||||
ringsTex->bind();
|
||||
nTextures++;
|
||||
|
||||
|
@ -405,7 +405,7 @@ void renderClouds_GLSL(const RenderInfo& ri,
|
|||
glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, bc);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,
|
||||
GL_CLAMP_TO_BORDER_ARB);
|
||||
glx::glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
|
||||
shadprop.texUsage |= ShaderProperties::RingShadowTexture;
|
||||
}
|
||||
|
@ -476,7 +476,7 @@ void renderClouds_GLSL(const RenderInfo& ri,
|
|||
|
||||
prog->textureOffset = 0.0f;
|
||||
|
||||
glx::glUseProgramObjectARB(0);
|
||||
glUseProgramObjectARB(0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -545,9 +545,9 @@ renderAtmosphere_GLSL(const RenderInfo& ri,
|
|||
glPopMatrix();
|
||||
|
||||
|
||||
glx::glUseProgramObjectARB(0);
|
||||
glUseProgramObjectARB(0);
|
||||
|
||||
//glx::glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
//glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
//glEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
|
@ -694,5 +694,5 @@ void renderRings_GLSL(RingSystem& rings,
|
|||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||
|
||||
glx::glUseProgramObjectARB(0);
|
||||
glUseProgramObjectARB(0);
|
||||
}
|
||||
|
|
|
@ -2238,13 +2238,13 @@ ShaderManager::buildProgram(const ShaderProperties& props)
|
|||
{
|
||||
// Tangents always in attribute 6 (should be a constant
|
||||
// someplace)
|
||||
glx::glBindAttribLocationARB(prog->getID(), 6, "tangent");
|
||||
glBindAttribLocationARB(prog->getID(), 6, "tangent");
|
||||
}
|
||||
|
||||
if (props.texUsage & ShaderProperties::PointSprite)
|
||||
{
|
||||
// Point size is always in attribute 7
|
||||
glx::glBindAttribLocationARB(prog->getID(), 7, "pointSize");
|
||||
glBindAttribLocationARB(prog->getID(), 7, "pointSize");
|
||||
}
|
||||
|
||||
status = prog->link();
|
||||
|
@ -2414,58 +2414,58 @@ CelestiaGLProgram::initSamplers()
|
|||
|
||||
if (props.texUsage & ShaderProperties::DiffuseTexture)
|
||||
{
|
||||
int slot = glx::glGetUniformLocationARB(program->getID(), "diffTex");
|
||||
int slot = glGetUniformLocationARB(program->getID(), "diffTex");
|
||||
if (slot != -1)
|
||||
glx::glUniform1iARB(slot, nSamplers++);
|
||||
glUniform1iARB(slot, nSamplers++);
|
||||
}
|
||||
|
||||
if (props.texUsage & ShaderProperties::NormalTexture)
|
||||
{
|
||||
int slot = glx::glGetUniformLocationARB(program->getID(), "normTex");
|
||||
int slot = glGetUniformLocationARB(program->getID(), "normTex");
|
||||
if (slot != -1)
|
||||
glx::glUniform1iARB(slot, nSamplers++);
|
||||
glUniform1iARB(slot, nSamplers++);
|
||||
}
|
||||
|
||||
if (props.texUsage & ShaderProperties::SpecularTexture)
|
||||
{
|
||||
int slot = glx::glGetUniformLocationARB(program->getID(), "specTex");
|
||||
int slot = glGetUniformLocationARB(program->getID(), "specTex");
|
||||
if (slot != -1)
|
||||
glx::glUniform1iARB(slot, nSamplers++);
|
||||
glUniform1iARB(slot, nSamplers++);
|
||||
}
|
||||
|
||||
if (props.texUsage & ShaderProperties::NightTexture)
|
||||
{
|
||||
int slot = glx::glGetUniformLocationARB(program->getID(), "nightTex");
|
||||
int slot = glGetUniformLocationARB(program->getID(), "nightTex");
|
||||
if (slot != -1)
|
||||
glx::glUniform1iARB(slot, nSamplers++);
|
||||
glUniform1iARB(slot, nSamplers++);
|
||||
}
|
||||
|
||||
if (props.texUsage & ShaderProperties::EmissiveTexture)
|
||||
{
|
||||
int slot = glx::glGetUniformLocationARB(program->getID(), "emissiveTex");
|
||||
int slot = glGetUniformLocationARB(program->getID(), "emissiveTex");
|
||||
if (slot != -1)
|
||||
glx::glUniform1iARB(slot, nSamplers++);
|
||||
glUniform1iARB(slot, nSamplers++);
|
||||
}
|
||||
|
||||
if (props.texUsage & ShaderProperties::OverlayTexture)
|
||||
{
|
||||
int slot = glx::glGetUniformLocationARB(program->getID(), "overlayTex");
|
||||
int slot = glGetUniformLocationARB(program->getID(), "overlayTex");
|
||||
if (slot != -1)
|
||||
glx::glUniform1iARB(slot, nSamplers++);
|
||||
glUniform1iARB(slot, nSamplers++);
|
||||
}
|
||||
|
||||
if (props.texUsage & ShaderProperties::RingShadowTexture)
|
||||
{
|
||||
int slot = glx::glGetUniformLocationARB(program->getID(), "ringTex");
|
||||
int slot = glGetUniformLocationARB(program->getID(), "ringTex");
|
||||
if (slot != -1)
|
||||
glx::glUniform1iARB(slot, nSamplers++);
|
||||
glUniform1iARB(slot, nSamplers++);
|
||||
}
|
||||
|
||||
if (props.texUsage & ShaderProperties::CloudShadowTexture)
|
||||
{
|
||||
int slot = glx::glGetUniformLocationARB(program->getID(), "cloudShadowTex");
|
||||
int slot = glGetUniformLocationARB(program->getID(), "cloudShadowTex");
|
||||
if (slot != -1)
|
||||
glx::glUniform1iARB(slot, nSamplers++);
|
||||
glUniform1iARB(slot, nSamplers++);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -272,7 +272,7 @@ static void LoadMipmapSet(Image& img, GLenum target)
|
|||
|
||||
if (img.isCompressed())
|
||||
{
|
||||
glx::glCompressedTexImage2DARB(target,
|
||||
glCompressedTexImage2DARB(target,
|
||||
mip,
|
||||
internalFormat,
|
||||
mipWidth, mipHeight,
|
||||
|
@ -302,7 +302,7 @@ static void LoadMiplessTexture(Image& img, GLenum target)
|
|||
|
||||
if (img.isCompressed())
|
||||
{
|
||||
glx::glCompressedTexImage2DARB(target,
|
||||
glCompressedTexImage2DARB(target,
|
||||
0,
|
||||
internalFormat,
|
||||
img.getWidth(), img.getHeight(),
|
||||
|
|
|
@ -121,8 +121,8 @@ static bool LoadNvVertexProgram(const string& filename, unsigned int& id)
|
|||
return false;
|
||||
}
|
||||
|
||||
glx::glGenProgramsNV(1, (GLuint*) &id);
|
||||
glx::glLoadProgramNV(GL_VERTEX_PROGRAM_NV,
|
||||
glGenProgramsNV(1, (GLuint*) &id);
|
||||
glLoadProgramNV(GL_VERTEX_PROGRAM_NV,
|
||||
id,
|
||||
source->length(),
|
||||
reinterpret_cast<const GLubyte*>(source->c_str()));
|
||||
|
@ -170,15 +170,15 @@ static bool LoadARBVertexProgram(const string& filename, unsigned int& id)
|
|||
return false;
|
||||
}
|
||||
|
||||
glx::glGenProgramsARB(1, (GLuint*) &id);
|
||||
glGenProgramsARB(1, (GLuint*) &id);
|
||||
if (glGetError() != GL_NO_ERROR)
|
||||
{
|
||||
delete source;
|
||||
return false;
|
||||
}
|
||||
|
||||
glx::glBindProgramARB(GL_VERTEX_PROGRAM_ARB, id);
|
||||
glx::glProgramStringARB(GL_VERTEX_PROGRAM_ARB,
|
||||
glBindProgramARB(GL_VERTEX_PROGRAM_ARB, id);
|
||||
glProgramStringARB(GL_VERTEX_PROGRAM_ARB,
|
||||
GL_PROGRAM_FORMAT_ASCII_ARB,
|
||||
source->length(),
|
||||
reinterpret_cast<const GLubyte*>(source->c_str()));
|
||||
|
@ -240,9 +240,9 @@ VertexProcessor* vp::initNV()
|
|||
everything = 0;
|
||||
cout << _("All NV vertex programs loaded successfully.\n");
|
||||
|
||||
glx::glTrackMatrixNV(GL_VERTEX_PROGRAM_NV,
|
||||
glTrackMatrixNV(GL_VERTEX_PROGRAM_NV,
|
||||
0, GL_MODELVIEW_PROJECTION_NV, GL_IDENTITY_NV);
|
||||
glx::glTrackMatrixNV(GL_VERTEX_PROGRAM_NV,
|
||||
glTrackMatrixNV(GL_VERTEX_PROGRAM_NV,
|
||||
4, GL_MODELVIEW_PROJECTION_NV, GL_INVERSE_TRANSPOSE_NV);
|
||||
|
||||
return new VertexProcessorNV();
|
||||
|
@ -332,36 +332,36 @@ void vp::enable()
|
|||
|
||||
void vp::use(unsigned int prog)
|
||||
{
|
||||
glx::glBindProgramNV(GL_VERTEX_PROGRAM_NV, prog);
|
||||
glBindProgramNV(GL_VERTEX_PROGRAM_NV, prog);
|
||||
}
|
||||
|
||||
|
||||
void vp::parameter(unsigned int param, const Color& c)
|
||||
{
|
||||
glx::glProgramParameter4fNV(GL_VERTEX_PROGRAM_NV, param,
|
||||
glProgramParameter4fNV(GL_VERTEX_PROGRAM_NV, param,
|
||||
c.red(), c.green(), c.blue(), c.alpha());
|
||||
}
|
||||
|
||||
void vp::parameter(unsigned int param, float x, float y, float z, float w)
|
||||
{
|
||||
glx::glProgramParameter4fNV(GL_VERTEX_PROGRAM_NV, param, x, y, z, w);
|
||||
glProgramParameter4fNV(GL_VERTEX_PROGRAM_NV, param, x, y, z, w);
|
||||
}
|
||||
|
||||
|
||||
void arbvp::parameter(unsigned int param, const Color& c)
|
||||
{
|
||||
glx::glProgramEnvParameter4fARB(GL_VERTEX_PROGRAM_ARB, param,
|
||||
glProgramEnvParameter4fARB(GL_VERTEX_PROGRAM_ARB, param,
|
||||
c.red(), c.green(), c.blue(), c.alpha());
|
||||
}
|
||||
|
||||
void arbvp::parameter(unsigned int param, float x, float y, float z, float w)
|
||||
{
|
||||
glx::glProgramEnvParameter4fARB(GL_VERTEX_PROGRAM_ARB, param, x, y, z, w);
|
||||
glProgramEnvParameter4fARB(GL_VERTEX_PROGRAM_ARB, param, x, y, z, w);
|
||||
}
|
||||
|
||||
void arbvp::parameter(unsigned int param, const float* fv)
|
||||
{
|
||||
glx::glProgramEnvParameter4fvARB(GL_VERTEX_PROGRAM_ARB, param, fv);
|
||||
glProgramEnvParameter4fvARB(GL_VERTEX_PROGRAM_ARB, param, fv);
|
||||
}
|
||||
|
||||
|
||||
|
@ -437,19 +437,19 @@ void VertexProcessorNV::disable()
|
|||
|
||||
void VertexProcessorNV::use(unsigned int prog)
|
||||
{
|
||||
glx::glBindProgramNV(GL_VERTEX_PROGRAM_NV, prog);
|
||||
glBindProgramNV(GL_VERTEX_PROGRAM_NV, prog);
|
||||
}
|
||||
|
||||
void VertexProcessorNV::parameter(vp::Parameter param,
|
||||
float x, float y, float z, float w)
|
||||
{
|
||||
glx::glProgramParameter4fNV(GL_VERTEX_PROGRAM_NV,
|
||||
glProgramParameter4fNV(GL_VERTEX_PROGRAM_NV,
|
||||
parameterMappings[param], x, y, z, w);
|
||||
}
|
||||
|
||||
void VertexProcessorNV::parameter(vp::Parameter param, const float* fv)
|
||||
{
|
||||
glx::glProgramParameter4fvNV(GL_VERTEX_PROGRAM_NV,
|
||||
glProgramParameter4fvNV(GL_VERTEX_PROGRAM_NV,
|
||||
parameterMappings[param], fv);
|
||||
}
|
||||
|
||||
|
@ -469,7 +469,7 @@ void VertexProcessorNV::attribArray(unsigned int index,
|
|||
unsigned int stride,
|
||||
const void* ptr)
|
||||
{
|
||||
glx::glVertexAttribPointerNV(index, size, type, stride, ptr);
|
||||
glVertexAttribPointerNV(index, size, type, stride, ptr);
|
||||
}
|
||||
|
||||
|
||||
|
@ -496,28 +496,28 @@ void VertexProcessorARB::disable()
|
|||
|
||||
void VertexProcessorARB::use(unsigned int prog)
|
||||
{
|
||||
glx::glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prog);
|
||||
glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prog);
|
||||
}
|
||||
|
||||
void VertexProcessorARB::parameter(vp::Parameter param,
|
||||
float x, float y, float z, float w)
|
||||
{
|
||||
glx::glProgramEnvParameter4fARB(GL_VERTEX_PROGRAM_ARB, param, x, y, z, w);
|
||||
glProgramEnvParameter4fARB(GL_VERTEX_PROGRAM_ARB, param, x, y, z, w);
|
||||
}
|
||||
|
||||
void VertexProcessorARB::parameter(vp::Parameter param, const float* fv)
|
||||
{
|
||||
glx::glProgramEnvParameter4fvARB(GL_VERTEX_PROGRAM_ARB, param, fv);
|
||||
glProgramEnvParameter4fvARB(GL_VERTEX_PROGRAM_ARB, param, fv);
|
||||
}
|
||||
|
||||
void VertexProcessorARB::enableAttribArray(unsigned int index)
|
||||
{
|
||||
glx::glEnableVertexAttribArrayARB(index);
|
||||
glEnableVertexAttribArrayARB(index);
|
||||
}
|
||||
|
||||
void VertexProcessorARB::disableAttribArray(unsigned int index)
|
||||
{
|
||||
glx::glDisableVertexAttribArrayARB(index);
|
||||
glDisableVertexAttribArrayARB(index);
|
||||
}
|
||||
|
||||
void VertexProcessorARB::attribArray(unsigned int index,
|
||||
|
@ -526,6 +526,6 @@ void VertexProcessorARB::attribArray(unsigned int index,
|
|||
unsigned int stride,
|
||||
const void* ptr)
|
||||
{
|
||||
glx::glVertexAttribPointerARB(index, size, type, GL_FALSE, stride, ptr);
|
||||
glVertexAttribPointerARB(index, size, type, GL_FALSE, stride, ptr);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#ifndef _AVICAPTURE_H_
|
||||
#define _AVICAPTURE_H_
|
||||
|
||||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
#include <vfw.h>
|
||||
#include "moviecapture.h"
|
||||
|
|
|
@ -2004,13 +2004,28 @@ HWND CreateOpenGLWindow(int x, int y, int width, int height,
|
|||
MessageBox(NULL,
|
||||
"Could not get appropriate pixel format for OpenGL rendering.", "Fatal Error",
|
||||
MB_OK | MB_ICONERROR);
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool firstContext = false;
|
||||
if (glContext == NULL)
|
||||
{
|
||||
glContext = wglCreateContext(deviceContext);
|
||||
firstContext = true;
|
||||
}
|
||||
wglMakeCurrent(deviceContext, glContext);
|
||||
|
||||
if (firstContext)
|
||||
{
|
||||
GLenum glewErr = glewInit();
|
||||
if (glewErr != GLEW_OK)
|
||||
{
|
||||
MessageBox(NULL, "Could not set up OpenGL extensions.", "Fatal Error",
|
||||
MB_OK | MB_ICONERROR);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (newMode == 0)
|
||||
SetMenu(hwnd, menuBar);
|
||||
else
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
// of the License, or (at your option) any later version.
|
||||
|
||||
#include "celestiacore.h"
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
void ShowSetTimeDialog(HINSTANCE appInstance, HWND appWindow, CelestiaCore* appCore);
|
||||
|
|
Loading…
Reference in New Issue