Board index » delphi » OpenGL textures

OpenGL textures

Hi all,

It's not a "do my homework" post, but certainly is a "help me on doing my
homework" one.

I need to apply texture to images generated by several GL_POLYGON, that are
read on a kind of .plg file. That's ok.

My problem is that I need to appply texture to it, but I am not very sure on
what to do. I saw some code that applies texture read from a .rgb file, and
I can insert this on my program. But once I heard of a non trustable font
that OpenGL has some built in textures. Is that true? If so, I'd prefer to
use this kind of texture, so, for what keywords should I search for?

Thanks in advance.

Rafael

 

Re:OpenGL textures


On Mon, 19 Aug 2002 07:38:20 -0300, "Rafael Cotta"

Quote
<rcotta.nos...@ig.com.br> wrote:
>It's not a "do my homework" post, but certainly is a "help me on doing my
>homework" one.

Good, I'll give you some clues.

Quote
>I need to apply texture to images generated by several GL_POLYGON, that are
>read on a kind of .plg file. That's ok.

First you need to enable texturing, GL_TEXTURE_2D. Then you need to
allocate a texture "handle" using glGenTextures. Next you need to set
the active texture, using glBindTexture. Then you set the texture
min/max filters using glTexParameter.

Now you're ready to load your texture using glTexImage2D. For an 24bit
texture set "internalformat" to 3, and make sure the width and height
are powers of two (ie 64 128 etc). If you load bitmaps or similar, you
want to set "format" to GL_BGR_EXT. Opengl copies the image data so
you don't need to keep it around after its been loaded.

Now you've loaded the texture "into" opengl. Time to use it.

Before calling glBegin() make sure you set the active texture.

For each vertex you specify you need to set the texture coordinates,
use an appropriate glTexCoord (say glTextCoord2f) function for that.

Should be it from what i recall.

- Asbj?rn

Re:OpenGL textures


"Lord Crc" <lord...@hotmail.com> escreveu na mensagem
news:h9q2muo6mdirk5qdfoloajlcr1atafvlao@4ax.com...

Quote
> On Mon, 19 Aug 2002 07:38:20 -0300, "Rafael Cotta"
> <rcotta.nos...@ig.com.br> wrote:

> >It's not a "do my homework" post, but certainly is a "help me on doing my
> >homework" one.

> Good, I'll give you some clues.

Thanks. I already have some code similar to this. And with this explanation
I can figure out now what is for what. I thought OpenGL already had some
builtin textures, and that I didn't need to use any external file as
texture.

Thanks once again.

Rafael

Re:OpenGL textures


On Mon, 19 Aug 2002 19:42:04 -0300, "Rafael Cotta"

Quote
<rcotta.nos...@ig.com.br> wrote:
>I thought OpenGL already had some
>builtin textures, and that I didn't need to use any external file as
>texture.

Ah, the only "built-in texture" it has is bright white (which you'll
get if you've done something wrong along the line :)

- Asbj?rn

Re:OpenGL textures


<VBG> been there, done that! :)
--

Paul Nicholls (Delphi 5 Professional)
"Life is like a road - occasionally you run into potholes or get
blowouts." -
Paul Nicholls

HomePage: www.southcom.com.au/~phantom
Email: paul-nicho...@hotmail.com
(Replace "-" with "_" to reply)

Quote
"Lord Crc" <lord...@hotmail.com> wrote in message

news:3q33mucoc8kpvfuoe18rune4skddca27f3@4ax.com...
Quote
> On Mon, 19 Aug 2002 19:42:04 -0300, "Rafael Cotta"
> <rcotta.nos...@ig.com.br> wrote:

> >I thought OpenGL already had some
> >builtin textures, and that I didn't need to use any external file as
> >texture.

> Ah, the only "built-in texture" it has is bright white (which you'll
> get if you've done something wrong along the line :)

> - Asbj?rn

Other Threads