سؤال

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, and 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?

هل كانت مفيدة؟

المحلول

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.

نصائح أخرى

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.

(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

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top