views:

977

answers:

1

Hi all,

My team is currently limited to drawing images on an opengl 1.4 platform, which means that we can't use any nifty texture mapping to draw an image (yes, we're confined to using the intel integrated graphics platform, it's very annoying). So far, we're able to draw, scale, and flip an image, but the guy doing the graphics claims that rotation via glRotate can't be done while using glDrawPixels, that we'd have to go to textures and so forth, which don't work on the Intel platform.

I've bet him lunch that there is a rotation function, like glRotate, that will work for straight bitmaps. Does such a function exist? Would glRotate work? I'm a bit of a novice to this graphics thing, but it seems ludicrous that the library wouldn't allow for bitmap rotation except via texture rotation.

Thanks.

+5  A: 

You can't use glRotate with glDrawPixels.

glDrawPixels is the worst and least performant way to get pixels onto the screen by far. You will even get better performance by putting the pixels onto the screen using a bad written software-rasterizer.

In short glDRawPixels will copy pixel data from the process-memory to the graphics memory and will do some very trivial transformations like flipping and scaling. Everything more advanced (like rotating) requires you to actually use the features of the graphic-chipset. E.g. You have to use textures.

And textures do work. They also work well with GL 1.4 and the Intel graphic chipsets. I've worked on such a chipset myself for quite a while. You won't get the performance of modern ATI or NVIDIA chipsets, but they aren't that bad either.

My best bet is that someone tried to create textures of a non power of two size, failed to do so and decided that textures in general don't work on the chipset.

That's not true. They do work. You just have to know that OpenGL requires you to create textures at power of two dimensions and that you have to either use a subrectangle of the larger texture or put multiple images into one very large texture (the later is called a texture atlas).

You can compensate for the smaller image within a larger texture by adjusting the texture-coordinates.

Nils Pipenbrinck
Yes I do. Let's hope he chooses someplace tasty.
mmr
Give it a try: First loading up the pixel-data to a texture and then rotating it will be horrible slow, but it won't be slower than calling glDrawPixels at the first place.
Nils Pipenbrinck
@nils: So say someone wanted to get all the pixels from the screen, make some modifications, then put them back on the screen. What they should do is do the changes, turn it into a texture, create something to put the texture on, then just display that?
Will Mc
@Will, exactly. OpenGL is ment as an output only API. Reading back pixels from the screen works but has a very high performance price.
Nils Pipenbrinck