开发者

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

开发者 https://www.devze.com 2023-03-05 22:18 出处:网络
Two questions - What is the best way to use a texture in OpenGL to fill the entire window? I want to use glTex开发者_JAVA百科Image2D to take in an array of ints containing colour data, how would I

Two questions -

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

I want to use glTex开发者_JAVA百科Image2D 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.


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.


NeHe provides tutorials for almost any OpenGL topic.

The first lesson on using textures is #6.


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:

0

精彩评论

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