strlcat(permutationname, modeinfo->filename, sizeof(permutationname));
+ #ifndef USE_GLES2
// we need 140 for r_glsl_skeletal (GL_ARB_uniform_buffer_object)
if(vid.support.glshaderversion >= 140)
{
geomstrings_list[geomstrings_count++] = "#define GLSL120\n";
fragstrings_list[fragstrings_count++] = "#define GLSL120\n";
}
+ #else
+ if(vid.support.glshaderversion >= 300)
+ {
+ vertstrings_list[vertstrings_count++] = "#version 300 es\n";
+ geomstrings_list[geomstrings_count++] = "#version 300 es\n";
+ fragstrings_list[fragstrings_count++] = "#version 300 es\n";
+ vertstrings_list[vertstrings_count++] = "#define GLSL140\n";
+ geomstrings_list[geomstrings_count++] = "#define GLSL140\n";
+ fragstrings_list[fragstrings_count++] = "#define GLSL140\n";
+ }
+ else
+ {
+ vertstrings_list[vertstrings_count++] = "#version 100 es\n";
+ geomstrings_list[geomstrings_count++] = "#version 100 es\n";
+ fragstrings_list[fragstrings_count++] = "#version 100 es\n";
+ vertstrings_list[vertstrings_count++] = "#define GLSL120\n";
+ geomstrings_list[geomstrings_count++] = "#define GLSL120\n";
+ fragstrings_list[fragstrings_count++] = "#define GLSL120\n";
+ }
+ #endif
// GLES also adds several things from GLSL120
switch(vid.renderpath)
{
static textypeinfo_t textype_depth24 = {"depth24", TEXTYPE_DEPTHBUFFER24 , 2, 2, 2.0f, GL_DEPTH_COMPONENT16 , GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT};
static textypeinfo_t textype_depth24stencil8 = {"depth24stencil8", TEXTYPE_DEPTHBUFFER24STENCIL8, 2, 2, 2.0f, GL_DEPTH_COMPONENT16 , GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT};
static textypeinfo_t textype_colorbuffer = {"colorbuffer", TEXTYPE_COLORBUFFER , 2, 2, 2.0f, GL_RGB565 , GL_RGBA , GL_UNSIGNED_SHORT_5_6_5};
-static textypeinfo_t textype_colorbuffer16f = {"colorbuffer16f", TEXTYPE_COLORBUFFER16F , 2, 2, 2.0f, GL_RGBA16F , GL_RGBA , GL_HALF_FLOAT_ARB};
-static textypeinfo_t textype_colorbuffer32f = {"colorbuffer32f", TEXTYPE_COLORBUFFER32F , 2, 2, 2.0f, GL_RGBA32F , GL_RGBA , GL_FLOAT};
+static textypeinfo_t textype_colorbuffer16f = {"colorbuffer16f", TEXTYPE_COLORBUFFER16F , 2, 2, 2.0f, GL_RGBA16F_EXT , GL_RGBA , GL_HALF_FLOAT_OES};
+static textypeinfo_t textype_colorbuffer32f = {"colorbuffer32f", TEXTYPE_COLORBUFFER32F , 2, 2, 2.0f, GL_RGBA32F_EXT , GL_RGBA , GL_FLOAT};
// image formats:
static textypeinfo_t textype_alpha = {"alpha", TEXTYPE_ALPHA , 1, 4, 4.0f, GL_ALPHA , GL_ALPHA , GL_UNSIGNED_BYTE };
LIB_SOUND=$(LIB_SND_3DRAS)
endif
+ifeq ($(DP_GLES),2)
+ LIB_GLES=-lGLESv2
+ CFLAGS_GLES=-DUSE_GLES2
+endif
+
##### Extra CFLAGS #####
CFLAGS_MAKEDEP?=-MMD
# Compilation
-CFLAGS_COMMON=$(CFLAGS_MAKEDEP) $(CFLAGS_PRELOAD) $(CFLAGS_FS) $(CFLAGS_WARNINGS) $(CFLAGS_LIBZ) $(CFLAGS_LIBJPEG) $(CFLAGS_D3D) $(CFLAGS_NET) $(CFLAGS_SDL) -D_FILE_OFFSET_BITS=64 -D__KERNEL_STRICT_NAMES -I../../../
+CFLAGS_COMMON=$(CFLAGS_MAKEDEP) $(CFLAGS_PRELOAD) $(CFLAGS_FS) $(CFLAGS_WARNINGS) $(CFLAGS_LIBZ) $(CFLAGS_LIBJPEG) $(CFLAGS_D3D) $(CFLAGS_NET) $(CFLAGS_SDL) -D_FILE_OFFSET_BITS=64 -D__KERNEL_STRICT_NAMES -I../../../ $(CFLAGS_GLES)
CFLAGS_CLIENT=-DCONFIG_MENU -DCONFIG_CD $(CFLAGS_VIDEO_CAPTURE)
CFLAGS_SERVER=
CFLAGS_DEBUG=-ggdb
OBJ_GLX= builddate.c sys_linux.o vid_glx.o thread_pthread.o keysym2ucs.o $(OBJ_MENU) $(OBJ_SOUND) $(OBJ_CD) $(OBJ_VIDEO_CAPTURE) $(OBJ_COMMON)
-LDFLAGS_UNIXCOMMON=-lm $(LIB_ODE) $(LIB_Z) $(LIB_JPEG) $(LIB_CRYPTO) $(LIB_CRYPTO_RIJNDAEL)
+LDFLAGS_UNIXCOMMON=-lm $(LIB_ODE) $(LIB_Z) $(LIB_JPEG) $(LIB_CRYPTO) $(LIB_CRYPTO_RIJNDAEL) $(LIB_GLES)
LDFLAGS_UNIXCL=-L$(UNIX_X11LIBPATH) -lX11 -lXpm -lXext -lXxf86vm -pthread $(LIB_SOUND)
LDFLAGS_UNIXCL_PRELOAD=-lz -ljpeg -lpng -logg -ltheora -lvorbis -lvorbisenc -lvorbisfile -lcurl
LDFLAGS_UNIXSV_PRELOAD=-lz -ljpeg -lpng -lcurl
"# endif\n",
"#endif\n",
"\n",
-"#define sat(x) clamp(x, 0, 1)\n",
+"#define sat(x) clamp(x, 0.0, 1.0)\n",
"#define possat(x) sat(x)\n",//As replacement of max(x, 0) when x<=1, better for gpus that can't do 0-cycle max(x, 0)
"#define minonesat(x) sat(x)\n",//As replacement of min(x, 1) when x>=0, better for gpus that can't do 0-cycle min(x, 1)
"#define possatdot(x, y) possat(dot(x, y))\n",
" #ifdef USEDIFFUSE\n",
" myhalf3 lightnormal = cast_myhalf3(normalize(LightVector));\n",
" #endif\n",
-" #define lightcolor 1\n",
+" #define lightcolor 1.0\n",
"#endif // MODE_LIGHTDIRECTION\n",
"#ifdef MODE_LIGHTDIRECTIONMAP_MODELSPACE\n",
" #define SHADING\n",
if (!gl_platformextensions)
gl_platformextensions = "";
- Con_Printf("GL_VENDOR: %s\n", gl_vendor);
- Con_Printf("GL_RENDERER: %s\n", gl_renderer);
- Con_Printf("GL_VERSION: %s\n", gl_version);
- Con_DPrintf("GL_EXTENSIONS: %s\n", gl_extensions);
+ Con_Printf("GLES_VENDOR: %s\n", gl_vendor);
+ Con_Printf("GLES_RENDERER: %s\n", gl_renderer);
+ Con_Printf("GLES_VERSION: %s\n", gl_version);
+ Con_DPrintf("GLES_EXTENSIONS: %s\n", gl_extensions);
Con_DPrintf("%s_EXTENSIONS: %s\n", gl_platform, gl_platformextensions);
// LordHavoc: report supported extensions
vid.support.arb_query_buffer_object = false;
vid.support.arb_shadow = false;
vid.support.arb_texture_compression = false; // different (vendor-specific) formats than on desktop OpenGL...
- vid.support.arb_texture_cube_map = SDL_GL_ExtensionSupported("GL_OES_texture_cube_map") != 0;
+ vid.support.arb_texture_cube_map = true;
vid.support.arb_texture_env_combine = false;
vid.support.arb_texture_gather = false;
vid.support.arb_texture_non_power_of_two = strstr(gl_extensions, "GL_OES_texture_npot") != NULL;
vid.support.arb_texture_float = SDL_GL_ExtensionSupported("GL_OES_texture_float") != 0;
vid.support.arb_half_float_pixel = SDL_GL_ExtensionSupported("GL_OES_texture_half_float") != 0;
vid.support.arb_half_float_vertex = SDL_GL_ExtensionSupported("GL_OES_vertex_half_float") != 0;
+ {
+ char *s;
+ // detect what GLSL version is available, to enable features like r_glsl_skeletal and higher quality reliefmapping
+ vid.support.glshaderversion = 100;
+ s = (char *) qglGetString(GL_SHADING_LANGUAGE_VERSION);
+ if (s)
+ vid.support.glshaderversion = (int)(atof(strrchr(s, ' ') + 1) * 100.0f + 0.5f);
+ if (vid.support.glshaderversion < 100)
+ vid.support.glshaderversion = 100;
+ Con_DPrintf("Detected GLSL #version %i\n", vid.support.glshaderversion);
+ }
// NOTE: On some devices, a value of 512 gives better FPS than the maximum.
qglGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint*)&vid.maxtexturesize_2d);
SDL_GL_SetAttribute (SDL_GL_CONTEXT_MAJOR_VERSION, 2);
SDL_GL_SetAttribute (SDL_GL_CONTEXT_MINOR_VERSION, 0);
SDL_GL_SetAttribute (SDL_GL_RETAINED_BACKING, 1);
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
#endif
#endif