Confused of Textures

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Confused of Textures

symla
I started using JOGL a week ago. The time until know I've understood the concepts of drawing and manipulating the primitives by applying shaders.

But now I'm confused about how textures work. Last two days I went through several tutorials, forums etc. But everything I try doesn't work.

Would anyone mind responding me with the necessary steps of loading and applying a texture to a quad? (I use GL 2)


Symla
Reply | Threaded
Open this post in threaded view
|

Re: Confused of Textures

gouessej
Administrator
Hi

Use TextureIO to create a Texture object from a file or a stream containing your image. Call Texture.enable(GL) to enable the texture target and Texture.bind(GL) to bind this texture to the GL context. Then, perform your drawing, keep in mind that you have to provide texture coordinates, they should be stored in your vertex array or in your VBO. After that, call Texture.disable(GL).

Please be more accurate about what works and what doesn't.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Confused of Textures

symla
Thanks for your respond!

Now it works. While working through several tutorials, some considering the TextureIO class and some using the manual way of uploading and binding a texture, I wasn't sure anymore whether it has to be a mix of both ways etc., because the examples didn't work for me in some case.

Now I know how to use TextureIO. I even got the manual way working.