Jump to content

  • Log In with Google      Sign In   
  • Create Account

Positioning 2D QUAD in front of screenview


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 WiredCat   Members   -  Reputation: 368

Like
0Likes
Like

Posted 28 May 2012 - 01:14 AM

Hello i just made and postprocess effect but i need to draw it on the whole screen not only on the part of the screeen, i decided to draw it with glulookat because glortho didn't work for me:

so what i am doing: i first draw scene then i copy it to texture and draw a quad (in example 1024x768 [not pixels]) and position it at the 0,0,0 point (starting point) the center of this quad is 512,384,0 (x,y,z)

then i call gluLookAt(512.0f,384.0f,256.0f, 512.0f,384.0f,0.0f, 0.0f,1.0f,0.0f);

but the quad i see is too big - so theres a problem how can i calculate the proper distance to draw this quad on the whole screen (screen dimensions are 1024x768 pixels) and my z_near value is 0.010f

this is what i've got now, ahh and i need this quad to be quite larger because i need to see (its really a 3d grid) some different z values from it to actually see the effect lets say z = about 200 points




Peace ;d

Edited by ___, 28 May 2012 - 01:17 AM.


Sponsor:

#2 V-man   Members   -  Reputation: 805

Like
0Likes
Like

Posted 28 May 2012 - 08:29 AM

Here you go
http://www.opengl.org/wiki/FAQ#Fullscreen_quad
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS