Search
lxdream.org :: lxdream :: r1223:61684ca88599
lxdream 0.9.1
released Jun 29
Download Now
changeset1223:61684ca88599
parent1222:a4545699a82b
child1224:7762a347ca33
authornkeynes
dateWed Feb 15 18:09:02 2012 +1000 (7 years ago)
Add extension wrangling for max colour attachments
src/drivers/gl_fbo.c
src/pvr2/glutil.c
src/pvr2/glutil.h
1.1 --- a/src/drivers/gl_fbo.c Wed Feb 15 17:54:51 2012 +1000
1.2 +++ b/src/drivers/gl_fbo.c Wed Feb 15 18:09:02 2012 +1000
1.3 @@ -80,7 +80,7 @@
1.4 GLuint fbids[MAX_FRAMEBUFFERS];
1.5 GLuint rbids[MAX_FRAMEBUFFERS*2]; /* depth buffer, stencil buffer per fb */
1.6
1.7 - glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS, &gl_fbo_max_attachments);
1.8 + gl_fbo_max_attachments = glGetMaxColourAttachments();
1.9 glGenFramebuffers( MAX_FRAMEBUFFERS, &fbids[0] );
1.10 glGenRenderbuffers( MAX_FRAMEBUFFERS*2, &rbids[0] );
1.11 for( i=0; i<MAX_FRAMEBUFFERS; i++ ) {
1.12 @@ -255,8 +255,8 @@
1.13 }
1.14 glBindTexture( GL_TEXTURE_2D, buffer->buf_id );
1.15 glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL );
1.16 - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
1.17 - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
1.18 + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
1.19 + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
1.20 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
1.21 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
1.22 return buffer;
2.1 --- a/src/pvr2/glutil.c Wed Feb 15 17:54:51 2012 +1000
2.2 +++ b/src/pvr2/glutil.c Wed Feb 15 18:09:02 2012 +1000
2.3 @@ -112,6 +112,18 @@
2.4 #define DEFAULT_TERMINAL_COLUMNS 80
2.5 #define DEFAULT_COLUMN_WIDTH 34
2.6
2.7 +int glGetMaxColourAttachments()
2.8 +{
2.9 +#ifdef GL_MAX_COLOR_ATTACHMENTS
2.10 + GLint result = 0;
2.11 + glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS, &result);
2.12 + return result;
2.13 +#else
2.14 + return 1;
2.15 +#endif
2.16 +}
2.17 +
2.18 +
2.19 /**
2.20 * Format a GL extension list (or other space-separated string) nicely, and
2.21 * print to the given output stream.
3.1 --- a/src/pvr2/glutil.h Wed Feb 15 17:54:51 2012 +1000
3.2 +++ b/src/pvr2/glutil.h Wed Feb 15 18:09:02 2012 +1000
3.3 @@ -54,6 +54,7 @@
3.4 gboolean isGLPixelBufferSupported();
3.5 gboolean isGLMultitextureSupported();
3.6 gboolean isGLMirroredTextureSupported();
3.7 +GLint glGetMaxColourAttachments();
3.8
3.9 /****** Extension variant wrangling *****/
3.10
3.11 @@ -89,6 +90,10 @@
3.12 #define GL_DEPTH_ATTACHMENT GL_DEPTH_ATTACHMENT_EXT
3.13 #endif
3.14
3.15 +#if defined(GL_DEPTH_COMPONENT24_OES) && !defined(GL_DEPTH_COMPONENT24)
3.16 +#define GL_DEPTH_COMPONENT24 GL_DEPTH_COMPONENT24_OES
3.17 +#endif
3.18 +
3.19 #ifndef GL_DEPTH24_STENCIL8
3.20 #if defined(GL_DEPTH24_STENCIL8_EXT)
3.21 #define GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_EXT
.