Jump to content


QUAD of width 1


  • You cannot reply to this topic
2 replies to this topic

#1 me_here_me

    New Member

  • Members
  • PipPip
  • 24 posts

Posted 02 July 2007 - 09: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

#2 Nils Pipenbrinck

    Senior Member

  • Members
  • PipPipPipPip
  • 597 posts

Posted 02 July 2007 - 10: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();


My music: http://myspace.com/planetarchh <-- my music

My stuff: torus.untergrund.net <-- some diy electronic stuff and more.

#3 me_here_me

    New Member

  • Members
  • PipPip
  • 24 posts

Posted 02 July 2007 - 12:02 PM

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





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users