[gameprogrammer] Re: GL
- From: Scott Harper <lareon@xxxxxxxxxxx>
- To: gameprogrammer@xxxxxxxxxxxxx
- Date: Fri, 3 Aug 2007 11:42:10 -0600
I didn't even know that call existed!! I'm so happy to have learned
this on the sly. I was going to suggest setting up a render-to-
texture, but this seems MUCH more straightforward!
-- Scott
On 2007/08/03, at 11:32, Husam Zakaria wrote:
of course you can do that by using glCopyTextImage1D or
glCopyTextImage2D
The glCopyTexImage2D function copies pixels from the framebuffer
into a two-dimensional texture image.
void glCopyTexImage2D(
GLenum target,
GLint level,
GLenum internalFormat,
GLint x,
GLint y,
GLsizei width,
GLsizei height,
GLint border
); Parameters target The target to which the image data will be
changed. Must have the value GL_TEXTURE_2D. level The level-of-
detail number. Level 0 is the base image. Level n is the nth mipmap
reduction image. internalFormat The internal format and resolution
of the texture data. The values 1, 2, 3, and 4 are not accepted for
internalFormat. The parameter can assume one of the following
symbolic values:
ConstantR BitsG BitsB BitsA BitsL BitsI Bits
GL_ALPHA
GL_ALPHA4
4
GL_ALPHA8
8
GL_ALPHA12
12
GL_ALPHA16
16
GL_LUMINANCE
GL_LUMINANCE4
4
GL_LUMINANCE8
8
GL_LUMINANCE12
12
GL_LUMINANCE16
16
GL_LUMINANCE_ALPHA
GL_LUMINANCE4_ALPHA4
44
GL_LUMINANCE6_ALPHA2
26
GL_LUMINANCE8_ALPHA8
88
GL_LUMINANCE12_ALPHA4
412
GL_LUMINANCE12_ALPHA12
1212
GL_LUMINANCE16_ALPHA16
1616
GL_INTENSITY
GL_INTENSITY4
4
GL_INTENSITY8
8
GL_INTENSITY12
12
GL_INTENSITY16
16
GL_RGB
GL_R3_G3_B2332
GL_RGB4444
GL_RGB5555
GL_RGB8888
GL_RGB10101010
GL_RGB12121212
GL_RGB16161616
GL_RGBA
GL_RGBA22222
GL_RGBA44444
GL_RGB5_A15551
GL_RGBA88888
GL_RGB10_A21010102
GL_RGBA1212121212
GL_RGBA1616161616
x, y The window coordinates of the lower-left corner of the
rectangular region of pixels to be copied. width The width of the
texture image. Must be 2n + 2 * border for some integer n. height
The height of the texture image. Must be 2n + 2 * border for some
integer n. border The width of the border. Must be either zero or
1. Remarks
The glCopyTexImage2D function defines a two-dimensional texture
image using pixels from the current framebuffer, rather than from
main memory as is the case for glTexImage2D.
Using the mipmap level specified with level, texture arrays are
defined as a rectangle of pixels with the lower-left corner located
at the coordinates x and y, width equal to width + (2 * border),
and a height equal to height + (2 * border). The internal format of
the texture array is specified with the internalFormat parameter.
The glCopyTexImage2D function processes the pixels in a row in the
same way as glCopyPixels except that before the final conversion of
the pixels, all pixel component values are clamped to the range [0,
1] and converted to the texture's internal format for storage in
the texture array. Pixel ordering is determined with lower x and y
coordinates corresponding to lower s and t texture coordinates. If
any of the pixels within a specified row of the current framebuffer
are outside the window associated with the current rendering
context, then their values are undefined.
You cannot include calls to glCopyTexImage2D in display lists.
Note The glCopyTexImage2D function is only available in OpenGL
version 1.1 or later.
Texturing has no effect in color-index mode. The glPixelStore and
glPixelTransfer functions affect texture images in exactly the way
they affect glDrawPixels.
The following function retrieves information related to
glCopyTexImage2D:
glIsEnabled with argument GL_TEXTURE_2D
On 8/3/07, Alan Wolfe <alan.wolfe@xxxxxxxxx> wrote: Hey guys,
Does anyone know if theres a way to take part of the screen and make a
gl texture out of that?
Basically what i'm trying to do is a post processing effect where i
take whats on the screen and manipulate it. glreadpixels is going way
slow and i was thinking i only need to take an image from the screen
(video memory) and make a texture with it (more video memory) so is
there a way to do it without having to pull the pixel data into system
memory?
Thanks!!
Alan
---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html
---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html
- References:
- [gameprogrammer] GL
- From: Alan Wolfe
- [gameprogrammer] Re: GL
- From: Husam Zakaria
Other related posts:
- » [gameprogrammer] GL
- » [gameprogrammer] Re: GL
- » [gameprogrammer] Re: GL
- » [gameprogrammer] Re: GL
The glCopyTexImage2D function copies pixels from the framebuffer into a two-dimensional texture image.
void glCopyTexImage2D( GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); Parameters target The target to which the image data will be changed. Must have the value GL_TEXTURE_2D. level The level-of- detail number. Level 0 is the base image. Level n is the nth mipmap reduction image. internalFormat The internal format and resolution of the texture data. The values 1, 2, 3, and 4 are not accepted for internalFormat. The parameter can assume one of the following symbolic values:
ConstantR BitsG BitsB BitsA BitsL BitsI Bits GL_ALPHA GL_ALPHA4 4 GL_ALPHA8 8 GL_ALPHA12 12 GL_ALPHA16 16 GL_LUMINANCE GL_LUMINANCE4 4 GL_LUMINANCE8 8 GL_LUMINANCE12 12 GL_LUMINANCE16 16 GL_LUMINANCE_ALPHA GL_LUMINANCE4_ALPHA4 44 GL_LUMINANCE6_ALPHA2 26 GL_LUMINANCE8_ALPHA8 88 GL_LUMINANCE12_ALPHA4 412 GL_LUMINANCE12_ALPHA12 1212 GL_LUMINANCE16_ALPHA16 1616 GL_INTENSITY GL_INTENSITY4 4 GL_INTENSITY8 8 GL_INTENSITY12 12 GL_INTENSITY16 16 GL_RGB GL_R3_G3_B2332 GL_RGB4444 GL_RGB5555 GL_RGB8888 GL_RGB10101010 GL_RGB12121212 GL_RGB16161616 GL_RGBA GL_RGBA22222 GL_RGBA44444 GL_RGB5_A15551 GL_RGBA88888 GL_RGB10_A21010102 GL_RGBA1212121212 GL_RGBA1616161616x, y The window coordinates of the lower-left corner of the rectangular region of pixels to be copied. width The width of the texture image. Must be 2n + 2 * border for some integer n. height The height of the texture image. Must be 2n + 2 * border for some integer n. border The width of the border. Must be either zero or 1. Remarks The glCopyTexImage2D function defines a two-dimensional texture image using pixels from the current framebuffer, rather than from main memory as is the case for glTexImage2D.
Using the mipmap level specified with level, texture arrays are defined as a rectangle of pixels with the lower-left corner located at the coordinates x and y, width equal to width + (2 * border), and a height equal to height + (2 * border). The internal format of the texture array is specified with the internalFormat parameter.
The glCopyTexImage2D function processes the pixels in a row in the same way as glCopyPixels except that before the final conversion of the pixels, all pixel component values are clamped to the range [0, 1] and converted to the texture's internal format for storage in the texture array. Pixel ordering is determined with lower x and y coordinates corresponding to lower s and t texture coordinates. If any of the pixels within a specified row of the current framebuffer are outside the window associated with the current rendering context, then their values are undefined.
You cannot include calls to glCopyTexImage2D in display lists.Note The glCopyTexImage2D function is only available in OpenGL version 1.1 or later.
Texturing has no effect in color-index mode. The glPixelStore and glPixelTransfer functions affect texture images in exactly the way they affect glDrawPixels.
The following function retrieves information related to glCopyTexImage2D:
glIsEnabled with argument GL_TEXTURE_2D On 8/3/07, Alan Wolfe <alan.wolfe@xxxxxxxxx> wrote: Hey guys, Does anyone know if theres a way to take part of the screen and make a gl texture out of that? Basically what i'm trying to do is a post processing effect where i take whats on the screen and manipulate it. glreadpixels is going way slow and i was thinking i only need to take an image from the screen (video memory) and make a texture with it (more video memory) so is there a way to do it without having to pull the pixel data into system memory? Thanks!! Alan --------------------- To unsubscribe go to http://gameprogrammer.com/mailinglist.html
- [gameprogrammer] GL
- From: Alan Wolfe
- [gameprogrammer] Re: GL
- From: Husam Zakaria