Eilidh
Eilidh

Reputation: 1374

OpenGL - Using glTexImage2d to fill the entire screen with a texture

Two questions -

What is the best way to use a texture in OpenGL to fill the entire window?

I want to use glTexImage2D to take in an array of ints containing colour data, how would I go about doing this? (I've found a couple of pages of reference on glTexImage2D but tutorial on using it would be great)

Clarification:

I have done texturing before. I simply need help on these two specific parts.

Upvotes: 1

Views: 2828

Answers (3)

Dr. Snoopy
Dr. Snoopy

Reputation: 56377

glTexImage2D just uploads texture data, nothing more. When you have your texture, draw a texture mapped quad the size of the screen and you will draw your texture pixels to the screen.

A ortographic projection is usually used for this.

Upvotes: 3

Martin Kristiansen
Martin Kristiansen

Reputation: 10222

Also you could just upload the pixels with glDrawPixels if you don't need to update to much.

There is a nice example from Nehe on how to use textures here:

Upvotes: 0

Ben Voigt
Ben Voigt

Reputation: 283773

NeHe provides tutorials for almost any OpenGL topic.

The first lesson on using textures is #6.

Upvotes: 0

Related Questions