forked from davidgfnet/opengx
-
-
Notifications
You must be signed in to change notification settings - Fork 5
Implement glReadPixels #77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or 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
Member
|
whoops, sorry. I'll let you rebase this when you get a chance. |
The computation was incorrect.
Remove constructors with parameters and instead add separate methods to set the desired texel data.
Do not instantiate the Texture object for a single pixel, but just once at the beginning of the texture creation. This does not save us any memory allocations (as a matter of fact, the Texel object is allocated on the stack at no cost), but allows us to implement some optimizations in the conversion process.
It's easier if we consider the texel as a single 16-bit element, rather than two different bytes.
This code is all about C++ templates, which we will be using from another file, too.
This will be used in glReadPixels, where we have to convert an EFB image into OpenGL pixel data.
These can be used by raster.c as well.
This will be used by glReadPixels().
Partial implementation, where we read the color buffer only.
This makes it easier to lookup the type in the GL.h header file.
The simplest way to support them is by using the RGBA8 format, but the optimal way would be using I8 in order to save memory; however, that would require playing a bit with the TEV setup and these would cease to be just simple textures.
The I8 format used by GX sets the alpha value to the intensity of the pixel, but GL_LUMINANCE should be completely opaque. Therefore, setup the TEV so that the alpha is not read from the texture, but from a register where we've set it to 255.
We also support the GL_DEPTH_BIAS and GL_DEPTH_OFFSET, because they help in visualizing the Z buffer if it's drawn back to the screen (otherwise most Z-changes are too subtle to be perceived when printed as a colour).
Collaborator
Author
Rebased :-) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.