On Monday 29 August 2005 08:10, Sergey Plis wrote:
> Hello!
>
> I am trying to use 3 different textures in one application with 3
> different glcanvases, a texture per canvas. What is the correct way?
>
> 1. To initialize each texture for each canvas in draw method
> 2. To initialize all three textures each time one of glcanvases is drawn
>
> I tried some approaches - nothing works. Only the last texture loaded
> is displayed.

I tried a few possible variances, and the result is:

- Initialize used textures per canvas - i.e. all textures you plan to use in 
one canvas has to be initialized in this canvas. Once per creation is 
sufficient.

The dragon and the xmas tree both have "one more" buttons where you can 
create another window with another canvas. You can vary the way the 
textures are created - the only way to have them show up in the new canvas 
is the one used now (each canvas needs texture initialization).

This worked for me even with different textures. I.e. I modified the dragon 
so that the second incarnation uses a different texture - both dragons are 
drawn with their respective texture set, but the texture numbers are the 
same for both (texture numbers are related to OpenGL context).

This reminds me that the GL canvas really needs a separate plugable 
initialization method. The way user code for initialization (like texture 
loading) is far from ideal.

-- 
Bernd Paysan
"If you want it done right, you have to do it yourself"
http://www.jwdt.com/~paysan/

Attachment: pgpHfKqRpXq8J.pgp
Description: PGP signature

Reply via email to