Ho un problema con il rendering di texture e framebuffer offscreen con OpenGLES
su iPhone.Render to texture framebuffer o offscreen
alt text http://j.imagehost.org/0923/IMG_0020.pngalt text http://j.imagehost.org/0725/IMG_0019.png
prima immagine mostra mattonelle del mahjong resi alla CAEAGLLayer
direttamente e questo è corretto. Il secondo mostra le tessere rese su framebuffer fuori schermo, copiate su texture usando glCopyTexImage2D
e la trama resa su CAEAGLLayer
. Entrambi usano quad bianco opaco per lo sfondo. Ho anche provato a eseguire il rendering direttamente sulla texture ma l'effetto era lo stesso del framebuffer fuori schermo.
Il mio codice per la creazione di framebuffer:
GLuint framebuffer;
glGenFramebuffersOES(1, &framebuffer);
glBindFramebufferOES(GL_FRAMEBUFFER_OES, framebuffer);
GLuint renderbuffer;
glGenRenderbuffersOES(1, &renderbuffer);
glBindRenderbufferOES(GL_RENDERBUFFER_OES, renderbuffer);
glRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_RGB8_OES,
512, 512);
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES,
GL_RENDERBUFFER_OES, renderbuffer);
ho trarre tutte le tessere da una texture atlante con una chiamata al glDrawElements
usando VBO per il passaggio di dati interlacciati vertice (coordinate, coordinata della texture, colore). Io uso il formato texture RGBA8888, disegnando ogni immagine su due triangoli (quad) con la funzione di fusione glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
. Non uso il buffer di profondità (in tutti i casi).
Qualcuno può dirmi quale potrebbe essere il problema?
Che non è corretto circa le immagini di rendering? Cosa ti aspetti che assomigli? – Frogblast
@Frogblast Il primo, che non è reso al framebuffer fuori dallo schermo, né alla trama, è corretto. – sfider
Codice insufficiente mostrato. Gli FBO probabilmente non sono il problema. – karx11erx