I think it is like glOrtho. I found this on koders.com: public void glOrthof(float left, float right, float bottom, float top, float near, float far) { Matrix.orthoM(mMatrix, mTop, left, right, bottom, top, near, far); }
I think maybe when you use glOrtho, the depth buffer stuff is backwards. You might have to change GL_LESS to GL_GREATER using glDepthFunc or something. I switched one of my games to glOrtho back in the day. IIRC, I thought it would be easy, and it turned out to be a root canal. On Friday, September 14, 2012 4:25:39 AM UTC-5, reaktor24 wrote: > > Hi > > Thanks for your replies. So its not like the old glOrtho then? Ok, I will > have a play with it later tonight and see how I get on. Ideally I would > like the origin in the bottom left corner as that seems the most logical to > me. Thanks again. > > Steve > > On Friday, September 14, 2012 10:19:45 AM UTC+1, RichardC wrote: > >> The nice thing about frustumM and orthoM is that they take the same >> parameters :) They just produce different view transformations. >> >> The distance parameters (near and far) are the clip planes (which you >> still have in an orthographic projection) in front of the camera position >> (so they should both be positive). >> >> The other parameters control the volume of the view space projected onto >> your graphics window and if you want the x,y origin in the centre of the >> screen then you need to pass in -x, +x, -y, +y (for given values of x and >> y), as your screen is not square you need to workout it's aspect ratio so >> as to not "squash" the transformation. >> >> >> On Friday, September 14, 2012 9:54:43 AM UTC+1, reaktor24 wrote: >>> >>> Hi Richard >>> >>> Thanks for your reply but I don't want to use frustumM I want to use >>> orthoM. I want a 2D projection not 3D hence the -1 to +1. I have use >>> frustumM and it works ok, I can see the triangle. What is the negative >>> aspect ratio about? I don't understand that. It should really work like the >>> old glOrtho function but I guess it doesn't which is a shame. >>> >>> Steve >>> >>> On Friday, September 14, 2012 9:46:58 AM UTC+1, RichardC wrote: >>> >>>> See: >>>> >>>> android-sdk\samples\android-10\ApiDemos\src\com\example\android\apis\graphics\GLES20TriangleRenderer.java >>>> >>>> for Matrix.frustumM(mProjMatrix, 0, -ratio, ratio, -1, 1, 3, 7); >>>> >>>> which is similar. >>>> >>>> There is a lot of information out there on OpenGL projections, >>>> I suggest you read some of it. >>>> >>>> Note that: >>>> * near and far should both be +ve as they are distances in front of the >>>> camera in the direction the camera is looking. >>>> * if your triangle is at 0 on the z-axis you will need to move your >>>> camera position (which defaults to [0,0,0]) so you can see it. >>>> >>>> >>>> On Friday, September 14, 2012 9:27:35 AM UTC+1, reaktor24 wrote: >>>>> >>>>> I have a very simple application which draws a triangle at zero on the >>>>> z axis. I want an orthographics view but for the life of me this >>>>> function won't work. It just shows a black screen with no triangle. >>>>> How exactly do you use this function? I did the obvious thing which >>>>> is: >>>>> >>>>> Matrix.orthoM(projection,0,0,width,0,height,-1,1); >>>>> >>>>> >>>>> Although seeing some peoples source code they are doing all sorts of >>>>> stuff which I would of expected to be inside the orthoM method (like >>>>> calling tan functions and dividing etc). So how exactly are you >>>>> supposed to use this function? >>>>> >>>>> Steve >>>>> >>>> -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en