Search
lxdream.org :: lxdream/src/drivers/gl_fbo.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/drivers/gl_fbo.c
changeset 1222:a4545699a82b
prev1210:79bbd30363f4
next1223:61684ca88599
author nkeynes
date Wed Feb 15 17:54:51 2012 +1000 (8 years ago)
permissions -rw-r--r--
last change Use GL_TEXTURE_2D instead of GL_TEXTURE_RECTANGLE_ARB for frame buffers, for
systems that don't provide the latter (and there's not really much
difference anyway).
Add macro wrangling for GL_DEPTH24_STENCIL8 format
file annotate diff log raw
1.1 --- a/src/drivers/gl_fbo.c Tue Feb 07 14:27:13 2012 +1000
1.2 +++ b/src/drivers/gl_fbo.c Wed Feb 15 17:54:51 2012 +1000
1.3 @@ -136,7 +136,7 @@
1.4 for( i=0; i<gl_fbo_max_attachments; i++ ) {
1.5 if( fbo[bufno].tex_ids[i] != -1 ) {
1.6 glFramebufferTexture2D(GL_FRAMEBUFFER, ATTACHMENT_POINT(i),
1.7 - GL_TEXTURE_RECTANGLE_ARB, 0, 0);
1.8 + GL_TEXTURE_2D, 0, 0);
1.9 fbo[bufno].tex_ids[i] = -1;
1.10 }
1.11 }
1.12 @@ -144,7 +144,7 @@
1.13 /* Setup the renderbuffers */
1.14 if( gl_fbo_have_packed_stencil ) {
1.15 glBindRenderbuffer(GL_RENDERBUFFER, fbo[bufno].depth_id);
1.16 - glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8_EXT, width, height);
1.17 + glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, width, height);
1.18 glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
1.19 GL_RENDERBUFFER, fbo[bufno].depth_id);
1.20 glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
1.21 @@ -209,9 +209,9 @@
1.22 attach = 0;
1.23 }
1.24 fbo[fbo_no].tex_ids[attach] = tex_id;
1.25 - glBindTexture( GL_TEXTURE_RECTANGLE_ARB, 0 ); // Ensure the output texture is unbound
1.26 + glBindTexture( GL_TEXTURE_2D, 0 ); // Ensure the output texture is unbound
1.27 glFramebufferTexture2D(GL_FRAMEBUFFER, ATTACHMENT_POINT(attach),
1.28 - GL_TEXTURE_RECTANGLE_ARB, tex_id, 0 );
1.29 + GL_TEXTURE_2D, tex_id, 0 );
1.30 /* Set draw/read buffers by default */
1.31 glDrawBuffer(ATTACHMENT_POINT(attach));
1.32 glReadBuffer(ATTACHMENT_POINT(attach));
1.33 @@ -251,14 +251,14 @@
1.34 buffer->buf_id = tex;
1.35 } else {
1.36 buffer->buf_id = tex_id;
1.37 - glBindTexture( GL_TEXTURE_RECTANGLE_ARB, tex_id );
1.38 + glBindTexture( GL_TEXTURE_2D, tex_id );
1.39 }
1.40 - glBindTexture( GL_TEXTURE_RECTANGLE_ARB, buffer->buf_id );
1.41 - glTexImage2D( GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL );
1.42 - glTexParameteri( GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP );
1.43 - glTexParameteri( GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP );
1.44 - glTexParameteri( GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
1.45 - glTexParameteri( GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
1.46 + glBindTexture( GL_TEXTURE_2D, buffer->buf_id );
1.47 + glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL );
1.48 + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
1.49 + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
1.50 + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
1.51 + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
1.52 return buffer;
1.53 }
1.54
1.55 @@ -276,7 +276,7 @@
1.56 if( fbo[i].tex_ids[j] == buffer->buf_id ) {
1.57 glBindFramebuffer(GL_FRAMEBUFFER, fbo[i].fb_id);
1.58 glFramebufferTexture2D(GL_FRAMEBUFFER, ATTACHMENT_POINT(j),
1.59 - GL_TEXTURE_RECTANGLE_ARB, GL_NONE, 0 );
1.60 + GL_TEXTURE_2D, GL_NONE, 0 );
1.61 fbo[i].tex_ids[j] = -1;
1.62 return;
1.63 }
.