forked from BSVino/docs.gl
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{%glBindFramebuffer}(GL_READ_FRAMEBUFFER, source_fbo); | ||
{%glBindFramebuffer}(GL_DRAW_FRAMEBUFFER, destination_fbo); | ||
|
||
{%glBlitFramebuffer}(0, 0, source_fbo_width, source_fbo_height, 0, 0, destination_fbo_width, destination_fbo_height, GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT, GL_NEAREST); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
GLuint texture_id; | ||
{%glGenTextures}(1, &texture_id); | ||
{%glBindTexture}(GL_TEXTURE_2D, texture_id); | ||
|
||
{%glTexParameteri}(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | ||
{%glTexParameteri}(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); | ||
|
||
{%glTexParameteri}(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | ||
{%glTexParameteri}(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | ||
|
||
// texture_data is the source data of your texture, in this case | ||
// its size is sizeof(unsigned char) * texture_width * texture_height * 4 | ||
{%glTexImage2D}(GL_TEXTURE_2D, 0, GL_RGBA, texture_width, texture_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, texture_data); | ||
{%glGenerateMipmap}(GL_TEXTURE_2D); // Unavailable in OpenGL 2.1, use gluBuild2DMipmaps() insteads. | ||
|
||
{%glBindTexture}(GL_TEXTURE_2D, 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{%glBindTexture}(GL_TEXTURE_2D, texture_id); // texture_id was given by {%glGenTextures} | ||
|
||
// texture_data must be large enough to hold the entire texture, in this case | ||
// sizeof(float) * width * height * 3 | ||
{%glGetTexImage}(GL_TEXTURE_2D, 0, GL_RGB, GL_FLOAT, texture_data); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters