Re: Texture colour wrapping
Brice Thurin <[email protected]>
| Newsgroups | gmane.comp.python.opengl.user |
|---|---|
| Message-ID | <CAMww5+bYb_wOFzfG0EUh9x3T6tpVyA5DBi=KtN4=cuBhvpXgUQ@mail.gmail.com> |
Hi Dirk, Thanks for your help. So if I understand properly, I first do the geometrical mapping to do the polar to cartesian transformation. Then I do the color mapping? That's sound pretty neat to me. Thanks Brice On 5 November 2011 19:02, Dirk Reiners <[email protected]> wrote: > > Hi Brice, > > On 11/05/2011 01:46 PM, Brice Thurin wrote: > > Thanks for both your reply. The range of the input data vary but I could > fix it > > if it makes things easier. > > > > Note I do not want 2pi and 4pi to both map to the same physical > location, I want > > 2pi and 4pi to be displayed with the same gray level or colour. > > Ah, ok, I was starting to get confused. You really do want the basic input > value > -> color mapping. > > That's pretty easy. Define the color map that you want to use as a texture > (1D > is fine, 2D works too). Set the texture wrapping mode to REPEAT > (glTexParameter(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_REPEAT)). This makes > OpenGL > accept any texture coordinate value and just use the fractional part to > index > into the texture. Use your input values (your -15pi to 15pi) as the > texture > coordinate for each vertex. The texture coordinates will always be between > 0 and > 1, so if you want the texture to repeat after 2pi you will either need to > divide > them by 2pi before giving them to OpenGL, or use a texture matrix to > divide. > > Hope it helps > > Dirk > > > > ------------------------------------------------------------------------------ > RSA(R) Conference 2012 > Save $700 by Nov 18 > Register now > http://p.sf.net/sfu/rsa-sfdev2dev1 > _______________________________________________ > PyOpenGL Homepage > http://pyopengl.sourceforge.net > _______________________________________________ > PyOpenGL-Users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/pyopengl-users > ------------------------------------------------------------------------------ RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 _______________________________________________ PyOpenGL Homepage http://pyopengl.sourceforge.net _______________________________________________ PyOpenGL-Users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/pyopengl-users