mirror of
https://github.com/ioquake/ioq3.git
synced 2024-11-10 07:11:46 +00:00
OpenGL2: Fix issues running under WebGL
This commit is contained in:
parent
980147721a
commit
551fa6c797
5 changed files with 24 additions and 10 deletions
|
@ -80,7 +80,6 @@ extern void (APIENTRYP qglUnlockArraysEXT) (void);
|
||||||
GLE(void, TexParameterf, GLenum target, GLenum pname, GLfloat param) \
|
GLE(void, TexParameterf, GLenum target, GLenum pname, GLfloat param) \
|
||||||
GLE(void, TexParameteri, GLenum target, GLenum pname, GLint param) \
|
GLE(void, TexParameteri, GLenum target, GLenum pname, GLint param) \
|
||||||
GLE(void, TexSubImage2D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels) \
|
GLE(void, TexSubImage2D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels) \
|
||||||
GLE(void, Translatef, GLfloat x, GLfloat y, GLfloat z) \
|
|
||||||
GLE(void, Viewport, GLint x, GLint y, GLsizei width, GLsizei height) \
|
GLE(void, Viewport, GLint x, GLint y, GLsizei width, GLsizei height) \
|
||||||
|
|
||||||
// OpenGL 1.0/1.1 and OpenGL ES 1.x but not OpenGL 3.2 core profile
|
// OpenGL 1.0/1.1 and OpenGL ES 1.x but not OpenGL 3.2 core profile
|
||||||
|
@ -98,6 +97,7 @@ extern void (APIENTRYP qglUnlockArraysEXT) (void);
|
||||||
GLE(void, ShadeModel, GLenum mode) \
|
GLE(void, ShadeModel, GLenum mode) \
|
||||||
GLE(void, TexCoordPointer, GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) \
|
GLE(void, TexCoordPointer, GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) \
|
||||||
GLE(void, TexEnvf, GLenum target, GLenum pname, GLfloat param) \
|
GLE(void, TexEnvf, GLenum target, GLenum pname, GLfloat param) \
|
||||||
|
GLE(void, Translatef, GLfloat x, GLfloat y, GLfloat z) \
|
||||||
GLE(void, VertexPointer, GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) \
|
GLE(void, VertexPointer, GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) \
|
||||||
|
|
||||||
// OpenGL 1.0/1.1 and 3.2 core profile but not OpenGL ES 1.x
|
// OpenGL 1.0/1.1 and 3.2 core profile but not OpenGL ES 1.x
|
||||||
|
|
|
@ -52,10 +52,9 @@ vec4 depthGaussian1D(sampler2D imageMap, sampler2D depthMap, vec2 tex, float zFa
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
float zLimit = 5.0 / zFar;
|
float zLimit = 5.0 / zFar;
|
||||||
int i, j;
|
for (int i = 0; i < 2; i++)
|
||||||
for (i = 0; i < 2; i++)
|
|
||||||
{
|
{
|
||||||
for (j = 1; j < BLUR_SIZE; j++)
|
for (int j = 1; j < BLUR_SIZE; j++)
|
||||||
{
|
{
|
||||||
vec2 offset = direction * (float(j) - 0.25) + nudge;
|
vec2 offset = direction * (float(j) - 0.25) + nudge;
|
||||||
#if defined(USE_DEPTH)
|
#if defined(USE_DEPTH)
|
||||||
|
|
|
@ -77,8 +77,7 @@ float ambientOcclusion(sampler2D depthMap, const vec2 tex, const float zFarDivZN
|
||||||
|
|
||||||
float invZFar = 1.0 / zFar;
|
float invZFar = 1.0 / zFar;
|
||||||
float zLimit = 20.0 * invZFar;
|
float zLimit = 20.0 * invZFar;
|
||||||
int i;
|
for (int i = 0; i < NUM_SAMPLES; i++)
|
||||||
for (i = 0; i < NUM_SAMPLES; i++)
|
|
||||||
{
|
{
|
||||||
vec2 offset = rmat * poissonDisc[i] * offsetScale;
|
vec2 offset = rmat * poissonDisc[i] * offsetScale;
|
||||||
float sampleDiff = getLinearDepth(depthMap, tex + offset, zFarDivZNear) - sampleZ;
|
float sampleDiff = getLinearDepth(depthMap, tex + offset, zFarDivZNear) - sampleZ;
|
||||||
|
|
|
@ -73,12 +73,23 @@ void GLimp_InitExtraExtensions(void)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
extension = "GL_EXT_occlusion_query_boolean";
|
extension = "GL_EXT_occlusion_query_boolean";
|
||||||
if (SDL_GL_ExtensionSupported(extension))
|
if (qglesMajorVersion >= 3 || SDL_GL_ExtensionSupported(extension))
|
||||||
{
|
{
|
||||||
glRefConfig.occlusionQuery = qtrue;
|
glRefConfig.occlusionQuery = qtrue;
|
||||||
glRefConfig.occlusionQueryTarget = GL_ANY_SAMPLES_PASSED;
|
glRefConfig.occlusionQueryTarget = GL_ANY_SAMPLES_PASSED;
|
||||||
|
|
||||||
QGL_ARB_occlusion_query_PROCS;
|
if (qglesMajorVersion >= 3) {
|
||||||
|
QGL_ARB_occlusion_query_PROCS;
|
||||||
|
} else {
|
||||||
|
// GL_EXT_occlusion_query_boolean uses EXT suffix
|
||||||
|
#undef GLE
|
||||||
|
#define GLE(ret, name, ...) qgl##name = (name##proc *) SDL_GL_GetProcAddress("gl" #name "EXT");
|
||||||
|
|
||||||
|
QGL_ARB_occlusion_query_PROCS;
|
||||||
|
|
||||||
|
#undef GLE
|
||||||
|
#define GLE(ret, name, ...) qgl##name = (name##proc *) SDL_GL_GetProcAddress("gl" #name);
|
||||||
|
}
|
||||||
|
|
||||||
ri.Printf(PRINT_ALL, result[glRefConfig.occlusionQuery], extension);
|
ri.Printf(PRINT_ALL, result[glRefConfig.occlusionQuery], extension);
|
||||||
}
|
}
|
||||||
|
@ -137,7 +148,7 @@ void GLimp_InitExtraExtensions(void)
|
||||||
|
|
||||||
// GL_OES_element_index_uint
|
// GL_OES_element_index_uint
|
||||||
extension = "GL_OES_element_index_uint";
|
extension = "GL_OES_element_index_uint";
|
||||||
if (SDL_GL_ExtensionSupported(extension))
|
if (qglesMajorVersion >= 3 || SDL_GL_ExtensionSupported(extension))
|
||||||
{
|
{
|
||||||
glRefConfig.vaoCacheGlIndexType = GL_UNSIGNED_INT;
|
glRefConfig.vaoCacheGlIndexType = GL_UNSIGNED_INT;
|
||||||
glRefConfig.vaoCacheGlIndexSize = sizeof(unsigned int);
|
glRefConfig.vaoCacheGlIndexSize = sizeof(unsigned int);
|
||||||
|
|
|
@ -283,7 +283,12 @@ static void InitOpenGL( void )
|
||||||
glRefConfig.maxVertexAttribs = temp;
|
glRefConfig.maxVertexAttribs = temp;
|
||||||
|
|
||||||
// reserve 160 components for other uniforms
|
// reserve 160 components for other uniforms
|
||||||
qglGetIntegerv( GL_MAX_VERTEX_UNIFORM_COMPONENTS, &temp );
|
if ( qglesMajorVersion ) {
|
||||||
|
qglGetIntegerv( GL_MAX_VERTEX_UNIFORM_VECTORS, &temp );
|
||||||
|
temp *= 4;
|
||||||
|
} else {
|
||||||
|
qglGetIntegerv( GL_MAX_VERTEX_UNIFORM_COMPONENTS, &temp );
|
||||||
|
}
|
||||||
glRefConfig.glslMaxAnimatedBones = Com_Clamp( 0, IQM_MAX_JOINTS, ( temp - 160 ) / 16 );
|
glRefConfig.glslMaxAnimatedBones = Com_Clamp( 0, IQM_MAX_JOINTS, ( temp - 160 ) / 16 );
|
||||||
if ( glRefConfig.glslMaxAnimatedBones < 12 ) {
|
if ( glRefConfig.glslMaxAnimatedBones < 12 ) {
|
||||||
glRefConfig.glslMaxAnimatedBones = 0;
|
glRefConfig.glslMaxAnimatedBones = 0;
|
||||||
|
|
Loading…
Reference in a new issue