
modifying textures @ runtime?
is there a simple, memory-saving way to modify a texture at runtime or do I have to keep a copy and load it every time
???
------------------------------------------------------
Regret Nothing - Learn Everything

------------------------------------------------------ Regret Nothing - Learn Everything
Use glTexSubImage2D if you''re loading your texture with glTexImage2D (mostly the case) or use glCopyTexSubImage2D if you''re loading you texture with glCopyTexImage2D (rarely, but may happen).
Thx, but can you explain the parameters:
GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels
I assume {xoffset, yoffset} is the top left coner of the area to change, width and height the size of that area and pixels the data. Am I right? And the rest?
------------------------------------------------------
Regret Nothing - Learn Everything
GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels
I assume {xoffset, yoffset} is the top left coner of the area to change, width and height the size of that area and pixels the data. Am I right? And the rest?
------------------------------------------------------
Regret Nothing - Learn Everything
------------------------------------------------------ Regret Nothing - Learn Everything
void glTexSubImage2D(
GLenum target,
GLint level,
GLint xoffset,
GLint yoffset,
GLsizei width,
GLsizei height,
GLenum format,
GLenum type,
const GLvoid *pixels
);
target must be GL_TEXTURE_2D (since this is a 2d texture)
level is the mip-map level you wish to change
You are correct about the offset, and width/height parameters.
format specifies the color format of the pixels you are sending, such as GL_RGBA, or GL_RGB.
type specifies the type of data you are sending, such as GL_FLOAT or GL_UNSIGNED_BYTE.
pixels is simply a pointer to the new image data.
J.W.
GLenum target,
GLint level,
GLint xoffset,
GLint yoffset,
GLsizei width,
GLsizei height,
GLenum format,
GLenum type,
const GLvoid *pixels
);
target must be GL_TEXTURE_2D (since this is a 2d texture)
level is the mip-map level you wish to change
You are correct about the offset, and width/height parameters.
format specifies the color format of the pixels you are sending, such as GL_RGBA, or GL_RGB.
type specifies the type of data you are sending, such as GL_FLOAT or GL_UNSIGNED_BYTE.
pixels is simply a pointer to the new image data.
J.W.
A thread about modifying textures in real time simply needs the obvious reference to pbuffers and render-texture functionalities

Previously "Krohm"
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement