We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
Texture Mapping (Read 1259 times)
Texture Mapping
Apr 29th, 2007, 12:46am
 
I'm new to processing and graphics programming in general, and when it comes to texture mapping, I'm completely lost.  Can anyone help me out by explaining how openGL functions like glTexImage2D and glTexCoord*D actually work together or give me a link to someplace that explains it well, because I've been working on a project to map a brick wall texture .ppm file to a torus and it's driving me crazy.

I have the torus rendering correctly but everything I try gives me either a completely black image or the torus is colored with just the color I originally specify for it without any texture.

Thanks a lot for any help.
Re: Texture Mapping
Reply #1 - Apr 29th, 2007, 1:26am
 
first of all, *do not* use the opengl functions, unless you need something specific from some low-level opengl api. use the built-in functions and your code will be much simpler, and more compatible with others.

to that end, use texture() to set the texture, and the version of the vertex() method that sets texture coordinates. an example is in the reference for texture:
http://processing.org/reference/texture_.html

also, don't bother with ppm, just make it png or jpg or some other format that's supported by default by loadImage().
Re: Texture Mapping
Reply #2 - May 4th, 2007, 8:30am
 
hi there fry,
i was wondering, how do you make textures to wrap around a model in processing? i tried to use opengl directly and set GL_WRAP but still no luck..
ideas?

vic
Re: Texture Mapping
Reply #3 - May 8th, 2007, 12:58am
 
Currently Processing doesn't support tiled textures, as it clamps any input texture coordinates to the 0->1 range.  I meant to file this in the bugs db (and maybe do it) as a possible enhancement, but I haven't gotten around to it yet.  The problem is just making sure everything works consistently between OpenGL and P3D modes...for now, you'll have to tile things by hand.

ewjordan
Page Index Toggle Pages: 1