Results 1 to 3 of 3
  1. #1
    zFollette is offline ▼ dafuq did I do?
    Join Date
    Dec 2013
    Posts
    203
    Rep Power
    0

    Default Flipping these coordinates.

    Well, I am making a minimap for my 3D project and as expected, the minimap renders weird. It is displaying as if it was facing right. Here is a picture:

    EDIT: Never mind, I fixed it. Code posted.

    Flipping these coordinates.-image.png

    My mind is at a blank right now, I've had a really long day so I am going to make this post short and sweet. Code:

    Java Code:
    glEnable(GL_BLEND);
            glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
            glColor4f(1, 1, 1, 0.5f);
            glBegin(GL_QUADS);
            glVertex2i(10, 10);
            glVertex2i(210, 10);
            glVertex2i(210, 210);
            glVertex2i(10, 210);
            glEnd();
            
            int[] pos = getChunk((int) position.x, (int) position.z);
    
            for (int x = 0; x < 10; x++) {
                for (int y = 0; y < 10; y++) {
                    if (chunk[pos[0]][pos[1]].isActive(x, 1, y)) {
                        glColor4f(0, 0, 0, 0.5f);
                        glBegin(GL_QUADS);
                        int x1 = 200 - (x * 20) + 10;
                        int x2 = 200 - ((x * 20) + 20) + 10;
                        
                        int y1 = (y * 20) + 10;
                        int y2 = ((y * 20) + 20) + 10;
                        
                        glVertex2i(y1, x2);
                        glVertex2i(y2, x2);
                        glVertex2i(y2, x1);
                        glVertex2i(y1, x1);
                        glEnd();
                    }
                }
            }
            glDisable(GL_BLEND);
    Note that this is openGL, but the coordinate problem has nothing to do with that specifically.
    Last edited by zFollette; 01-13-2014 at 10:29 PM.

  2. #2
    pj6444 is offline Senior Member
    Join Date
    Jan 2013
    Posts
    165
    Rep Power
    2

    Default Re: Flipping these coordinates.

    Where did you learn to use OpenGL? Did you also use LWJGL?

  3. #3
    zFollette is offline ▼ dafuq did I do?
    Join Date
    Dec 2013
    Posts
    203
    Rep Power
    0

    Default Re: Flipping these coordinates.

    Quote Originally Posted by pj6444 View Post
    Where did you learn to use OpenGL? Did you also use LWJGL?
    Yes, LWJGL. I learned by myself.

Similar Threads

  1. Flipping square box inside picture help
    By sman865 in forum New To Java
    Replies: 3
    Last Post: 10-16-2010, 08:10 PM
  2. Replies: 4
    Last Post: 06-17-2010, 04:23 AM
  3. Replies: 1
    Last Post: 06-17-2010, 04:06 AM
  4. flipping memory cards if they are not matched...
    By yanipao in forum New To Java
    Replies: 8
    Last Post: 10-18-2009, 02:25 AM
  5. Rotating and flipping an image in SWT
    By Java Tip in forum SWT Tips
    Replies: 0
    Last Post: 07-02-2008, 08:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •