Copy OpenGL texture from one target to another -
i have iosurface backed texture limited gl_texture_rectangle_arb , doesn't support mipmapping. i'm trying copy texture texture bound gl_texture_2d , perform mipmapping on 1 instead. i'm having problems copying texture. can't work copying gl_texture_rectangle_arb. here code:
var arbtexture = gluint() glgentextures(1, &arbtexture) /* stuff fill arbtexture image data */ glenable(glenum(gl_texture_rectangle_arb)) glbindtexture(glenum(gl_texture_rectangle_arb), arbtexture) // @ point, if return here, arbtexture draws fine // trying copy texture (fbo , texture generated previously): glbindframebuffer(glenum(gl_framebuffer), fbo); glframebuffertexture2d(glenum(gl_read_framebuffer), glenum(gl_color_attachment0), glenum(gl_texture_rectangle_arb), arbtexture, 0) glframebuffertexture2d(glenum(gl_draw_framebuffer), glenum(gl_color_attachment1), glenum(gl_texture_rectangle_arb), texture, 0) gldrawbuffer(glenum(gl_color_attachment1)) glblitframebuffer(0, 0, glsizei(width), glsizei(height), 0, 0, glsizei(width), glsizei(height), glbitfield(gl_color_buffer_bit) , glenum(gl_nearest)) glbindtexture(glenum(gl_texture_rectangle_arb), texture) // @ point, texture black
the arguments of second glframebuffertexture2d()
not match description:
glframebuffertexture2d( glenum(gl_draw_framebuffer), glenum(gl_color_attachment1), glenum(gl_texture_rectangle_arb), texture, 0)
since you're saying second texture gl_texture_2d
, needs matched textarget argument of call. should be:
glframebuffertexture2d( glenum(gl_draw_framebuffer), glenum(gl_color_attachment1), glenum(gl_texture_2d), texture, 0)
btw, gl_texture_rectangle
standard in opengl 3.1 , later, there should no need use arb form.
Comments
Post a Comment