summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2013-03-12 17:52:02 +0000
committerTim Angus <tim@ngus.net>2013-03-19 16:41:19 +0000
commit0241b91ba55583d9fcc8d0699da33078d6427264 (patch)
tree09671151c545ec48ae283f43cea3ee06fc9be767 /src
parent12463cdadbb1821f2093aab4ddb88eff94a4bf71 (diff)
Move renderers a bit closer together
Diffstat (limited to 'src')
-rw-r--r--src/renderercommon/qgl.h376
-rw-r--r--src/renderercommon/tr_common.h5
-rw-r--r--src/renderercommon/tr_font.c (renamed from src/renderergl2/tr_font.c)2
-rw-r--r--src/renderergl1/tr_bsp.c3
-rw-r--r--src/renderergl1/tr_font.c555
-rw-r--r--src/renderergl1/tr_image.c233
-rw-r--r--src/renderergl1/tr_local.h32
-rw-r--r--src/renderergl1/tr_shader.c62
-rw-r--r--src/renderergl2/qgl2.h408
-rw-r--r--src/renderergl2/tr_image.c102
-rw-r--r--src/renderergl2/tr_local.h2
11 files changed, 612 insertions, 1168 deletions
diff --git a/src/renderercommon/qgl.h b/src/renderercommon/qgl.h
index 1f30eb54..1a9b7ae0 100644
--- a/src/renderercommon/qgl.h
+++ b/src/renderercommon/qgl.h
@@ -378,4 +378,380 @@ extern void (APIENTRYP qglUnlockArraysEXT) (void);
#define qglVertexPointer glVertexPointer
#define qglViewport glViewport
+// GL_EXT_draw_range_elements
+extern void (APIENTRY * qglDrawRangeElementsEXT) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
+
+// GL_EXT_multi_draw_arrays
+extern void (APIENTRY * qglMultiDrawArraysEXT) (GLenum, GLint *, GLsizei *, GLsizei);
+extern void (APIENTRY * qglMultiDrawElementsEXT) (GLenum, const GLsizei *, GLenum, const GLvoid **, GLsizei);
+
+// GL_ARB_shading_language_100
+#ifndef GL_ARB_shading_language_100
+#define GL_ARB_shading_language_100
+#define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C
+#endif
+
+// GL_ARB_vertex_program
+extern void (APIENTRY * qglVertexAttrib4fARB) (GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
+extern void (APIENTRY * qglVertexAttrib4fvARB) (GLuint, const GLfloat *);
+extern void (APIENTRY * qglVertexAttribPointerARB) (GLuint index, GLint size, GLenum type, GLboolean normalized,
+ GLsizei stride, const GLvoid * pointer);
+extern void (APIENTRY * qglEnableVertexAttribArrayARB) (GLuint index);
+extern void (APIENTRY * qglDisableVertexAttribArrayARB) (GLuint index);
+
+// GL_ARB_vertex_buffer_object
+extern void (APIENTRY * qglBindBufferARB) (GLenum target, GLuint buffer);
+extern void (APIENTRY * qglDeleteBuffersARB) (GLsizei n, const GLuint * buffers);
+extern void (APIENTRY * qglGenBuffersARB) (GLsizei n, GLuint * buffers);
+extern GLboolean(APIENTRY * qglIsBufferARB) (GLuint buffer);
+extern void (APIENTRY * qglBufferDataARB) (GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage);
+extern void (APIENTRY * qglBufferSubDataARB) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data);
+extern void (APIENTRY * qglGetBufferSubDataARB) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid * data);
+extern void (APIENTRY * qglGetBufferParameterivARB) (GLenum target, GLenum pname, GLint * params);
+extern void (APIENTRY * qglGetBufferPointervARB) (GLenum target, GLenum pname, GLvoid * *params);
+
+// GL_ARB_shader_objects
+extern void (APIENTRY * qglDeleteObjectARB) (GLhandleARB obj);
+extern GLhandleARB(APIENTRY * qglGetHandleARB) (GLenum pname);
+extern void (APIENTRY * qglDetachObjectARB) (GLhandleARB containerObj, GLhandleARB attachedObj);
+extern GLhandleARB(APIENTRY * qglCreateShaderObjectARB) (GLenum shaderType);
+extern void (APIENTRY * qglShaderSourceARB) (GLhandleARB shaderObj, GLsizei count, const GLcharARB * *string,
+ const GLint * length);
+extern void (APIENTRY * qglCompileShaderARB) (GLhandleARB shaderObj);
+extern GLhandleARB(APIENTRY * qglCreateProgramObjectARB) (void);
+extern void (APIENTRY * qglAttachObjectARB) (GLhandleARB containerObj, GLhandleARB obj);
+extern void (APIENTRY * qglLinkProgramARB) (GLhandleARB programObj);
+extern void (APIENTRY * qglUseProgramObjectARB) (GLhandleARB programObj);
+extern void (APIENTRY * qglValidateProgramARB) (GLhandleARB programObj);
+extern void (APIENTRY * qglUniform1fARB) (GLint location, GLfloat v0);
+extern void (APIENTRY * qglUniform2fARB) (GLint location, GLfloat v0, GLfloat v1);
+extern void (APIENTRY * qglUniform3fARB) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+extern void (APIENTRY * qglUniform4fARB) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+extern void (APIENTRY * qglUniform1iARB) (GLint location, GLint v0);
+extern void (APIENTRY * qglUniform2iARB) (GLint location, GLint v0, GLint v1);
+extern void (APIENTRY * qglUniform3iARB) (GLint location, GLint v0, GLint v1, GLint v2);
+extern void (APIENTRY * qglUniform4iARB) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+extern void (APIENTRY * qglUniform1fvARB) (GLint location, GLsizei count, const GLfloat * value);
+extern void (APIENTRY * qglUniform2fvARB) (GLint location, GLsizei count, const GLfloat * value);
+extern void (APIENTRY * qglUniform3fvARB) (GLint location, GLsizei count, const GLfloat * value);
+extern void (APIENTRY * qglUniform4fvARB) (GLint location, GLsizei count, const GLfloat * value);
+extern void (APIENTRY * qglUniform2ivARB) (GLint location, GLsizei count, const GLint * value);
+extern void (APIENTRY * qglUniform3ivARB) (GLint location, GLsizei count, const GLint * value);
+extern void (APIENTRY * qglUniform4ivARB) (GLint location, GLsizei count, const GLint * value);
+extern void (APIENTRY * qglUniformMatrix2fvARB) (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
+extern void (APIENTRY * qglUniformMatrix3fvARB) (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
+extern void (APIENTRY * qglUniformMatrix4fvARB) (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
+extern void (APIENTRY * qglGetObjectParameterfvARB) (GLhandleARB obj, GLenum pname, GLfloat * params);
+extern void (APIENTRY * qglGetObjectParameterivARB) (GLhandleARB obj, GLenum pname, GLint * params);
+extern void (APIENTRY * qglGetInfoLogARB) (GLhandleARB obj, GLsizei maxLength, GLsizei * length, GLcharARB * infoLog);
+extern void (APIENTRY * qglGetAttachedObjectsARB) (GLhandleARB containerObj, GLsizei maxCount, GLsizei * count,
+ GLhandleARB * obj);
+extern GLint(APIENTRY * qglGetUniformLocationARB) (GLhandleARB programObj, const GLcharARB * name);
+extern void (APIENTRY * qglGetActiveUniformARB) (GLhandleARB programObj, GLuint index, GLsizei maxIndex, GLsizei * length,
+ GLint * size, GLenum * type, GLcharARB * name);
+extern void (APIENTRY * qglGetUniformfvARB) (GLhandleARB programObj, GLint location, GLfloat * params);
+extern void (APIENTRY * qglGetUniformivARB) (GLhandleARB programObj, GLint location, GLint * params);
+extern void (APIENTRY * qglGetShaderSourceARB) (GLhandleARB obj, GLsizei maxLength, GLsizei * length, GLcharARB * source);
+
+// GL_ARB_vertex_shader
+extern void (APIENTRY * qglBindAttribLocationARB) (GLhandleARB programObj, GLuint index, const GLcharARB * name);
+extern void (APIENTRY * qglGetActiveAttribARB) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei * length,
+ GLint * size, GLenum * type, GLcharARB * name);
+extern GLint(APIENTRY * qglGetAttribLocationARB) (GLhandleARB programObj, const GLcharARB * name);
+
+// GL_ARB_texture_compression
+extern void (APIENTRY * qglCompressedTexImage3DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height,
+ GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
+extern void (APIENTRY * qglCompressedTexImage2DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height,
+ GLint border, GLsizei imageSize, const GLvoid *data);
+extern void (APIENTRY * qglCompressedTexImage1DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border,
+ GLsizei imageSize, const GLvoid *data);
+extern void (APIENTRY * qglCompressedTexSubImage3DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
+ GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
+extern void (APIENTRY * qglCompressedTexSubImage2DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
+ GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
+extern void (APIENTRY * qglCompressedTexSubImage1DARB)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format,
+ GLsizei imageSize, const GLvoid *data);
+extern void (APIENTRY * qglGetCompressedTexImageARB)(GLenum target, GLint lod,
+ GLvoid *img);
+
+// GL_NVX_gpu_memory_info
+#ifndef GL_NVX_gpu_memory_info
+#define GL_NVX_gpu_memory_info
+#define GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX 0x9047
+#define GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX 0x9048
+#define GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX 0x9049
+#define GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX 0x904A
+#define GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX 0x904B
+#endif
+
+// GL_ATI_meminfo
+#ifndef GL_ATI_meminfo
+#define GL_ATI_meminfo
+#define GL_VBO_FREE_MEMORY_ATI 0x87FB
+#define GL_TEXTURE_FREE_MEMORY_ATI 0x87FC
+#define GL_RENDERBUFFER_FREE_MEMORY_ATI 0x87FD
+#endif
+
+// GL_ARB_texture_float
+#ifndef GL_ARB_texture_float
+#define GL_ARB_texture_float
+#define GL_TEXTURE_RED_TYPE_ARB 0x8C10
+#define GL_TEXTURE_GREEN_TYPE_ARB 0x8C11
+#define GL_TEXTURE_BLUE_TYPE_ARB 0x8C12
+#define GL_TEXTURE_ALPHA_TYPE_ARB 0x8C13
+#define GL_TEXTURE_LUMINANCE_TYPE_ARB 0x8C14
+#define GL_TEXTURE_INTENSITY_TYPE_ARB 0x8C15
+#define GL_TEXTURE_DEPTH_TYPE_ARB 0x8C16
+#define GL_UNSIGNED_NORMALIZED_ARB 0x8C17
+#define GL_RGBA32F_ARB 0x8814
+#define GL_RGB32F_ARB 0x8815
+#define GL_ALPHA32F_ARB 0x8816
+#define GL_INTENSITY32F_ARB 0x8817
+#define GL_LUMINANCE32F_ARB 0x8818
+#define GL_LUMINANCE_ALPHA32F_ARB 0x8819
+#define GL_RGBA16F_ARB 0x881A
+#define GL_RGB16F_ARB 0x881B
+#define GL_ALPHA16F_ARB 0x881C
+#define GL_INTENSITY16F_ARB 0x881D
+#define GL_LUMINANCE16F_ARB 0x881E
+#define GL_LUMINANCE_ALPHA16F_ARB 0x881F
+#endif
+
+#ifndef GL_ARB_half_float_pixel
+#define GL_ARB_half_float_pixel
+#define GL_HALF_FLOAT_ARB 0x140B
+#endif
+
+// GL_EXT_framebuffer_object
+extern GLboolean (APIENTRY * qglIsRenderbufferEXT)(GLuint renderbuffer);
+extern void (APIENTRY * qglBindRenderbufferEXT)(GLenum target, GLuint renderbuffer);
+extern void (APIENTRY * qglDeleteRenderbuffersEXT)(GLsizei n, const GLuint *renderbuffers);
+extern void (APIENTRY * qglGenRenderbuffersEXT)(GLsizei n, GLuint *renderbuffers);
+extern void (APIENTRY * qglRenderbufferStorageEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+extern void (APIENTRY * qglGetRenderbufferParameterivEXT)(GLenum target, GLenum pname, GLint *params);
+extern GLboolean (APIENTRY * qglIsFramebufferEXT)(GLuint framebuffer);
+extern void (APIENTRY * qglBindFramebufferEXT)(GLenum target, GLuint framebuffer);
+extern void (APIENTRY * qglDeleteFramebuffersEXT)(GLsizei n, const GLuint *framebuffers);
+extern void (APIENTRY * qglGenFramebuffersEXT)(GLsizei n, GLuint *framebuffers);
+extern GLenum (APIENTRY * qglCheckFramebufferStatusEXT)(GLenum target);
+extern void (APIENTRY * qglFramebufferTexture1DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture,
+ GLint level);
+extern void (APIENTRY * qglFramebufferTexture2DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture,
+ GLint level);
+extern void (APIENTRY * qglFramebufferTexture3DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture,
+ GLint level, GLint zoffset);
+extern void (APIENTRY * qglFramebufferRenderbufferEXT)(GLenum target, GLenum attachment, GLenum renderbuffertarget,
+ GLuint renderbuffer);
+extern void (APIENTRY * qglGetFramebufferAttachmentParameterivEXT)(GLenum target, GLenum attachment, GLenum pname, GLint *params);
+extern void (APIENTRY * qglGenerateMipmapEXT)(GLenum target);
+
+#ifndef GL_EXT_framebuffer_object
+#define GL_EXT_framebuffer_object
+#define GL_FRAMEBUFFER_EXT 0x8D40
+#define GL_RENDERBUFFER_EXT 0x8D41
+#define GL_STENCIL_INDEX1_EXT 0x8D46
+#define GL_STENCIL_INDEX4_EXT 0x8D47
+#define GL_STENCIL_INDEX8_EXT 0x8D48
+#define GL_STENCIL_INDEX16_EXT 0x8D49
+#define GL_RENDERBUFFER_WIDTH_EXT 0x8D42
+#define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43
+#define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44
+#define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50
+#define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51
+#define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52
+#define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53
+#define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54
+#define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4
+#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0
+#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1
+#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2
+#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3
+#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4
+#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5
+#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6
+#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7
+#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8
+#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9
+#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA
+#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB
+#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC
+#define GL_COLOR_ATTACHMENT13_EXT 0x8CED
+#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE
+#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF
+#define GL_DEPTH_ATTACHMENT_EXT 0x8D00
+#define GL_STENCIL_ATTACHMENT_EXT 0x8D20
+#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5
+#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6
+#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7
+#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9
+#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA
+#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB
+#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC
+#define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD
+#define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6
+#define GL_RENDERBUFFER_BINDING_EXT 0x8CA7
+#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF
+#define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8
+#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506
+#endif
+
+// GL_EXT_packed_depth_stencil
+#ifndef GL_EXT_packed_depth_stencil
+#define GL_EXT_packed_depth_stencil
+#define GL_DEPTH_STENCIL_EXT 0x84F9
+#define GL_UNSIGNED_INT_24_8_EXT 0x84FA
+#define GL_DEPTH24_STENCIL8_EXT 0x88F0
+#define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1
+#endif
+
+// GL_ARB_occlusion_query
+extern void (APIENTRY * qglGenQueriesARB)(GLsizei n, GLuint *ids);
+extern void (APIENTRY * qglDeleteQueriesARB)(GLsizei n, const GLuint *ids);
+extern GLboolean (APIENTRY * qglIsQueryARB)(GLuint id);
+extern void (APIENTRY * qglBeginQueryARB)(GLenum target, GLuint id);
+extern void (APIENTRY * qglEndQueryARB)(GLenum target);
+extern void (APIENTRY * qglGetQueryivARB)(GLenum target, GLenum pname, GLint *params);
+extern void (APIENTRY * qglGetQueryObjectivARB)(GLuint id, GLenum pname, GLint *params);
+extern void (APIENTRY * qglGetQueryObjectuivARB)(GLuint id, GLenum pname, GLuint *params);
+
+#ifndef GL_ARB_occlusion_query
+#define GL_ARB_occlusion_query
+#define GL_SAMPLES_PASSED_ARB 0x8914
+#define GL_QUERY_COUNTER_BITS_ARB 0x8864
+#define GL_CURRENT_QUERY_ARB 0x8865
+#define GL_QUERY_RESULT_ARB 0x8866
+#define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867
+#endif
+
+// GL_EXT_framebuffer_blit
+extern void (APIENTRY * qglBlitFramebufferEXT)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
+ GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
+ GLbitfield mask, GLenum filter);
+
+#ifndef GL_EXT_framebuffer_blit
+#define GL_EXT_framebuffer_blit
+#define GL_READ_FRAMEBUFFER_EXT 0x8CA8
+#define GL_DRAW_FRAMEBUFFER_EXT 0x8CA9
+#define GL_DRAW_FRAMEBUFFER_BINDING_EXT 0x8CA6
+#define GL_READ_FRAMEBUFFER_BINDING_EXT 0x8CAA
+#endif
+
+// GL_EXT_framebuffer_multisample
+extern void (APIENTRY * qglRenderbufferStorageMultisampleEXT)(GLenum target, GLsizei samples,
+ GLenum internalformat, GLsizei width, GLsizei height);
+
+#ifndef GL_EXT_framebuffer_multisample
+#define GL_EXT_framebuffer_multisample
+#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56
+#define GL_MAX_SAMPLES_EXT 0x8D57
+#endif
+
+#ifndef GL_EXT_texture_sRGB
+#define GL_EXT_texture_sRGB
+#define GL_SRGB_EXT 0x8C40
+#define GL_SRGB8_EXT 0x8C41
+#define GL_SRGB_ALPHA_EXT 0x8C42
+#define GL_SRGB8_ALPHA8_EXT 0x8C43
+#define GL_SLUMINANCE_ALPHA_EXT 0x8C44
+#define GL_SLUMINANCE8_ALPHA8_EXT 0x8C45
+#define GL_SLUMINANCE_EXT 0x8C46
+#define GL_SLUMINANCE8_EXT 0x8C47
+#define GL_COMPRESSED_SRGB_EXT 0x8C48
+#define GL_COMPRESSED_SRGB_ALPHA_EXT 0x8C49
+#define GL_COMPRESSED_SLUMINANCE_EXT 0x8C4A
+#define GL_COMPRESSED_SLUMINANCE_ALPHA_EXT 0x8C4B
+#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C
+#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D
+#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E
+#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F
+#endif
+
+#ifndef GL_EXT_framebuffer_sRGB
+#define GL_EXT_framebuffer_sRGB
+#define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9
+#endif
+
+#ifndef GL_EXT_texture_compression_latc
+#define GL_EXT_texture_compression_latc
+#define GL_COMPRESSED_LUMINANCE_LATC1_EXT 0x8C70
+#define GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT 0x8C71
+#define GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT 0x8C72
+#define GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT 0x8C73
+#endif
+
+#ifndef GL_ARB_texture_compression_bptc
+#define GL_ARB_texture_compression_bptc
+#define GL_COMPRESSED_RGBA_BPTC_UNORM_ARB 0x8E8C
+#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB 0x8E8D
+#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB 0x8E8E
+#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB 0x8E8F
+#endif
+
+// GL_ARB_draw_buffers
+extern void (APIENTRY * qglDrawBuffersARB)(GLsizei n, const GLenum *bufs);
+#ifndef GL_ARB_draw_buffers
+#define GL_ARB_draw_buffers
+#define GL_MAX_DRAW_BUFFERS_ARB 0x8824
+#define GL_DRAW_BUFFER0_ARB 0x8825
+#define GL_DRAW_BUFFER1_ARB 0x8826
+#define GL_DRAW_BUFFER2_ARB 0x8827
+#define GL_DRAW_BUFFER3_ARB 0x8828
+#define GL_DRAW_BUFFER4_ARB 0x8829
+#define GL_DRAW_BUFFER5_ARB 0x882A
+#define GL_DRAW_BUFFER6_ARB 0x882B
+#define GL_DRAW_BUFFER7_ARB 0x882C
+#define GL_DRAW_BUFFER8_ARB 0x882D
+#define GL_DRAW_BUFFER9_ARB 0x882E
+#define GL_DRAW_BUFFER10_ARB 0x882F
+#define GL_DRAW_BUFFER11_ARB 0x8830
+#define GL_DRAW_BUFFER12_ARB 0x8831
+#define GL_DRAW_BUFFER13_ARB 0x8832
+#define GL_DRAW_BUFFER14_ARB 0x8833
+#define GL_DRAW_BUFFER15_ARB 0x8834
+#endif
+
+#ifndef GL_ARB_depth_clamp
+#define GL_ARB_depth_clamp
+#define GL_DEPTH_CLAMP 0x864F
+#endif
+
+#if defined(WIN32)
+// WGL_ARB_create_context
+#ifndef WGL_ARB_create_context
+#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
+#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
+#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093
+#define WGL_CONTEXT_FLAGS_ARB 0x2094
+#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
+#define WGL_CONTEXT_DEBUG_BIT_ARB 0x0001
+#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002
+#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
+#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
+#define ERROR_INVALID_VERSION_ARB 0x2095
+#define ERROR_INVALID_PROFILE_ARB 0x2096
+#endif
+
+extern HGLRC(APIENTRY * qwglCreateContextAttribsARB) (HDC hdC, HGLRC hShareContext, const int *attribList);
+#endif
+
+#if 0 //defined(__linux__)
+// GLX_ARB_create_context
+#ifndef GLX_ARB_create_context
+#define GLX_CONTEXT_DEBUG_BIT_ARB 0x00000001
+#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
+#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091
+#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092
+#define GLX_CONTEXT_FLAGS_ARB 0x2094
+#endif
+
+extern GLXContext (APIENTRY * qglXCreateContextAttribsARB) (Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list);
+#endif
+
#endif
diff --git a/src/renderercommon/tr_common.h b/src/renderercommon/tr_common.h
index 4bca7e4e..5c0e4dd5 100644
--- a/src/renderercommon/tr_common.h
+++ b/src/renderercommon/tr_common.h
@@ -24,8 +24,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define TR_COMMON_H
#include "../qcommon/q_shared.h"
-/*#include "../qcommon/qfiles.h"*/
-/*#include "../qcommon/qcommon.h"*/
#include "../renderercommon/tr_public.h"
#include "qgl.h"
@@ -70,6 +68,9 @@ qboolean R_GetModeInfo( int *width, int *height, float *windowAspect, int mode )
float R_NoiseGet4f( float x, float y, float z, float t );
void R_NoiseInit( void );
+void R_IssuePendingRenderCommands( void );
+qhandle_t RE_RegisterShaderNoMip( const char *name );
+
/*
====================================================================
diff --git a/src/renderergl2/tr_font.c b/src/renderercommon/tr_font.c
index c6034fc5..fed37088 100644
--- a/src/renderergl2/tr_font.c
+++ b/src/renderercommon/tr_font.c
@@ -69,7 +69,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// uncheck the exclude from build check box in the FreeType2 area of the Renderer project.
-#include "tr_local.h"
+#include "tr_common.h"
#include "../qcommon/qcommon.h"
#ifdef BUILD_FREETYPE
diff --git a/src/renderergl1/tr_bsp.c b/src/renderergl1/tr_bsp.c
index 0200011f..bccc2ba2 100644
--- a/src/renderergl1/tr_bsp.c
+++ b/src/renderergl1/tr_bsp.c
@@ -204,7 +204,8 @@ static void R_LoadLightmaps( lump_t *l ) {
}
}
tr.lightmaps[i] = R_CreateImage( va("*lightmap%d",i), image,
- LIGHTMAP_SIZE, LIGHTMAP_SIZE, qfalse, qfalse, GL_CLAMP_TO_EDGE );
+ LIGHTMAP_SIZE, LIGHTMAP_SIZE, IMGTYPE_COLORALPHA,
+ IMGFLAG_NOLIGHTSCALE | IMGFLAG_NO_COMPRESSION | IMGFLAG_CLAMPTOEDGE, 0 );
}
if ( r_lightmap->integer == 2 ) {
diff --git a/src/renderergl1/tr_font.c b/src/renderergl1/tr_font.c
deleted file mode 100644
index 882d898a..00000000
--- a/src/renderergl1/tr_font.c
+++ /dev/null
@@ -1,555 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2013 Darklegion Development
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-// tr_font.c
-//
-//
-// The font system uses FreeType 2.x to render TrueType fonts for use within the game.
-// As of this writing ( Nov, 2000 ) Team Arena uses these fonts for all of the ui and
-// about 90% of the cgame presentation. A few areas of the CGAME were left uses the old
-// fonts since the code is shared with standard Q3A.
-//
-// If you include this font rendering code in a commercial product you MUST include the
-// following somewhere with your product, see www.freetype.org for specifics or changes.
-// The Freetype code also uses some hinting techniques that MIGHT infringe on patents
-// held by apple so be aware of that also.
-//
-// As of Q3A 1.25+ and Team Arena, we are shipping the game with the font rendering code
-// disabled. This removes any potential patent issues and it keeps us from having to
-// distribute an actual TrueTrype font which is 1. expensive to do and 2. seems to require
-// an act of god to accomplish.
-//
-// What we did was pre-render the fonts using FreeType ( which is why we leave the FreeType
-// credit in the credits ) and then saved off the glyph data and then hand touched up the
-// font bitmaps so they scale a bit better in GL.
-//
-// There are limitations in the way fonts are saved and reloaded in that it is based on
-// point size and not name. So if you pre-render Helvetica in 18 point and Impact in 18 point
-// you will end up with a single 18 point data file and image set. Typically you will want to
-// choose 3 sizes to best approximate the scaling you will be doing in the ui scripting system
-//
-// In the UI Scripting code, a scale of 1.0 is equal to a 48 point font. In Team Arena, we
-// use three or four scales, most of them exactly equaling the specific rendered size. We
-// rendered three sizes in Team Arena, 12, 16, and 20.
-//
-// To generate new font data you need to go through the following steps.
-// 1. delete the fontImage_x_xx.tga files and fontImage_xx.dat files from the fonts path.
-// 2. in a ui script, specificy a font, smallFont, and bigFont keyword with font name and
-// point size. the original TrueType fonts must exist in fonts at this point.
-// 3. run the game, you should see things normally.
-// 4. Exit the game and there will be three dat files and at least three tga files. The
-// tga's are in 256x256 pages so if it takes three images to render a 24 point font you
-// will end up with fontImage_0_24.tga through fontImage_2_24.tga
-// 5. In future runs of the game, the system looks for these images and data files when a s
-// specific point sized font is rendered and loads them for use.
-// 6. Because of the original beta nature of the FreeType code you will probably want to hand
-// touch the font bitmaps.
-//
-// Currently a define in the project turns on or off the FreeType code which is currently
-// defined out. To pre-render new fonts you need enable the define ( BUILD_FREETYPE ) and
-// uncheck the exclude from build check box in the FreeType2 area of the Renderer project.
-
-
-#include "tr_local.h"
-#include "../qcommon/qcommon.h"
-
-#ifdef BUILD_FREETYPE
-#include <ft2build.h>
-#include FT_ERRORS_H
-#include FT_SYSTEM_H
-#include FT_IMAGE_H
-#include FT_FREETYPE_H
-#include FT_OUTLINE_H
-
-#define _FLOOR(x) ((x) & -64)
-#define _CEIL(x) (((x)+63) & -64)
-#define _TRUNC(x) ((x) >> 6)
-
-FT_Library ftLibrary = NULL;
-#endif
-
-#define MAX_FONTS 6
-static int registeredFontCount = 0;
-static fontInfo_t registeredFont[MAX_FONTS];
-
-#ifdef BUILD_FREETYPE
-void R_GetGlyphInfo(FT_GlyphSlot glyph, int *left, int *right, int *width, int *top, int *bottom, int *height, int *pitch) {
- *left = _FLOOR( glyph->metrics.horiBearingX );
- *right = _CEIL( glyph->metrics.horiBearingX + glyph->metrics.width );
- *width = _TRUNC(*right - *left);
-
- *top = _CEIL( glyph->metrics.horiBearingY );
- *bottom = _FLOOR( glyph->metrics.horiBearingY - glyph->metrics.height );
- *height = _TRUNC( *top - *bottom );
- *pitch = ( qtrue ? (*width+3) & -4 : (*width+7) >> 3 );
-}
-
-
-FT_Bitmap *R_RenderGlyph(FT_GlyphSlot glyph, glyphInfo_t* glyphOut) {
- FT_Bitmap *bit2;
- int left, right, width, top, bottom, height, pitch, size;
-
- R_GetGlyphInfo(glyph, &left, &right, &width, &top, &bottom, &height, &pitch);
-
- if ( glyph->format == ft_glyph_format_outline ) {
- size = pitch*height;
-
- bit2 = ri.Malloc(sizeof(FT_Bitmap));
-
- bit2->width = width;
- bit2->rows = height;
- bit2->pitch = pitch;
- bit2->pixel_mode = ft_pixel_mode_grays;
- //bit2->pixel_mode = ft_pixel_mode_mono;
- bit2->buffer = ri.Malloc(pitch*height);
- bit2->num_grays = 256;
-
- Com_Memset( bit2->buffer, 0, size );
-
- FT_Outline_Translate( &glyph->outline, -left, -bottom );
-
- FT_Outline_Get_Bitmap( ftLibrary, &glyph->outline, bit2 );
-
- glyphOut->height = height;
- glyphOut->pitch = pitch;
- glyphOut->top = (glyph->metrics.horiBearingY >> 6) + 1;
- glyphOut->bottom = bottom;
-
- return bit2;
- } else {
- ri.Printf(PRINT_ALL, "Non-outline fonts are not supported\n");
- }
- return NULL;
-}
-
-void WriteTGA (char *filename, byte *data, int width, int height) {
- byte *buffer;
- int i, c;
- int row;
- unsigned char *flip;
- unsigned char *src, *dst;
-
- buffer = ri.Malloc(width*height*4 + 18);
- Com_Memset (buffer, 0, 18);
- buffer[2] = 2; // uncompressed type
- buffer[12] = width&255;
- buffer[13] = width>>8;
- buffer[14] = height&255;
- buffer[15] = height>>8;
- buffer[16] = 32; // pixel size
-
- // swap rgb to bgr
- c = 18 + width * height * 4;
- for (i=18 ; i<c ; i+=4)
- {
- buffer[i] = data[i-18+2]; // blue
- buffer[i+1] = data[i-18+1]; // green
- buffer[i+2] = data[i-18+0]; // red
- buffer[i+3] = data[i-18+3]; // alpha
- }
-
- // flip upside down
- flip = (unsigned char *)ri.Malloc(width*4);
- for(row = 0; row < height/2; row++)
- {
- src = buffer + 18 + row * 4 * width;
- dst = buffer + 18 + (height - row - 1) * 4 * width;
-
- Com_Memcpy(flip, src, width*4);
- Com_Memcpy(src, dst, width*4);
- Com_Memcpy(dst, flip, width*4);
- }
- ri.Free(flip);
-
- ri.FS_WriteFile(filename, buffer, c);
-
- //f = fopen (filename, "wb");
- //fwrite (buffer, 1, c, f);
- //fclose (f);
-
- ri.Free (buffer);
-}
-
-static glyphInfo_t *RE_ConstructGlyphInfo(unsigned char *imageOut, int *xOut, int *yOut, int *maxHeight, FT_Face face, const unsigned char c, qboolean calcHeight) {
- int i;
- static glyphInfo_t glyph;
- unsigned char *src, *dst;
- float scaled_width, scaled_height;
- FT_Bitmap *bitmap = NULL;
-
- Com_Memset(&glyph, 0, sizeof(glyphInfo_t));
- // make sure everything is here
- if (face != NULL) {
- FT_Load_Glyph(face, FT_Get_Char_Index( face, c), FT_LOAD_DEFAULT );
- bitmap = R_RenderGlyph(face->glyph, &glyph);
- if (bitmap) {
- glyph.xSkip = (face->glyph->metrics.horiAdvance >> 6) + 1;
- } else {
- return &glyph;
- }
-
- if (glyph.height > *maxHeight) {
- *maxHeight = glyph.height;
- }
-
- if (calcHeight) {
- ri.Free(bitmap->buffer);
- ri.Free(bitmap);
- return &glyph;
- }
-
-/*
- // need to convert to power of 2 sizes so we do not get
- // any scaling from the gl upload
- for (scaled_width = 1 ; scaled_width < glyph.pitch ; scaled_width<<=1)
- ;
- for (scaled_height = 1 ; scaled_height < glyph.height ; scaled_height<<=1)
- ;
-*/
-
- scaled_width = glyph.pitch;
- scaled_height = glyph.height;
-
- // we need to make sure we fit
- if (*xOut + scaled_width + 1 >= 255) {
- *xOut = 0;
- *yOut += *maxHeight + 1;
- }
-
- if (*yOut + *maxHeight + 1 >= 255) {
- *yOut = -1;
- *xOut = -1;
- ri.Free(bitmap->buffer);
- ri.Free(bitmap);
- return &glyph;
- }
-
-
- src = bitmap->buffer;
- dst = imageOut + (*yOut * 256) + *xOut;
-
- if (bitmap->pixel_mode == ft_pixel_mode_mono) {
- for (i = 0; i < glyph.height; i++) {
- int j;
- unsigned char *_src = src;
- unsigned char *_dst = dst;
- unsigned char mask = 0x80;
- unsigned char val = *_src;
- for (j = 0; j < glyph.pitch; j++) {
- if (mask == 0x80) {
- val = *_src++;
- }
- if (val & mask) {
- *_dst = 0xff;
- }
- mask >>= 1;
-
- if ( mask == 0 ) {
- mask = 0x80;
- }
- _dst++;
- }
-
- src += glyph.pitch;
- dst += 256;
- }
- } else {
- for (i = 0; i < glyph.height; i++) {
- Com_Memcpy(dst, src, glyph.pitch);
- src += glyph.pitch;
- dst += 256;
- }
- }
-
- // we now have an 8 bit per pixel grey scale bitmap
- // that is width wide and pf->ftSize->metrics.y_ppem tall
-
- glyph.imageHeight = scaled_height;
- glyph.imageWidth = scaled_width;
- glyph.s = (float)*xOut / 256;
- glyph.t = (float)*yOut / 256;
- glyph.s2 = glyph.s + (float)scaled_width / 256;
- glyph.t2 = glyph.t + (float)scaled_height / 256;
-
- *xOut += scaled_width + 1;
-
- ri.Free(bitmap->buffer);
- ri.Free(bitmap);
- }
-
- return &glyph;
-}
-#endif
-
-static int fdOffset;
-static byte *fdFile;
-
-int readInt( void ) {
- int i = fdFile[fdOffset]+(fdFile[fdOffset+1]<<8)+(fdFile[fdOffset+2]<<16)+(fdFile[fdOffset+3]<<24);
- fdOffset += 4;
- return i;
-}
-
-typedef union {
- byte fred[4];
- float ffred;
-} poor;
-
-float readFloat( void ) {
- poor me;
-#if defined Q3_BIG_ENDIAN
- me.fred[0] = fdFile[fdOffset+3];
- me.fred[1] = fdFile[fdOffset+2];
- me.fred[2] = fdFile[fdOffset+1];
- me.fred[3] = fdFile[fdOffset+0];
-#elif defined Q3_LITTLE_ENDIAN
- me.fred[0] = fdFile[fdOffset+0];
- me.fred[1] = fdFile[fdOffset+1];
- me.fred[2] = fdFile[fdOffset+2];
- me.fred[3] = fdFile[fdOffset+3];
-#endif
- fdOffset += 4;
- return me.ffred;
-}
-
-void RE_RegisterFont(const char *fontName, int pointSize, fontInfo_t *font) {
-#ifdef BUILD_FREETYPE
- FT_Face face;
- int j, k, xOut, yOut, lastStart, imageNumber;
- int scaledSize, newSize, maxHeight, left;
- unsigned char *out, *imageBuff;
- glyphInfo_t *glyph;
- image_t *image;
- qhandle_t h;
- float max;
- float dpi = 72;
- float glyphScale;
-#endif
- void *faceData;
- int i, len;
- char name[1024];
-
- if (!fontName) {
- ri.Printf(PRINT_ALL, "RE_RegisterFont: called with empty name\n");
- return;
- }
-
- if (pointSize <= 0) {
- pointSize = 12;
- }
-
- R_IssuePendingRenderCommands();
-
- if (registeredFontCount >= MAX_FONTS) {
- ri.Printf(PRINT_WARNING, "RE_RegisterFont: Too many fonts registered already.\n");
- return;
- }
-
- Com_sprintf(name, sizeof(name), "fonts/fontImage_%i.dat",pointSize);
- for (i = 0; i < registeredFontCount; i++) {
- if (Q_stricmp(name, registeredFont[i].name) == 0) {
- Com_Memcpy(font, &registeredFont[i], sizeof(fontInfo_t));
- return;
- }
- }
-
- len = ri.FS_ReadFile(name, NULL);
- if (len == sizeof(fontInfo_t)) {
- ri.FS_ReadFile(name, &faceData);
- fdOffset = 0;
- fdFile = faceData;
- for(i=0; i<GLYPHS_PER_FONT; i++) {
- font->glyphs[i].height = readInt();
- font->glyphs[i].top = readInt();
- font->glyphs[i].bottom = readInt();
- font->glyphs[i].pitch = readInt();
- font->glyphs[i].xSkip = readInt();
- font->glyphs[i].imageWidth = readInt();
- font->glyphs[i].imageHeight = readInt();
- font->glyphs[i].s = readFloat();
- font->glyphs[i].t = readFloat();
- font->glyphs[i].s2 = readFloat();
- font->glyphs[i].t2 = readFloat();
- font->glyphs[i].glyph = readInt();
- Q_strncpyz(font->glyphs[i].shaderName, (const char *)&fdFile[fdOffset], sizeof(font->glyphs[i].shaderName));
- fdOffset += sizeof(font->glyphs[i].shaderName);
- }
- font->glyphScale = readFloat();
- Com_Memcpy(font->name, &fdFile[fdOffset], MAX_QPATH);
-
-// Com_Memcpy(font, faceData, sizeof(fontInfo_t));
- Q_strncpyz(font->name, name, sizeof(font->name));
- for (i = GLYPH_START; i < GLYPH_END; i++) {
- font->glyphs[i].glyph = RE_RegisterShaderNoMip(font->glyphs[i].shaderName);
- }
- Com_Memcpy(&registeredFont[registeredFontCount++], font, sizeof(fontInfo_t));
- return;
- }
-
-#ifndef BUILD_FREETYPE
- ri.Printf(PRINT_WARNING, "RE_RegisterFont: FreeType code not available\n");
-#else
- if (ftLibrary == NULL) {
- ri.Printf(PRINT_WARNING, "RE_RegisterFont: FreeType not initialized.\n");
- return;
- }
-
- len = ri.FS_ReadFile(fontName, &faceData);
- if (len <= 0) {
- ri.Printf(PRINT_WARNING, "RE_RegisterFont: Unable to read font file '%s'\n", fontName);
- return;
- }
-
- // allocate on the stack first in case we fail
- if (FT_New_Memory_Face( ftLibrary, faceData, len, 0, &face )) {
- ri.Printf(PRINT_WARNING, "RE_RegisterFont: FreeType, unable to allocate new face.\n");
- return;
- }
-
-
- if (FT_Set_Char_Size( face, pointSize << 6, pointSize << 6, dpi, dpi)) {
- ri.Printf(PRINT_WARNING, "RE_RegisterFont: FreeType, unable to set face char size.\n");
- return;
- }
-
- //*font = &registeredFonts[registeredFontCount++];
-
- // make a 256x256 image buffer, once it is full, register it, clean it and keep going
- // until all glyphs are rendered
-
- out = ri.Malloc(1024*1024);
- if (out == NULL) {
- ri.Printf(PRINT_WARNING, "RE_RegisterFont: ri.Malloc failure during output image creation.\n");
- return;
- }
- Com_Memset(out, 0, 1024*1024);
-
- maxHeight = 0;
-
- for (i = GLYPH_START; i < GLYPH_END; i++) {
- RE_ConstructGlyphInfo(out, &xOut, &yOut, &maxHeight, face, (unsigned char)i, qtrue);
- }
-
- xOut = 0;
- yOut = 0;
- i = GLYPH_START;
- lastStart = i;
- imageNumber = 0;
-
- while ( i <= GLYPH_END ) {
-
- glyph = RE_ConstructGlyphInfo(out, &xOut, &yOut, &maxHeight, face, (unsigned char)i, qfalse);
-
- if (xOut == -1 || yOut == -1 || i == GLYPH_END) {
- // ran out of room
- // we need to create an image from the bitmap, set all the handles in the glyphs to this point
- //
-
- scaledSize = 256*256;
- newSize = scaledSize * 4;
- imageBuff = ri.Malloc(newSize);
- left = 0;
- max = 0;
- for ( k = 0; k < (scaledSize) ; k++ ) {
- if (max < out[k]) {
- max = out[k];
- }
- }
-
- if (max > 0) {
- max = 255/max;
- }
-
- for ( k = 0; k < (scaledSize) ; k++ ) {
- imageBuff[left++] = 255;
- imageBuff[left++] = 255;
- imageBuff[left++] = 255;
-
- imageBuff[left++] = ((float)out[k] * max);
- }
-
- Com_sprintf (name, sizeof(name), "fonts/fontImage_%i_%i.tga", imageNumber++, pointSize);
- if (r_saveFontData->integer) {
- WriteTGA(name, imageBuff, 256, 256);
- }
-
- //Com_sprintf (name, sizeof(name), "fonts/fontImage_%i_%i", imageNumber++, pointSize);
- image = R_CreateImage(name, imageBuff, 256, 256, qfalse, qfalse, GL_CLAMP_TO_EDGE);
- h = RE_RegisterShaderFromImage(name, LIGHTMAP_2D, image, qfalse);
- for (j = lastStart; j < i; j++) {
- font->glyphs[j].glyph = h;
- Q_strncpyz(font->glyphs[j].shaderName, name, sizeof(font->glyphs[j].shaderName));
- }
- lastStart = i;
- Com_Memset(out, 0, 1024*1024);
- xOut = 0;
- yOut = 0;
- ri.Free(imageBuff);
- i++;
- } else {
- Com_Memcpy(&font->glyphs[i], glyph, sizeof(glyphInfo_t));
- i++;
- }
- }
-
- // change the scale to be relative to 1 based on 72 dpi ( so dpi of 144 means a scale of .5 )
- glyphScale = 72.0f / dpi;
-
- // we also need to adjust the scale based on point size relative to 48 points as the ui scaling is based on a 48 point font
- glyphScale *= 48.0f / pointSize;
-
- registeredFont[registeredFontCount].glyphScale = glyphScale;
- font->glyphScale = glyphScale;
- Com_Memcpy(&registeredFont[registeredFontCount++], font, sizeof(fontInfo_t));
-
- if (r_saveFontData->integer) {
- ri.FS_WriteFile(va("fonts/fontImage_%i.dat", pointSize), font, sizeof(fontInfo_t));
- }
-
- ri.Free(out);
-
- ri.FS_FreeFile(faceData);
-#endif
-}
-
-
-
-void R_InitFreeType(void) {
-#ifdef BUILD_FREETYPE
- if (FT_Init_FreeType( &ftLibrary )) {
- ri.Printf(PRINT_WARNING, "R_InitFreeType: Unable to initialize FreeType.\n");
- }
-#endif
- registeredFontCount = 0;
-}
-
-
-void R_DoneFreeType(void) {
-#ifdef BUILD_FREETYPE
- if (ftLibrary) {
- FT_Done_FreeType( ftLibrary );
- ftLibrary = NULL;
- }
-#endif
- registeredFontCount = 0;
-}
-
diff --git a/src/renderergl1/tr_image.c b/src/renderergl1/tr_image.c
index e69e2d09..082936a7 100644
--- a/src/renderergl1/tr_image.c
+++ b/src/renderergl1/tr_image.c
@@ -114,7 +114,7 @@ void GL_TextureMode( const char *string ) {
// change all the existing mipmap texture objects
for ( i = 0 ; i < tr.numImages ; i++ ) {
glt = tr.images[ i ];
- if ( glt->mipmap ) {
+ if ( glt->flags & IMGFLAG_MIPMAP ) {
GL_Bind (glt);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
@@ -147,71 +147,141 @@ R_ImageList_f
===============
*/
void R_ImageList_f( void ) {
- int i;
- image_t *image;
- int texels;
- const char *yesno[] = {
- "no ", "yes"
- };
+ int i;
+ int estTotalSize = 0;
- ri.Printf (PRINT_ALL, "\n -w-- -h-- -mm- -TMU- -if-- wrap --name-------\n");
- texels = 0;
+ ri.Printf(PRINT_ALL, "\n -w-- -h-- type -size- --name-------\n");
- for ( i = 0 ; i < tr.numImages ; i++ ) {
- image = tr.images[ i ];
-
- texels += image->uploadWidth*image->uploadHeight;
- ri.Printf (PRINT_ALL, "%4i: %4i %4i %s %d ",
- i, image->uploadWidth, image->uploadHeight, yesno[image->mipmap], image->TMU );
- switch ( image->internalFormat ) {
- case 1:
- ri.Printf( PRINT_ALL, "I " );
- break;
- case 2:
- ri.Printf( PRINT_ALL, "IA " );
- break;
- case 3:
- ri.Printf( PRINT_ALL, "RGB " );
- break;
- case 4:
- ri.Printf( PRINT_ALL, "RGBA " );
- break;
- case GL_RGBA8:
- ri.Printf( PRINT_ALL, "RGBA8" );
- break;
- case GL_RGB8:
- ri.Printf( PRINT_ALL, "RGB8" );
- break;
- case GL_RGB4_S3TC:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- ri.Printf( PRINT_ALL, "S3TC " );
- break;
- case GL_RGBA4:
- ri.Printf( PRINT_ALL, "RGBA4" );
- break;
- case GL_RGB5:
- ri.Printf( PRINT_ALL, "RGB5 " );
- break;
- default:
- ri.Printf( PRINT_ALL, "???? " );
+ for ( i = 0 ; i < tr.numImages ; i++ )
+ {
+ image_t *image = tr.images[i];
+ char *format = "???? ";
+ char *sizeSuffix;
+ int estSize;
+ int displaySize;
+
+ estSize = image->uploadHeight * image->uploadWidth;
+
+ switch(image->internalFormat)
+ {
+ case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
+ format = "sDXT1";
+ // 64 bits per 16 pixels, so 4 bits per pixel
+ estSize /= 2;
+ break;
+ case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
+ format = "sDXT5";
+ // 128 bits per 16 pixels, so 1 byte per pixel
+ break;
+ case GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB:
+ format = "sBPTC";
+ // 128 bits per 16 pixels, so 1 byte per pixel
+ break;
+ case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT:
+ format = "LATC ";
+ // 128 bits per 16 pixels, so 1 byte per pixel
+ break;
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ format = "DXT1 ";
+ // 64 bits per 16 pixels, so 4 bits per pixel
+ estSize /= 2;
+ break;
+ case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
+ format = "DXT5 ";
+ // 128 bits per 16 pixels, so 1 byte per pixel
+ break;
+ case GL_COMPRESSED_RGBA_BPTC_UNORM_ARB:
+ format = "BPTC ";
+ // 128 bits per 16 pixels, so 1 byte per pixel
+ break;
+ case GL_RGB4_S3TC:
+ format = "S3TC ";
+ // same as DXT1?
+ estSize /= 2;
+ break;
+ case GL_RGBA4:
+ case GL_RGBA8:
+ case GL_RGBA:
+ format = "RGBA ";
+ // 4 bytes per pixel
+ estSize *= 4;
+ break;
+ case GL_LUMINANCE8:
+ case GL_LUMINANCE16:
+ case GL_LUMINANCE:
+ format = "L ";
+ // 1 byte per pixel?
+ break;
+ case GL_RGB5:
+ case GL_RGB8:
+ case GL_RGB:
+ format = "RGB ";
+ // 3 bytes per pixel?
+ estSize *= 3;
+ break;
+ case GL_LUMINANCE8_ALPHA8:
+ case GL_LUMINANCE16_ALPHA16:
+ case GL_LUMINANCE_ALPHA:
+ format = "LA ";
+ // 2 bytes per pixel?
+ estSize *= 2;
+ break;
+ case GL_SRGB_EXT:
+ case GL_SRGB8_EXT:
+ format = "sRGB ";
+ // 3 bytes per pixel?
+ estSize *= 3;
+ break;
+ case GL_SRGB_ALPHA_EXT:
+ case GL_SRGB8_ALPHA8_EXT:
+ format = "sRGBA";
+ // 4 bytes per pixel?
+ estSize *= 4;
+ break;
+ case GL_SLUMINANCE_EXT:
+ case GL_SLUMINANCE8_EXT:
+ format = "sL ";
+ // 1 byte per pixel?
+ break;
+ case GL_SLUMINANCE_ALPHA_EXT:
+ case GL_SLUMINANCE8_ALPHA8_EXT:
+ format = "sLA ";
+ // 2 byte per pixel?
+ estSize *= 2;
+ break;
}
- switch ( image->wrapClampMode ) {
- case GL_REPEAT:
- ri.Printf( PRINT_ALL, "rept " );
- break;
- case GL_CLAMP_TO_EDGE:
- ri.Printf( PRINT_ALL, "clmp " );
- break;
- default:
- ri.Printf( PRINT_ALL, "%4i ", image->wrapClampMode );
- break;
+ // mipmap adds about 50%
+ if (image->flags & IMGFLAG_MIPMAP)
+ estSize += estSize / 2;
+
+ sizeSuffix = "b ";
+ displaySize = estSize;
+
+ if (displaySize > 1024)
+ {
+ displaySize /= 1024;
+ sizeSuffix = "kb";
}
-
- ri.Printf( PRINT_ALL, " %s\n", image->imgName );
+
+ if (displaySize > 1024)
+ {
+ displaySize /= 1024;
+ sizeSuffix = "Mb";
+ }
+
+ if (displaySize > 1024)
+ {
+ displaySize /= 1024;
+ sizeSuffix = "Gb";
+ }
+
+ ri.Printf(PRINT_ALL, "%4i: %4ix%4i %s %4i%s %s\n", i, image->uploadWidth, image->uploadHeight, format, displaySize, sizeSuffix, image->imgName);
+ estTotalSize += estSize;
}
+
ri.Printf (PRINT_ALL, " ---------\n");
- ri.Printf (PRINT_ALL, " %i total texels (not including mipmaps)\n", texels);
+ ri.Printf (PRINT_ALL, " approx %i bytes\n", estTotalSize);
ri.Printf (PRINT_ALL, " %i total images\n\n", tr.numImages );
}
@@ -774,11 +844,12 @@ R_CreateImage
This is the only way any image_t are created
================
*/
-image_t *R_CreateImage( const char *name, const byte *pic, int width, int height,
- qboolean mipmap, qboolean allowPicmip, int glWrapClampMode ) {
+image_t *R_CreateImage( const char *name, byte *pic, int width, int height,
+ imgType_t type, imgFlags_t flags, int internalFormat ) {
image_t *image;
qboolean isLightmap = qfalse;
long hash;
+ int glWrapClampMode;
if (strlen(name) >= MAX_QPATH ) {
ri.Error (ERR_DROP, "R_CreateImage: \"%s\" is too long", name);
@@ -795,14 +866,17 @@ image_t *R_CreateImage( const char *name, const byte *pic, int width, int height
image->texnum = 1024 + tr.numImages;
tr.numImages++;
- image->mipmap = mipmap;
- image->allowPicmip = allowPicmip;
+ image->type = type;
+ image->flags = flags;
strcpy (image->imgName, name);
image->width = width;
image->height = height;
- image->wrapClampMode = glWrapClampMode;
+ if (flags & IMGFLAG_CLAMPTOEDGE)
+ glWrapClampMode = GL_CLAMP_TO_EDGE;
+ else
+ glWrapClampMode = GL_REPEAT;
// lightmaps are always allocated on TMU 1
if ( qglActiveTextureARB && isLightmap ) {
@@ -818,8 +892,8 @@ image_t *R_CreateImage( const char *name, const byte *pic, int width, int height
GL_Bind(image);
Upload32( (unsigned *)pic, image->width, image->height,
- image->mipmap,
- allowPicmip,
+ image->flags & IMGFLAG_MIPMAP,
+ image->flags & IMGFLAG_PICMIP,
isLightmap,
&image->internalFormat,
&image->uploadWidth,
@@ -954,7 +1028,8 @@ Finds or loads the given image.
Returns NULL if it fails, not a default image.
==============
*/
-image_t *R_FindImageFile( const char *name, qboolean mipmap, qboolean allowPicmip, int glWrapClampMode ) {
+image_t *R_FindImageFile( const char *name, imgType_t type, imgFlags_t flags )
+{
image_t *image;
int width, height;
byte *pic;
@@ -973,14 +1048,8 @@ image_t *R_FindImageFile( const char *name, qboolean mipmap, qboolean allowPicmi
if ( !strcmp( name, image->imgName ) ) {
// the white image can be used with any set of parms, but other mismatches are errors
if ( strcmp( name, "*white" ) ) {
- if ( image->mipmap != mipmap ) {
- ri.Printf( PRINT_DEVELOPER, "WARNING: reused image %s with mixed mipmap parm\n", name );
- }
- if ( image->allowPicmip != allowPicmip ) {
- ri.Printf( PRINT_DEVELOPER, "WARNING: reused image %s with mixed allowPicmip parm\n", name );
- }
- if ( image->wrapClampMode != glWrapClampMode ) {
- ri.Printf( PRINT_ALL, "WARNING: reused image %s with mixed glWrapClampMode parm\n", name );
+ if ( image->flags != flags ) {
+ ri.Printf( PRINT_DEVELOPER, "WARNING: reused image %s with mixed flags (%i vs %i)\n", name, image->flags, flags );
}
}
return image;
@@ -995,7 +1064,7 @@ image_t *R_FindImageFile( const char *name, qboolean mipmap, qboolean allowPicmi
return NULL;
}
- image = R_CreateImage( ( char * ) name, pic, width, height, mipmap, allowPicmip, glWrapClampMode );
+ image = R_CreateImage( ( char * ) name, pic, width, height, type, flags, 0 );
ri.Free( pic );
return image;
}
@@ -1031,7 +1100,7 @@ static void R_CreateDlightImage( void ) {
data[y][x][3] = 255;
}
}
- tr.dlightImage = R_CreateImage("*dlight", (byte *)data, DLIGHT_SIZE, DLIGHT_SIZE, qfalse, qfalse, GL_CLAMP_TO_EDGE );
+ tr.dlightImage = R_CreateImage("*dlight", (byte *)data, DLIGHT_SIZE, DLIGHT_SIZE, IMGTYPE_COLORALPHA, IMGFLAG_CLAMPTOEDGE, 0 );
}
@@ -1118,7 +1187,7 @@ static void R_CreateFogImage( void ) {
// standard openGL clamping doesn't really do what we want -- it includes
// the border color at the edges. OpenGL 1.2 has clamp-to-edge, which does
// what we want.
- tr.fogImage = R_CreateImage("*fog", (byte *)data, FOG_S, FOG_T, qfalse, qfalse, GL_CLAMP_TO_EDGE );
+ tr.fogImage = R_CreateImage("*fog", (byte *)data, FOG_S, FOG_T, IMGTYPE_COLORALPHA, IMGFLAG_CLAMPTOEDGE, 0 );
ri.Hunk_FreeTempMemory( data );
borderColor[0] = 1.0;
@@ -1162,7 +1231,7 @@ static void R_CreateDefaultImage( void ) {
data[x][DEFAULT_SIZE-1][2] =
data[x][DEFAULT_SIZE-1][3] = 255;
}
- tr.defaultImage = R_CreateImage("*default", (byte *)data, DEFAULT_SIZE, DEFAULT_SIZE, qtrue, qfalse, GL_REPEAT );
+ tr.defaultImage = R_CreateImage("*default", (byte *)data, DEFAULT_SIZE, DEFAULT_SIZE, IMGTYPE_COLORALPHA, IMGFLAG_MIPMAP, 0);
}
/*
@@ -1178,7 +1247,7 @@ void R_CreateBuiltinImages( void ) {
// we use a solid white image instead of disabling texturing
Com_Memset( data, 255, sizeof( data ) );
- tr.whiteImage = R_CreateImage("*white", (byte *)data, 8, 8, qfalse, qfalse, GL_REPEAT );
+ tr.whiteImage = R_CreateImage("*white", (byte *)data, 8, 8, IMGTYPE_COLORALPHA, IMGFLAG_NONE, 0);
// with overbright bits active, we need an image which is some fraction of full color,
// for default lightmaps, etc
@@ -1191,12 +1260,12 @@ void R_CreateBuiltinImages( void ) {
}
}
- tr.identityLightImage = R_CreateImage("*identityLight", (byte *)data, 8, 8, qfalse, qfalse, GL_REPEAT );
+ tr.identityLightImage = R_CreateImage("*identityLight", (byte *)data, 8, 8, IMGTYPE_COLORALPHA, IMGFLAG_NONE, 0);
for(x=0;x<32;x++) {
// scratchimage is usually used for cinematic drawing
- tr.scratchImage[x] = R_CreateImage("*scratch", (byte *)data, DEFAULT_SIZE, DEFAULT_SIZE, qfalse, qtrue, GL_CLAMP_TO_EDGE );
+ tr.scratchImage[x] = R_CreateImage("*scratch", (byte *)data, DEFAULT_SIZE, DEFAULT_SIZE, IMGTYPE_COLORALPHA, IMGFLAG_PICMIP | IMGFLAG_CLAMPTOEDGE, 0);
}
R_CreateDlightImage();
diff --git a/src/renderergl1/tr_local.h b/src/renderergl1/tr_local.h
index 40e78500..597b89a7 100644
--- a/src/renderergl1/tr_local.h
+++ b/src/renderergl1/tr_local.h
@@ -81,6 +81,27 @@ typedef struct {
float modelMatrix[16];
} orientationr_t;
+typedef enum
+{
+ IMGTYPE_COLORALPHA, // for color, lightmap, diffuse, and specular
+ IMGTYPE_NORMAL,
+ IMGTYPE_NORMALHEIGHT,
+ IMGTYPE_DELUXE, // normals are swizzled, deluxe are not
+} imgType_t;
+
+typedef enum
+{
+ IMGFLAG_NONE = 0x0000,
+ IMGFLAG_MIPMAP = 0x0001,
+ IMGFLAG_PICMIP = 0x0002,
+ IMGFLAG_CUBEMAP = 0x0004,
+ IMGFLAG_NO_COMPRESSION = 0x0010,
+ IMGFLAG_NOLIGHTSCALE = 0x0020,
+ IMGFLAG_CLAMPTOEDGE = 0x0040,
+ IMGFLAG_SRGB = 0x0080,
+ IMGFLAG_GENNORMALMAP = 0x0100,
+} imgFlags_t;
+
typedef struct image_s {
char imgName[MAX_QPATH]; // game path, including extension
int width, height; // source image
@@ -92,9 +113,8 @@ typedef struct image_s {
int internalFormat;
int TMU; // only needed for voodoo2
- qboolean mipmap;
- qboolean allowPicmip;
- int wrapClampMode; // GL_CLAMP_TO_EDGE or GL_REPEAT
+ imgType_t type;
+ imgFlags_t flags;
struct image_s* next;
} image_t;
@@ -1200,10 +1220,10 @@ qboolean R_GetEntityToken( char *buffer, int size );
model_t *R_AllocModel( void );
void R_Init( void );
-image_t *R_FindImageFile( const char *name, qboolean mipmap, qboolean allowPicmip, int glWrapClampMode );
+image_t *R_FindImageFile( const char *name, imgType_t type, imgFlags_t flags );
-image_t *R_CreateImage( const char *name, const byte *pic, int width, int height, qboolean mipmap,
- qboolean allowPicmip, int wrapClampMode );
+image_t *R_CreateImage( const char *name, byte *pic, int width, int height,
+ imgType_t type, imgFlags_t flags, int internalFormat );
void R_SetColorMappings( void );
void R_GammaCorrect( byte *buffer, int bufSize );
diff --git a/src/renderergl1/tr_shader.c b/src/renderergl1/tr_shader.c
index 581844dd..8eb5732e 100644
--- a/src/renderergl1/tr_shader.c
+++ b/src/renderergl1/tr_shader.c
@@ -637,7 +637,17 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
}
else
{
- stage->bundle[0].image[0] = R_FindImageFile( token, !shader.noMipMaps, !shader.noPicMip, GL_REPEAT );
+ imgType_t type = IMGTYPE_COLORALPHA;
+ imgFlags_t flags = IMGFLAG_NONE;
+
+ if (!shader.noMipMaps)
+ flags |= IMGFLAG_MIPMAP;
+
+ if (!shader.noPicMip)
+ flags |= IMGFLAG_PICMIP;
+
+ stage->bundle[0].image[0] = R_FindImageFile( token, type, flags );
+
if ( !stage->bundle[0].image[0] )
{
ri.Printf( PRINT_WARNING, "WARNING: R_FindImageFile could not find '%s' in shader '%s'\n", token, shader.name );
@@ -650,6 +660,9 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
//
else if ( !Q_stricmp( token, "clampmap" ) )
{
+ imgType_t type = IMGTYPE_COLORALPHA;
+ imgFlags_t flags = IMGFLAG_CLAMPTOEDGE;
+
token = COM_ParseExt( text, qfalse );
if ( !token[0] )
{
@@ -657,7 +670,13 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
return qfalse;
}
- stage->bundle[0].image[0] = R_FindImageFile( token, !shader.noMipMaps, !shader.noPicMip, GL_CLAMP_TO_EDGE );
+ if (!shader.noMipMaps)
+ flags |= IMGFLAG_MIPMAP;
+
+ if (!shader.noPicMip)
+ flags |= IMGFLAG_PICMIP;
+
+ stage->bundle[0].image[0] = R_FindImageFile( token, type, flags );
if ( !stage->bundle[0].image[0] )
{
ri.Printf( PRINT_WARNING, "WARNING: R_FindImageFile could not find '%s' in shader '%s'\n", token, shader.name );
@@ -687,7 +706,15 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
}
num = stage->bundle[0].numImageAnimations;
if ( num < MAX_IMAGE_ANIMATIONS ) {
- stage->bundle[0].image[num] = R_FindImageFile( token, !shader.noMipMaps, !shader.noPicMip, GL_REPEAT );
+ imgFlags_t flags = IMGFLAG_SRGB;
+
+ if (!shader.noMipMaps)
+ flags |= IMGFLAG_MIPMAP;
+
+ if (!shader.noPicMip)
+ flags |= IMGFLAG_PICMIP;
+
+ stage->bundle[0].image[num] = R_FindImageFile( token, IMGTYPE_COLORALPHA, flags );
if ( !stage->bundle[0].image[num] )
{
ri.Printf( PRINT_WARNING, "WARNING: R_FindImageFile could not find '%s' in shader '%s'\n", token, shader.name );
@@ -1230,7 +1257,7 @@ static void ParseSkyParms( char **text ) {
for (i=0 ; i<6 ; i++) {
Com_sprintf( pathname, sizeof(pathname), "%s_%s.tga"
, token, suf[i] );
- shader.sky.outerbox[i] = R_FindImageFile( ( char * ) pathname, qtrue, qtrue, GL_CLAMP_TO_EDGE );
+ shader.sky.outerbox[i] = R_FindImageFile( ( char * ) pathname, IMGTYPE_COLORALPHA, IMGFLAG_SRGB | IMGFLAG_MIPMAP | IMGFLAG_PICMIP | IMGFLAG_CLAMPTOEDGE );
if ( !shader.sky.outerbox[i] ) {
shader.sky.outerbox[i] = tr.defaultImage;
@@ -1261,7 +1288,7 @@ static void ParseSkyParms( char **text ) {
for (i=0 ; i<6 ; i++) {
Com_sprintf( pathname, sizeof(pathname), "%s_%s.tga"
, token, suf[i] );
- shader.sky.innerbox[i] = R_FindImageFile( ( char * ) pathname, qtrue, qtrue, GL_REPEAT );
+ shader.sky.innerbox[i] = R_FindImageFile( ( char * ) pathname, IMGTYPE_COLORALPHA, IMGFLAG_SRGB | IMGFLAG_MIPMAP | IMGFLAG_PICMIP );
if ( !shader.sky.innerbox[i] ) {
shader.sky.innerbox[i] = tr.defaultImage;
}
@@ -2513,11 +2540,26 @@ shader_t *R_FindShader( const char *name, int lightmapIndex, qboolean mipRawImag
// if not defined in the in-memory shader descriptions,
// look for a single supported image file
//
- image = R_FindImageFile( name, mipRawImage, mipRawImage, mipRawImage ? GL_REPEAT : GL_CLAMP_TO_EDGE );
- if ( !image ) {
- ri.Printf( PRINT_DEVELOPER, "Couldn't find image file for shader %s\n", name );
- shader.defaultShader = qtrue;
- return FinishShader();
+ {
+ imgFlags_t flags;
+
+ flags = IMGFLAG_NONE;
+
+ if (mipRawImage)
+ {
+ flags |= IMGFLAG_MIPMAP | IMGFLAG_PICMIP;
+ }
+ else
+ {
+ flags |= IMGFLAG_CLAMPTOEDGE;
+ }
+
+ image = R_FindImageFile( name, IMGTYPE_COLORALPHA, flags );
+ if ( !image ) {
+ ri.Printf( PRINT_DEVELOPER, "Couldn't find image file for shader %s\n", name );
+ shader.defaultShader = qtrue;
+ return FinishShader();
+ }
}
//
diff --git a/src/renderergl2/qgl2.h b/src/renderergl2/qgl2.h
deleted file mode 100644
index 483e3ccc..00000000
--- a/src/renderergl2/qgl2.h
+++ /dev/null
@@ -1,408 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2013 Darklegion Development
-
-This file is part of Tremulous.
-
-Quake III Arena source code is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Quake III Arena source code is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Quake III Arena source code; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-/*
-** QGL.H
-*/
-
-#ifndef __QGL2_H__
-#define __QGL2_H__
-
-#include "../renderercommon/qgl.h"
-
-// GL_EXT_draw_range_elements
-extern void (APIENTRY * qglDrawRangeElementsEXT) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
-
-// GL_EXT_multi_draw_arrays
-extern void (APIENTRY * qglMultiDrawArraysEXT) (GLenum, GLint *, GLsizei *, GLsizei);
-extern void (APIENTRY * qglMultiDrawElementsEXT) (GLenum, const GLsizei *, GLenum, const GLvoid **, GLsizei);
-
-// GL_ARB_shading_language_100
-#ifndef GL_ARB_shading_language_100
-#define GL_ARB_shading_language_100
-#define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C
-#endif
-
-// GL_ARB_vertex_program
-extern void (APIENTRY * qglVertexAttrib4fARB) (GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
-extern void (APIENTRY * qglVertexAttrib4fvARB) (GLuint, const GLfloat *);
-extern void (APIENTRY * qglVertexAttribPointerARB) (GLuint index, GLint size, GLenum type, GLboolean normalized,
- GLsizei stride, const GLvoid * pointer);
-extern void (APIENTRY * qglEnableVertexAttribArrayARB) (GLuint index);
-extern void (APIENTRY * qglDisableVertexAttribArrayARB) (GLuint index);
-
-// GL_ARB_vertex_buffer_object
-extern void (APIENTRY * qglBindBufferARB) (GLenum target, GLuint buffer);
-extern void (APIENTRY * qglDeleteBuffersARB) (GLsizei n, const GLuint * buffers);
-extern void (APIENTRY * qglGenBuffersARB) (GLsizei n, GLuint * buffers);
-extern GLboolean(APIENTRY * qglIsBufferARB) (GLuint buffer);
-extern void (APIENTRY * qglBufferDataARB) (GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage);
-extern void (APIENTRY * qglBufferSubDataARB) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data);
-extern void (APIENTRY * qglGetBufferSubDataARB) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid * data);
-extern void (APIENTRY * qglGetBufferParameterivARB) (GLenum target, GLenum pname, GLint * params);
-extern void (APIENTRY * qglGetBufferPointervARB) (GLenum target, GLenum pname, GLvoid * *params);
-
-// GL_ARB_shader_objects
-extern void (APIENTRY * qglDeleteObjectARB) (GLhandleARB obj);
-extern GLhandleARB(APIENTRY * qglGetHandleARB) (GLenum pname);
-extern void (APIENTRY * qglDetachObjectARB) (GLhandleARB containerObj, GLhandleARB attachedObj);
-extern GLhandleARB(APIENTRY * qglCreateShaderObjectARB) (GLenum shaderType);
-extern void (APIENTRY * qglShaderSourceARB) (GLhandleARB shaderObj, GLsizei count, const GLcharARB * *string,
- const GLint * length);
-extern void (APIENTRY * qglCompileShaderARB) (GLhandleARB shaderObj);
-extern GLhandleARB(APIENTRY * qglCreateProgramObjectARB) (void);
-extern void (APIENTRY * qglAttachObjectARB) (GLhandleARB containerObj, GLhandleARB obj);
-extern void (APIENTRY * qglLinkProgramARB) (GLhandleARB programObj);
-extern void (APIENTRY * qglUseProgramObjectARB) (GLhandleARB programObj);
-extern void (APIENTRY * qglValidateProgramARB) (GLhandleARB programObj);
-extern void (APIENTRY * qglUniform1fARB) (GLint location, GLfloat v0);
-extern void (APIENTRY * qglUniform2fARB) (GLint location, GLfloat v0, GLfloat v1);
-extern void (APIENTRY * qglUniform3fARB) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
-extern void (APIENTRY * qglUniform4fARB) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
-extern void (APIENTRY * qglUniform1iARB) (GLint location, GLint v0);
-extern void (APIENTRY * qglUniform2iARB) (GLint location, GLint v0, GLint v1);
-extern void (APIENTRY * qglUniform3iARB) (GLint location, GLint v0, GLint v1, GLint v2);
-extern void (APIENTRY * qglUniform4iARB) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
-extern void (APIENTRY * qglUniform1fvARB) (GLint location, GLsizei count, const GLfloat * value);
-extern void (APIENTRY * qglUniform2fvARB) (GLint location, GLsizei count, const GLfloat * value);
-extern void (APIENTRY * qglUniform3fvARB) (GLint location, GLsizei count, const GLfloat * value);
-extern void (APIENTRY * qglUniform4fvARB) (GLint location, GLsizei count, const GLfloat * value);
-extern void (APIENTRY * qglUniform2ivARB) (GLint location, GLsizei count, const GLint * value);
-extern void (APIENTRY * qglUniform3ivARB) (GLint location, GLsizei count, const GLint * value);
-extern void (APIENTRY * qglUniform4ivARB) (GLint location, GLsizei count, const GLint * value);
-extern void (APIENTRY * qglUniformMatrix2fvARB) (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
-extern void (APIENTRY * qglUniformMatrix3fvARB) (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
-extern void (APIENTRY * qglUniformMatrix4fvARB) (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
-extern void (APIENTRY * qglGetObjectParameterfvARB) (GLhandleARB obj, GLenum pname, GLfloat * params);
-extern void (APIENTRY * qglGetObjectParameterivARB) (GLhandleARB obj, GLenum pname, GLint * params);
-extern void (APIENTRY * qglGetInfoLogARB) (GLhandleARB obj, GLsizei maxLength, GLsizei * length, GLcharARB * infoLog);
-extern void (APIENTRY * qglGetAttachedObjectsARB) (GLhandleARB containerObj, GLsizei maxCount, GLsizei * count,
- GLhandleARB * obj);
-extern GLint(APIENTRY * qglGetUniformLocationARB) (GLhandleARB programObj, const GLcharARB * name);
-extern void (APIENTRY * qglGetActiveUniformARB) (GLhandleARB programObj, GLuint index, GLsizei maxIndex, GLsizei * length,
- GLint * size, GLenum * type, GLcharARB * name);
-extern void (APIENTRY * qglGetUniformfvARB) (GLhandleARB programObj, GLint location, GLfloat * params);
-extern void (APIENTRY * qglGetUniformivARB) (GLhandleARB programObj, GLint location, GLint * params);
-extern void (APIENTRY * qglGetShaderSourceARB) (GLhandleARB obj, GLsizei maxLength, GLsizei * length, GLcharARB * source);
-
-// GL_ARB_vertex_shader
-extern void (APIENTRY * qglBindAttribLocationARB) (GLhandleARB programObj, GLuint index, const GLcharARB * name);
-extern void (APIENTRY * qglGetActiveAttribARB) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei * length,
- GLint * size, GLenum * type, GLcharARB * name);
-extern GLint(APIENTRY * qglGetAttribLocationARB) (GLhandleARB programObj, const GLcharARB * name);
-
-// GL_ARB_texture_compression
-extern void (APIENTRY * qglCompressedTexImage3DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height,
- GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
-extern void (APIENTRY * qglCompressedTexImage2DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height,
- GLint border, GLsizei imageSize, const GLvoid *data);
-extern void (APIENTRY * qglCompressedTexImage1DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border,
- GLsizei imageSize, const GLvoid *data);
-extern void (APIENTRY * qglCompressedTexSubImage3DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
- GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
-extern void (APIENTRY * qglCompressedTexSubImage2DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
- GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
-extern void (APIENTRY * qglCompressedTexSubImage1DARB)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format,
- GLsizei imageSize, const GLvoid *data);
-extern void (APIENTRY * qglGetCompressedTexImageARB)(GLenum target, GLint lod,
- GLvoid *img);
-
-// GL_NVX_gpu_memory_info
-#ifndef GL_NVX_gpu_memory_info
-#define GL_NVX_gpu_memory_info
-#define GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX 0x9047
-#define GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX 0x9048
-#define GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX 0x9049
-#define GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX 0x904A
-#define GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX 0x904B
-#endif
-
-// GL_ATI_meminfo
-#ifndef GL_ATI_meminfo
-#define GL_ATI_meminfo
-#define GL_VBO_FREE_MEMORY_ATI 0x87FB
-#define GL_TEXTURE_FREE_MEMORY_ATI 0x87FC
-#define GL_RENDERBUFFER_FREE_MEMORY_ATI 0x87FD
-#endif
-
-// GL_ARB_texture_float
-#ifndef GL_ARB_texture_float
-#define GL_ARB_texture_float
-#define GL_TEXTURE_RED_TYPE_ARB 0x8C10
-#define GL_TEXTURE_GREEN_TYPE_ARB 0x8C11
-#define GL_TEXTURE_BLUE_TYPE_ARB 0x8C12
-#define GL_TEXTURE_ALPHA_TYPE_ARB 0x8C13
-#define GL_TEXTURE_LUMINANCE_TYPE_ARB 0x8C14
-#define GL_TEXTURE_INTENSITY_TYPE_ARB 0x8C15
-#define GL_TEXTURE_DEPTH_TYPE_ARB 0x8C16
-#define GL_UNSIGNED_NORMALIZED_ARB 0x8C17
-#define GL_RGBA32F_ARB 0x8814
-#define GL_RGB32F_ARB 0x8815
-#define GL_ALPHA32F_ARB 0x8816
-#define GL_INTENSITY32F_ARB 0x8817
-#define GL_LUMINANCE32F_ARB 0x8818
-#define GL_LUMINANCE_ALPHA32F_ARB 0x8819
-#define GL_RGBA16F_ARB 0x881A
-#define GL_RGB16F_ARB 0x881B
-#define GL_ALPHA16F_ARB 0x881C
-#define GL_INTENSITY16F_ARB 0x881D
-#define GL_LUMINANCE16F_ARB 0x881E
-#define GL_LUMINANCE_ALPHA16F_ARB 0x881F
-#endif
-
-#ifndef GL_ARB_half_float_pixel
-#define GL_ARB_half_float_pixel
-#define GL_HALF_FLOAT_ARB 0x140B
-#endif
-
-// GL_EXT_framebuffer_object
-extern GLboolean (APIENTRY * qglIsRenderbufferEXT)(GLuint renderbuffer);
-extern void (APIENTRY * qglBindRenderbufferEXT)(GLenum target, GLuint renderbuffer);
-extern void (APIENTRY * qglDeleteRenderbuffersEXT)(GLsizei n, const GLuint *renderbuffers);
-extern void (APIENTRY * qglGenRenderbuffersEXT)(GLsizei n, GLuint *renderbuffers);
-extern void (APIENTRY * qglRenderbufferStorageEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
-extern void (APIENTRY * qglGetRenderbufferParameterivEXT)(GLenum target, GLenum pname, GLint *params);
-extern GLboolean (APIENTRY * qglIsFramebufferEXT)(GLuint framebuffer);
-extern void (APIENTRY * qglBindFramebufferEXT)(GLenum target, GLuint framebuffer);
-extern void (APIENTRY * qglDeleteFramebuffersEXT)(GLsizei n, const GLuint *framebuffers);
-extern void (APIENTRY * qglGenFramebuffersEXT)(GLsizei n, GLuint *framebuffers);
-extern GLenum (APIENTRY * qglCheckFramebufferStatusEXT)(GLenum target);
-extern void (APIENTRY * qglFramebufferTexture1DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture,
- GLint level);
-extern void (APIENTRY * qglFramebufferTexture2DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture,
- GLint level);
-extern void (APIENTRY * qglFramebufferTexture3DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture,
- GLint level, GLint zoffset);
-extern void (APIENTRY * qglFramebufferRenderbufferEXT)(GLenum target, GLenum attachment, GLenum renderbuffertarget,
- GLuint renderbuffer);
-extern void (APIENTRY * qglGetFramebufferAttachmentParameterivEXT)(GLenum target, GLenum attachment, GLenum pname, GLint *params);
-extern void (APIENTRY * qglGenerateMipmapEXT)(GLenum target);
-
-#ifndef GL_EXT_framebuffer_object
-#define GL_EXT_framebuffer_object
-#define GL_FRAMEBUFFER_EXT 0x8D40
-#define GL_RENDERBUFFER_EXT 0x8D41
-#define GL_STENCIL_INDEX1_EXT 0x8D46
-#define GL_STENCIL_INDEX4_EXT 0x8D47
-#define GL_STENCIL_INDEX8_EXT 0x8D48
-#define GL_STENCIL_INDEX16_EXT 0x8D49
-#define GL_RENDERBUFFER_WIDTH_EXT 0x8D42
-#define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43
-#define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44
-#define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50
-#define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51
-#define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52
-#define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53
-#define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54
-#define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55
-#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0
-#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4
-#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0
-#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1
-#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2
-#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3
-#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4
-#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5
-#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6
-#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7
-#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8
-#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9
-#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA
-#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB
-#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC
-#define GL_COLOR_ATTACHMENT13_EXT 0x8CED
-#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE
-#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF
-#define GL_DEPTH_ATTACHMENT_EXT 0x8D00
-#define GL_STENCIL_ATTACHMENT_EXT 0x8D20
-#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5
-#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6
-#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7
-#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9
-#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA
-#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB
-#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC
-#define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD
-#define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6
-#define GL_RENDERBUFFER_BINDING_EXT 0x8CA7
-#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF
-#define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8
-#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506
-#endif
-
-// GL_EXT_packed_depth_stencil
-#ifndef GL_EXT_packed_depth_stencil
-#define GL_EXT_packed_depth_stencil
-#define GL_DEPTH_STENCIL_EXT 0x84F9
-#define GL_UNSIGNED_INT_24_8_EXT 0x84FA
-#define GL_DEPTH24_STENCIL8_EXT 0x88F0
-#define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1
-#endif
-
-// GL_ARB_occlusion_query
-extern void (APIENTRY * qglGenQueriesARB)(GLsizei n, GLuint *ids);
-extern void (APIENTRY * qglDeleteQueriesARB)(GLsizei n, const GLuint *ids);
-extern GLboolean (APIENTRY * qglIsQueryARB)(GLuint id);
-extern void (APIENTRY * qglBeginQueryARB)(GLenum target, GLuint id);
-extern void (APIENTRY * qglEndQueryARB)(GLenum target);
-extern void (APIENTRY * qglGetQueryivARB)(GLenum target, GLenum pname, GLint *params);
-extern void (APIENTRY * qglGetQueryObjectivARB)(GLuint id, GLenum pname, GLint *params);
-extern void (APIENTRY * qglGetQueryObjectuivARB)(GLuint id, GLenum pname, GLuint *params);
-
-#ifndef GL_ARB_occlusion_query
-#define GL_ARB_occlusion_query
-#define GL_SAMPLES_PASSED_ARB 0x8914
-#define GL_QUERY_COUNTER_BITS_ARB 0x8864
-#define GL_CURRENT_QUERY_ARB 0x8865
-#define GL_QUERY_RESULT_ARB 0x8866
-#define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867
-#endif
-
-// GL_EXT_framebuffer_blit
-extern void (APIENTRY * qglBlitFramebufferEXT)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
- GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
- GLbitfield mask, GLenum filter);
-
-#ifndef GL_EXT_framebuffer_blit
-#define GL_EXT_framebuffer_blit
-#define GL_READ_FRAMEBUFFER_EXT 0x8CA8
-#define GL_DRAW_FRAMEBUFFER_EXT 0x8CA9
-#define GL_DRAW_FRAMEBUFFER_BINDING_EXT 0x8CA6
-#define GL_READ_FRAMEBUFFER_BINDING_EXT 0x8CAA
-#endif
-
-// GL_EXT_framebuffer_multisample
-extern void (APIENTRY * qglRenderbufferStorageMultisampleEXT)(GLenum target, GLsizei samples,
- GLenum internalformat, GLsizei width, GLsizei height);
-
-#ifndef GL_EXT_framebuffer_multisample
-#define GL_EXT_framebuffer_multisample
-#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB
-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56
-#define GL_MAX_SAMPLES_EXT 0x8D57
-#endif
-
-#ifndef GL_EXT_texture_sRGB
-#define GL_EXT_texture_sRGB
-#define GL_SRGB_EXT 0x8C40
-#define GL_SRGB8_EXT 0x8C41
-#define GL_SRGB_ALPHA_EXT 0x8C42
-#define GL_SRGB8_ALPHA8_EXT 0x8C43
-#define GL_SLUMINANCE_ALPHA_EXT 0x8C44
-#define GL_SLUMINANCE8_ALPHA8_EXT 0x8C45
-#define GL_SLUMINANCE_EXT 0x8C46
-#define GL_SLUMINANCE8_EXT 0x8C47
-#define GL_COMPRESSED_SRGB_EXT 0x8C48
-#define GL_COMPRESSED_SRGB_ALPHA_EXT 0x8C49
-#define GL_COMPRESSED_SLUMINANCE_EXT 0x8C4A
-#define GL_COMPRESSED_SLUMINANCE_ALPHA_EXT 0x8C4B
-#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C
-#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D
-#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E
-#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F
-#endif
-
-#ifndef GL_EXT_framebuffer_sRGB
-#define GL_EXT_framebuffer_sRGB
-#define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9
-#endif
-
-#ifndef GL_EXT_texture_compression_latc
-#define GL_EXT_texture_compression_latc
-#define GL_COMPRESSED_LUMINANCE_LATC1_EXT 0x8C70
-#define GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT 0x8C71
-#define GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT 0x8C72
-#define GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT 0x8C73
-#endif
-
-#ifndef GL_ARB_texture_compression_bptc
-#define GL_ARB_texture_compression_bptc
-#define GL_COMPRESSED_RGBA_BPTC_UNORM_ARB 0x8E8C
-#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB 0x8E8D
-#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB 0x8E8E
-#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB 0x8E8F
-#endif
-
-// GL_ARB_draw_buffers
-extern void (APIENTRY * qglDrawBuffersARB)(GLsizei n, const GLenum *bufs);
-#ifndef GL_ARB_draw_buffers
-#define GL_ARB_draw_buffers
-#define GL_MAX_DRAW_BUFFERS_ARB 0x8824
-#define GL_DRAW_BUFFER0_ARB 0x8825
-#define GL_DRAW_BUFFER1_ARB 0x8826
-#define GL_DRAW_BUFFER2_ARB 0x8827
-#define GL_DRAW_BUFFER3_ARB 0x8828
-#define GL_DRAW_BUFFER4_ARB 0x8829
-#define GL_DRAW_BUFFER5_ARB 0x882A
-#define GL_DRAW_BUFFER6_ARB 0x882B
-#define GL_DRAW_BUFFER7_ARB 0x882C
-#define GL_DRAW_BUFFER8_ARB 0x882D
-#define GL_DRAW_BUFFER9_ARB 0x882E
-#define GL_DRAW_BUFFER10_ARB 0x882F
-#define GL_DRAW_BUFFER11_ARB 0x8830
-#define GL_DRAW_BUFFER12_ARB 0x8831
-#define GL_DRAW_BUFFER13_ARB 0x8832
-#define GL_DRAW_BUFFER14_ARB 0x8833
-#define GL_DRAW_BUFFER15_ARB 0x8834
-#endif
-
-#ifndef GL_ARB_depth_clamp
-#define GL_ARB_depth_clamp
-#define GL_DEPTH_CLAMP 0x864F
-#endif
-
-#if defined(WIN32)
-// WGL_ARB_create_context
-#ifndef WGL_ARB_create_context
-#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
-#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
-#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093
-#define WGL_CONTEXT_FLAGS_ARB 0x2094
-#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
-#define WGL_CONTEXT_DEBUG_BIT_ARB 0x0001
-#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002
-#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
-#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
-#define ERROR_INVALID_VERSION_ARB 0x2095
-#define ERROR_INVALID_PROFILE_ARB 0x2096
-#endif
-
-extern HGLRC(APIENTRY * qwglCreateContextAttribsARB) (HDC hdC, HGLRC hShareContext, const int *attribList);
-#endif
-
-#if 0 //defined(__linux__)
-// GLX_ARB_create_context
-#ifndef GLX_ARB_create_context
-#define GLX_CONTEXT_DEBUG_BIT_ARB 0x00000001
-#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
-#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091
-#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092
-#define GLX_CONTEXT_FLAGS_ARB 0x2094
-#endif
-
-extern GLXContext (APIENTRY * qglXCreateContextAttribsARB) (Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list);
-#endif
-
-#endif
diff --git a/src/renderergl2/tr_image.c b/src/renderergl2/tr_image.c
index 3f61539b..72a59329 100644
--- a/src/renderergl2/tr_image.c
+++ b/src/renderergl2/tr_image.c
@@ -147,7 +147,6 @@ R_ImageList_f
===============
*/
void R_ImageList_f( void ) {
-#if 1
int i;
int estTotalSize = 0;
@@ -284,107 +283,6 @@ void R_ImageList_f( void ) {
ri.Printf (PRINT_ALL, " ---------\n");
ri.Printf (PRINT_ALL, " approx %i bytes\n", estTotalSize);
ri.Printf (PRINT_ALL, " %i total images\n\n", tr.numImages );
-#else
- int i;
- image_t *image;
- int texels;
- const char *yesno[] = {
- "no ", "yes"
- };
-
- ri.Printf (PRINT_ALL, "\n -w-- -h-- -mm- -TMU- -if-- wrap --name-------\n");
- texels = 0;
-
- for ( i = 0 ; i < tr.numImages ; i++ ) {
- image = tr.images[ i ];
-
- texels += image->uploadWidth*image->uploadHeight;
- ri.Printf (PRINT_ALL, "%4i: %4i %4i %s %d ",
- i, image->uploadWidth, image->uploadHeight, yesno[(image->flags & IMGFLAG_MIPMAP) ? 1 : 0], image->TMU );
- switch ( image->internalFormat ) {
- case 1:
- ri.Printf( PRINT_ALL, "I " );
- break;
- case 2:
- ri.Printf( PRINT_ALL, "IA " );
- break;
- case 3:
- ri.Printf( PRINT_ALL, "RGB " );
- break;
- case 4:
- ri.Printf( PRINT_ALL, "RGBA " );
- break;
- case GL_RGBA8:
- ri.Printf( PRINT_ALL, "RGBA8" );
- break;
- case GL_RGB8:
- ri.Printf( PRINT_ALL, "RGB8" );
- break;
- case GL_RGB4_S3TC:
- ri.Printf( PRINT_ALL, "S3TC " );
- break;
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- ri.Printf( PRINT_ALL, "DXT1 " );
- break;
- case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- ri.Printf( PRINT_ALL, "DXT5 " );
- break;
- case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT:
- ri.Printf( PRINT_ALL, "LATC " );
- break;
- case GL_RGBA4:
- ri.Printf( PRINT_ALL, "RGBA4" );
- break;
- case GL_RGB5:
- ri.Printf( PRINT_ALL, "RGB5 " );
- break;
- case GL_SRGB_EXT:
- ri.Printf( PRINT_ALL, "sRGB " );
- break;
- case GL_SRGB8_EXT:
- ri.Printf( PRINT_ALL, "sRGB8" );
- break;
- case GL_SRGB_ALPHA_EXT:
- case GL_SRGB8_ALPHA8_EXT:
- ri.Printf( PRINT_ALL, "sRGBA" );
- break;
- /*
- case GL_SLUMINANCE_EXT:
- break;
- case GL_SLUMINANCE8_EXT:
- break;
- case GL_SLUMINANCE_ALPHA_EXT:
- break;
- case GL_SLUMINANCE8_ALPHA8_EXT:
- break;
- */
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
- ri.Printf( PRINT_ALL, "sDXT1" );
- break;
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
- ri.Printf( PRINT_ALL, "sDXT5" );
- break;
- case GL_COMPRESSED_RGBA_BPTC_UNORM_ARB:
- ri.Printf( PRINT_ALL, "BPTC " );
- break;
- case GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB:
- ri.Printf( PRINT_ALL, "sBPTC" );
- break;
- default:
- ri.Printf( PRINT_ALL, "???? " );
- }
-
- if (image->flags & IMGFLAG_CLAMPTOEDGE)
- ri.Printf( PRINT_ALL, "clmp " );
- else
- ri.Printf( PRINT_ALL, "rept " );
-
- ri.Printf( PRINT_ALL, " %s\n", image->imgName );
- }
- ri.Printf (PRINT_ALL, " ---------\n");
- ri.Printf (PRINT_ALL, " %i total texels (not including mipmaps)\n", texels);
- ri.Printf (PRINT_ALL, " %i total images\n\n", tr.numImages );
-#endif
}
//=======================================================================
diff --git a/src/renderergl2/tr_local.h b/src/renderergl2/tr_local.h
index 7efb26e9..8372755b 100644
--- a/src/renderergl2/tr_local.h
+++ b/src/renderergl2/tr_local.h
@@ -35,7 +35,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "tr_fbo.h"
#include "tr_postprocess.h"
#include "../renderercommon/iqm.h"
-#include "qgl2.h"
+#include "../renderercommon/qgl.h"
#define GL_INDEX_TYPE GL_UNSIGNED_INT
typedef unsigned int glIndex_t;