PDA

View Full Version : QUAD of width 1


me_here_me
07-02-2007, 02:27 AM
hi
I have a port of size 512x512. can I draw a QUAD of length 1 and width 512 using glVertex2f.

actually I am binding a 512 x 1 texture with a shader and therefore I want to render a Quad with length 1 and width 512.

thanks in advance

Nils Pipenbrinck
07-02-2007, 03:17 AM
Maybe something like this?


glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho (0, RenderTargetW, 0, RenderTargetH, 0, 256);
glViewport (0,0,RenderTargetW, RenderTargetH);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

glColor4ub (255,255,245,255);

glBegin (GL_QUADS);
glVertex2f(0,0);
glVertex2f(0,512);
glVertex2f(1,512);
glVertex2f(1,0);
glEnd();

me_here_me
07-02-2007, 05:02 AM
yeah!! this is what i tried as well but I was tempted to use values in the range 0 to 1, which is common with glVertex2f :) (for no specific reason)

something like:
glBegin (GL_QUADS);
glVertex2f(-1,-0.5);
glVertex2f(-1,0.45);
glVertex2f(1,0.45);
glVertex2f(1,-0.5);
glEnd();

anyway, I would use the one you proposed :)

thanks a lot