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.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › Texture on a quad strip
Page Index Toggle Pages: 1
Texture on a quad strip? (Read 1484 times)
Texture on a quad strip?
Mar 26th, 2008, 10:41pm
 
Hey,

I'm trying to apply a texture to a quad strip, but it doesn't appear at all. Is there any special way to texture one? I'm doing it like this:


PImage tex = loadImage("foo.jpg");

beginShape(QUAD_STRIP);
 texture(tex);
 textureMode(ABSOLUTE);

 vertex(x,y,z,0,0);
 vertex(x,y,z,1,0);
 vertex(x,y,z,0,1);
 vertex(x,y,z,1,1);
endShape();


is there any reason that it wouldn't work?
Re: Texture on a quad strip?
Reply #1 - Mar 27th, 2008, 5:59pm
 
Is it textureMode(NORMALIZED) instead?
Re: Texture on a quad strip?
Reply #2 - Mar 27th, 2008, 10:49pm
 
Yeah, sorry- I had put that in my code, I just wrote it in my example wrong. Maybe the texture isn't at the right bit depth? I'll just check.
Re: Texture on a quad strip?
Reply #3 - Mar 27th, 2008, 11:00pm
 
Nah, texture seems fine- I've tried several formats as well :/
Re: Texture on a quad strip?
Reply #4 - Mar 28th, 2008, 4:37am
 
this works fine for me, P3D and OPENGL.

Quote:
size(200,200,P3D);

PImage tex = loadImage("foo.png");

int x1 = 10;
int x2 = width - x1;
int y1 = 10;
int y2 = height - y1;

beginShape(QUAD_STRIP);
 texture(tex);
 textureMode(NORMALIZED);

 vertex(x1, y1, 0, 0, 0);
 vertex(x2, y1, 0, 1, 0);
 vertex(x1, y2, 0, 0, 1);
 vertex(x2, y2, 0, 1, 1);

endShape();
Re: Texture on a quad strip?
Reply #5 - Mar 28th, 2008, 12:32pm
 
Maybe it's something to do with your image - is it a power of 2? Sizes like 400x400 seem to work but I always try to use ones like 128x128, 256x256 etc. Smiley

I use PNG 24-bit by the way.
Re: Texture on a quad strip?
Reply #6 - Mar 28th, 2008, 10:07pm
 
It's 100x100- I'll try a power of 2
Page Index Toggle Pages: 1