Using XY

Apprentice
Posts: 14
Joined: 2008.08
Post: #1
How do I use X and Y in an OpenGL view? Google has failed to provide an answer Sad

The code I'm using to define coordinates for a square:

Code:
    GLfloat squareVertices[] = {
        -0.5f, -0.5f,
        0.5f,  -0.5f,
        -0.5f,  0.5f,
        0.5f,   0.5f,
    };

How do I set up the view so it defines all this in pixels from the bottom-left instead of from the centre?
Quote this message in a reply
Moderator
Posts: 1,560
Joined: 2003.10
Post: #2
glOrtho(0, width, 0, height, -1, 1);
Quote this message in a reply
Apprentice
Posts: 14
Joined: 2008.08
Post: #3
ThemsAllTook Wrote:glOrtho(0, width, 0, height, -1, 1);

Is that available in OpenGL ES? I get an error when using that Sad
Quote this message in a reply
Moderator
Posts: 1,560
Joined: 2003.10
Post: #4
Simie Wrote:Is that available in OpenGL ES? I get an error when using that Sad

Oops, OpenGL ES calls it glOrthof instead of glOrtho. I knew something was different...
Quote this message in a reply
Apprentice
Posts: 14
Joined: 2008.08
Post: #5
ThemsAllTook Wrote:Oops, OpenGL ES calls it glOrthof instead of glOrtho. I knew something was different...

Ah, thanks. Smile


I think I'll need to get a book on OpenGL ES, my shaky understanding of openGL isn't good enough to try and figure it out Sad
Quote this message in a reply
Post Reply