Results 1 to 2 of 2

Thread: Matrix questions.

  1. #1
    Member Contributor
    Join Date
    May 2009
    Posts
    57

    Matrix questions.

    Hey guys.
    I have some questions that I coudn't find on the internet(maybe I wasn't searching for the right thing).

    So I'm trying to implement the deferred lighting tehnique.
    I have my buffers drawn well enough.
    When I draw the lighting pass I need to have the light position in the view matrix. Note that the view changes from the perspective one to the orthogonal one in order to draw the albedo buffer.

    Anyway to get to the point I want to calculate the viewMatrix. Is that by any chance the projection matrix multiplied with the modelviewmatrix?

    I'll have to send the old viewmatrix to the shader in order to get the light position in the viewmatrix.


    Next in order is something about viewplanes and frustum.
    I have the frustum as this "float frustum[6][4]". The function I used to calculate it is not written by me and thus I'm not sure which are the near and far planes (vector4).
    Aparently I need that too in order to get things right.

  2. #2
    Senior Member OpenGL Pro Ilian Dinev's Avatar
    Join Date
    Jan 2008
    Location
    Watford, UK
    Posts
    1,294

    Re: Matrix questions.

    frustum and field-of-view go into projection-matrix
    camera position and rotation go into view-matrix
    object's position goes into model-matrix.

    Right after you finish doing transformations for the camera, - you have the view-matrix. Appending more transformations to it makes that matrix the "model-view matrix".
    If you're using the glTranslatef/glRotatef/etc, then you should retrieve that view-matrix by glGetFloatv(GL_MODELVIEW_MATRIX,..) right before concatenating models' transformations.

    (view = camera = eye) .

Similar Threads

  1. questions about Matrix using glm
    By DragonForce99 in forum OpenGL: General
    Replies: 1
    Last Post: 07-02-2014, 04:00 AM
  2. questions about Matrix using glm
    By DragonForce99 in forum OpenGL: General
    Replies: 2
    Last Post: 06-13-2014, 09:28 AM
  3. Questions On The Matrix Stack
    By Carmine in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 01-24-2014, 06:19 PM
  4. Basic questions about projection matrix
    By henne in forum OpenGL: General
    Replies: 3
    Last Post: 06-13-2011, 10:26 PM
  5. Some Simple Questions about Matrix
    By jenny_wui in forum OpenGL: General
    Replies: 5
    Last Post: 09-03-2010, 12:02 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean