Welcome on MasterOf13FPS! MasterOf13FPS

Register today or sign up if you are already a member and never miss any cool content again :)

glOrtho Fehler?

MasterOf13FPS

Administrator
Staff member
Administrator
MasterOf13FPS
Joined
Jul 11, 2020
Messages
0
Reaction score
25
Points
0
Hallo ich bin gerade dabei einen startscreen zu schreiben aber er ist verzehrt : http://prntscr.com/lpoyvu
ich rendere das bild so:
Code:
                   glClear(GL_COLOR_BUFFER_BIT);

                    //setup Matrix
                    int w = Display.getWidth();
                    int h = Display.getHeight();
                    glViewport(0, 0, w, h);
                    glMatrixMode(GL_PROJECTION);
                    glLoadIdentity();
                   glOrtho(320 - w / 2, 320 + w / 2, 240 + h / 2, 240 - h / 2, -1, 1);
                    glMatrixMode(GL_MODELVIEW);
                    glLoadIdentity();
                    glColor4f(1f, 1f, 1f, 1f);
                    glEnable(GL_TEXTURE_2D);
                    glPushMatrix();
                    //render
                    float x = w / 2 - 100, y = h / 2, width = 400, height = 400;
                    glTranslatef(x, y, 0);
                    Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("Aura/black.png"));
                    glBegin(GL_QUADS);

                    glTexCoord2f(0, 0);
                    glVertex2f(-width / 2, height / 2);

                    glTexCoord2f(0, 1);
                    glVertex2f(-width, -height / 2);

                    glTexCoord2f(1, 1);
                    glVertex2f(width / 2, -height / 2);

                    glTexCoord2f(1, 0);
                    glVertex2f(width / 2, height / 2);

                    glEnd();
//                    glFlush();
                    //sync
                    glPopMatrix();
                    glBindTexture(GL_TEXTURE_2D, 0);
                    glDisable(GL_TEXTURE_2D)
                    Display.update();
                    Display.sync(100);
ich glaube der fehler ligt bei glOrtho(320 - w / 2, 320 + w / 2, 240 + h / 2, 240 - h / 2, -1, 1);
kann mir jemand helden das zu fixen
 
Es gibt keinen Error ich will das das Bild Grade grrendert wird und nicht so wie auf dem Bild oben
ah okay, aber wieso willst du auf ein splash screen ein bild rendern? und wieso ist die methode eigentlich unnötig voll. Erstell einfach ne Klasse meinet wegen namens "ImageLoader". Dann den Konstruktor erstellen:
Code:
    public ImageLoader(ResourceLocation location, int x, int y, int width, int height) {
       this.location = location;
       this.x = x;
       this.y = y;
       this.width = width;
       this.height = height;
   }
Dann nur noch laden:
Code:
           ImageLoader iL = new ImageLoader(new ResourceLocation("Image"), 0, 0, 64, 64);
           GL11.glPopMatrix();
           iL.draw();
 
ah okay, aber wieso willst du auf ein splash screen ein bild rendern? und wieso ist die methode eigentlich unnötig voll. Erstell einfach ne Klasse meinet wegen namens "ImageLoader". Dann den Konstruktor erstellen:
Code:
 ich will halt ne start Animation haben es geht auch aber das Bild ist grumm
    public ImageLoader(ResourceLocation location, int x, int y, int width, int height) {
       this.location = location;
       this.x = x;
       this.y = y;
       this.width = width;
       this.height = height;
   }
Dann nur noch laden:
Code:
           ImageLoader iL = new ImageLoader(new ResourceLocation("Image"), 0, 0, 64, 64);
           GL11.glPopMatrix();
           iL.draw();
erstmal danke für deine Antwort aber ich will eine startanimation und die rendere ich indem ich einselnde Bilder nacheinander rendere das ganze funktioniert auch aber es das Bild ist halt krumm und es wäre gerade schöner
 
Last edited by a moderator:
ich will eine startanimation und die rendere ich indem ich einselnde Bilder nacheinander rendere
Aber jeden einzelnen Frame so zu rendern macht das ganze hardcoded af. Hab Java jetz eine lange Zeit nicht mehr angefasst, aber versuch eine ResourceLocation anzugeben, wo jeder Frame darin ist und diese nummerierst und callst sie dementsprechend. Das zieht am wenigsten Performance.
 
Aber jeden einzelnen Frame so zu rendern macht das ganze hardcoded af. Hab Java jetz eine lange Zeit nicht mehr angefasst, aber versuch eine ResourceLocation anzugeben, wo jeder Frame darin ist und diese nummerierst und callst sie dementsprechend. Das zieht am wenigsten Performance.
Ja, dass ganze mit Bildern zu machen ist nicht wirklich das schlauste. Ich persönlich kann immer ease animations empfehlen. Sie sehr einfach zu benutzen und die Leistung bleibt konstant gut
 
Ja, dass ganze mit Bildern zu machen ist nicht wirklich das schlauste. Ich persönlich kann immer ease animations empfehlen. Sie sehr einfach zu benutzen und die Leistung bleibt konstant gut
OK ich hab's Mal bei Google nach ease Animations geschaut aber habe nur website Zeug gefunden kannst du mir ein Link senden oder so wie ich das mit Java mache?
 
Das gibt es nicht wirklich public musst du dir selber schreiben aber hier ist ein beispiel (HorizonCode hat mir damals gezeigt wie man das nutzt ist auch nicht anfänger freundlich):
***Hidden content cannot be quoted.***
Ayayay, das wird ein Spaß für dich @BinSkidLoL
 
Ayayay, das wird ein Spaß für dich @BinSkidLoL
man sollte seine grenzen kennen und mal anfangen sich wirklich mit sowas zu beschäftigen anstatt 3 jahre vor sich hin zu skidden wie manche anderen
 
man sollte seine grenzen kennen und mal anfangen sich wirklich mit sowas zu beschäftigen anstatt 3 jahre vor sich hin zu skidden wie manche anderen
Wenn man drei Jahre lang pasted und man nichts gelernt hat, hat man was falsch gemacht. ;D
 
shape1
shape2
shape3
shape4
shape5
shape6
Back
Top