tksuoran's picture

GL.ReadPixels() interferes with pixelstore pack alignment

Project:The Open Toolkit library
Version:all versions
Component:Code
Category:bug report
Priority:minor
Assigned:Unassigned
Status:closed (invalid)
Description

Some forms of GL.ReadPixels() suggest user that allocating width*height array of given type would be sufficient. This is not correct with the default pixelstore alignment (4).

Further, GL.ReadPixels does "GCHandle pixels_ptr = GCHandle.Alloc(pixels, GCHandleType.Pinned)".
It is unclear if the alignment of pixels_ptr matches with the alignment of pixels.

It could be useful to add note about the default pixel store alignment and its consequences when an access violation exception is noticed in GL.ReadPixels.

Alternatively GL.ReadPixels could silently add extra alignment for the default pixel store alignment.


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

#1

Status:open» closed (invalid)

OpenTK is a straight OpenGL binding. Users are expected to read and understand the OpenGL specification in order to use it correctly. It is unfortunate that OpenGL has a lot of details that are easy to get wrong, but OpenTK is not in a position to fix that.

Besides, even if this was possible to implement (which it isn't), modifying a parameter without asking the user is a recipe for disaster.