Bugzilla – Attachment 140 Details for
Bug 375
glBlitFramebufferEXT fails when used on OS X with GLJPanel
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
Log In
[x]
|
Forgot Password
Login:
[x]
C equivalent program to validate correctness
renderbufferblit.c (text/plain), 3.48 KB, created by
Sven Gothel
on 2009-06-14 18:53:00 CEST
(
hide
)
Description:
C equivalent program to validate correctness
Filename:
MIME Type:
Creator:
Sven Gothel
Created:
2009-06-14 18:53:00 CEST
Size:
3.48 KB
patch
obsolete
>// Demonstrate correctness of OpenGL blit > >#include <stdio.h> // Header File For Standard Input / Output >#include <stdarg.h> // Header File For Variable Argument Routines >#include <string.h> // Header File For String Management >#include <stdlib.h> >#include <OpenGL/gl.h> // Header File For The OpenGL32 Library >//#include <glu.h> // Header File For The GLu32 Library >#include <GLUT/glut.h> // Header File For The GLUT Library >#include <math.h> > >// Constants ----------------------------------------------------------------- > >#define kWindowWidth 600 >#define kWindowHeight 600 > >int ww = kWindowWidth; >int hh = kWindowHeight; > >GLuint fbIds[1] = {0}; >GLuint rbIds[1] = {0}; > > >// Function Prototypes ------------------------------------------------------- > >GLvoid InitGL(GLvoid); >GLvoid DrawGLScene(GLvoid); >GLvoid ReSizeGLScene(int Width, int Height); > >void glError(int ll) { > int errnum = glGetError(); > if (errnum != 0) { > printf("OpenGL Error: %d %x\n", ll, errnum); > > switch (errnum) { > case GL_INVALID_ENUM: > printf("Invalid Enum\n"); > break; > case GL_INVALID_VALUE: > printf("Invalid Value\n"); > break; > default: > break; > } > } >} > >// Main ---------------------------------------------------------------------- > >int main(int argc, char** argv) >{ > > glutInit(&argc, argv); > glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH); > glutInitWindowSize (kWindowWidth, kWindowHeight); > glutInitWindowPosition (100, 100); > glutCreateWindow (argv[0]); > > InitGL(); > > glutDisplayFunc(DrawGLScene); > glutReshapeFunc(ReSizeGLScene); > > glutMainLoop(); > > return 0; >} > >// Init ---------------------------------------------------------------------- > >GLvoid InitGL(GLvoid) >{ > printf("InitGL\n"); >} > >// DrawGLScene --------------------------------------------------------------- > >GLvoid DrawGLScene(GLvoid) >{ > printf("DrawGLScene\n"); > > glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); > { > glMatrixMode(GL_PROJECTION); > glLoadIdentity(); > glMatrixMode(GL_MODELVIEW); > glLoadIdentity(); > glClearColor(0, 0, 1, 0.5); > glClear(GL_COLOR_BUFFER_BIT); > } > > glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, fbIds[0]); > glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0); > > glBlitFramebufferEXT(0, 0, ww, hh, > 0, 0, ww, hh, > GL_COLOR_BUFFER_BIT, > GL_NEAREST); > > glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); > > glFlush(); > glError(999); >} > >// ReSizeGLScene ------------------------------------------------------------ > >GLvoid ReSizeGLScene(int Width, int Height) >{ > printf("Resize: %d %d\n", Width, Height); > > ww = Width; > hh = Height; > > if (fbIds[0] == 0) { > // The framebuffer has never been allocated > glGenFramebuffersEXT(1, fbIds); > } > > if (rbIds[0] != 0) { > // Remove the renderbuffer if window has changed size > glDeleteRenderbuffersEXT(1, rbIds); > } > > glFlush(); > glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbIds[0]); > > glGenRenderbuffersEXT(1, rbIds); > glFlush(); > glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rbIds[0]); > glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB8, ww, hh); > glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_EXT, rbIds[0]); > > glFlush(); > int status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); > if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { > printf("Buffer not completed: %d\n", status); > } > > glClearColor(1.0f, 0.0f, 0.0f, 1.0f); > glClear(GL_COLOR_BUFFER_BIT); > > glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); > glError(1999); >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 375
:
139
| 140