Results 1 to 3 of 3

Thread: OpenGL-ES 2.0 problem

  1. #1
    Junior Member
    Join Date
    Jan 2009
    Posts
    4

    OpenGL-ES 2.0 problem

    Hi. Im having problem with my simple OpenGL-ES program.

    I think its the view or projection matrix. Heres what it looks like:

    Projection:
    Code :
    mProjM.transpose();
     
    float f = 1.0 / tan( fov / 2);
     
    mProjM[0][0] = f/aspect;	mProjM[0][1] = 0.0; mProjM[0][2] = 0.0;	               mProjM[0][3] = 0.0;
    mProjM[1][0] = 0.0;		mProjM[1][1] = f;    mProjM[1][2] = 0.0;	                mProjM[1][3] = 0.0;
    mProjM[2][0] = 0.0;		mProjM[2][1] = 0.0; mProjM[2][2] = fz/(nz-fz);        	mProjM[2][3] = -1.0;
    mProjM[3][0] = 0.0;		mProjM[3][1] = 0.0; mProjM[3][2] = (nz*fz)/(nz-fz);	mProjM[3][3] = 0.0;

    View Matrix:
    Code :
    	mLookV = mLookV.normalize();
     
    	mUpV = cross(mLookV, mRightV);
    	mUpV = mUpV.normalize();
     
    	mRightV = cross(mUpV, mLookV);
    	mRightV = mRightV.normalize();
     
    	float x = dot(-mCamPos, mRightV);
    	float y = dot(-mCamPos, mUpV);
    	float z = dot(-mCamPos, -mLookV);
     
    	mViewM[0][0] = mRightV.x(); 
    	mViewM[0][1] = mRightV.y(); 
    	mViewM[0][2] = mRightV.z(); 
    	mViewM[0][3] = x;   
     
    	mViewM[1][0] = mUpV.x();
    	mViewM[1][1] = mUpV.y();
    	mViewM[1][2] = mUpV.z();
    	mViewM[1][3] = y;  
     
    	mViewM[2][0] = -mLookV.x(); 
    	mViewM[2][1] = -mLookV.y(); 
    	mViewM[2][2] = -mLookV.z(); 
    	mViewM[2][3] = z;   
     
    	mViewM[3][0] = 0.0f;
    	mViewM[3][1] = 0.0f;
    	mViewM[3][2] = 0.0f;
    	mViewM[3][3] = 1.0f;

    Is this correct?

  2. #2
    Junior Member
    Join Date
    Sep 2010
    Posts
    12

    Re: OpenGL-ES 2.0 problem

    See my matrix.h and matrix.c in my engine. viewtopic.php?f=9&t=3140

    You'll be able to make all the matrices you need.

  3. #3

    Re: OpenGL-ES 2.0 problem

    Thank you for the provided link, a very helpful one!!!

Similar Threads

  1. OpenGL Problem
    By twnuck in forum KTX
    Replies: 1
    Last Post: 05-02-2011, 06:39 PM
  2. OpenGL Problem
    By pczone in forum OpenGL ES general technical discussions
    Replies: 1
    Last Post: 06-05-2009, 08:22 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
  •