hey guys, need some help.
i have this code (using org.lwjgl.opengl.Display to draw):
private void render() {
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glLoadIdentity();
for(int y = 0; y < 15; ++y)
for(int x = 0; x < 20; ++x){
GL11.glPushMatrix();
GL11.glTranslatef(x*32, y*32, 0);
texture2.bind();
GL11.glBegin(GL11.GL_QUADS);
GL11.glTexCoord2f(0, 0);
GL11.glVertex2f(0, 0);
GL11.glTexCoord2f(0, texture2.getHeight());
GL11.glVertex2f(0, 32);
GL11.glTexCoord2f(texture2.getWidth(), texture2.getHeight());
GL11.glVertex2f(32,32);
GL11.glTexCoord2f(texture2.getWidth(), 0);
GL11.glVertex2f(32,0);
GL11.glEnd();
texture.bind();
GL11.glBegin(GL11.GL_QUADS);
GL11.glTexCoord2f(0, 0);
GL11.glVertex2f(0, 0);
GL11.glTexCoord2f(0, texture.getHeight());
GL11.glVertex2f(0, 32);
GL11.glTexCoord2f(texture.getWidth(), texture.getHeight());
GL11.glVertex2f(32,32);
GL11.glTexCoord2f(texture.getWidth(), 0);
GL11.glVertex2f(32,0);
GL11.glEnd();
GL11.glPopMatrix();
}
}
to draw this:
(http://towardsnothing.to.funpic.de/lebherz-stuff/pic1.png)
now, if i use the same code in an AWTGLCanvas-Window, it looks like this
(http://towardsnothing.to.funpic.de/lebherz-stuff/pic2.png)
can someone tell me why this happens?
thank you
rené
probably your GL initialization that is different ?
The normal Display.create() path does a little initialization of OpenGL:
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glLoadIdentity();
GL11.glOrtho(0.0, current_mode.getWidth(), 0.0, current_mode.getHeight(), -1.0, 1.0);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glLoadIdentity();
GL11.glViewport(0, 0, current_mode.getWidth(), current_mode.getHeight());
I could not find something similar in the AWTGLCanvas initialization. So you probably need to set up your view this way (or similar) to get it to work the same.
To the Devs: Should the 2 paths be different? ???
thx guys, fool running were right, it works now ^^
thx