开发者

OpenGL C#, loading textures in upside down

Is there a way to load images into openGL with the y-coords flipped? (upside down). I'm using the .NET Bitmap and BitmapData classes, a开发者_Python百科nd passing BitmapData.Scan0 to OpenGL.

Flipping the Bitmap on the CPU using .RotateFlip() is too slow.

Aside from flipping all of the texcoords, can I solve this problem in our engine?


If you render using a fragment shader, you get to interpret the u, v coordinates anyway you want. Turning them upside down should be trivial and (nearly) free.

Other than that, just flip your texture coordinates. It should not be difficult to achieve this.


You should be able to just alter your texture coordinates to achieve the desired flip.


I think the answer is no. OpenGl takes a pointer to an image as texture data, and I never seen any way to tell him to flip the lines.


(edit: Disregard, question is textures instead of DrawPixels)

This worked for me in C++.

Q: "How can I make glDrawPixels() draw an image flipped upside down?"

A: "Try glPixelZoom( 1.0, -1.0 ). Similarly, an image can be flipped left to right with glPixelZoom(). Note that you may have to adjust your raster position to position the image correctly."

src: http://www.mesa3d.org/brianp/sig97/gotchas.htm

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜