AndrisBB Ierakstīts Februāris 14, 2013 Share Ierakstīts Februāris 14, 2013 (labots) Aiz gara laika esu sacis mazliet pamacities opengl esu ticis tik talu ka jauzzime kubs ar texturu, bet problema tada ka skatoties no prieksas uz kubu, priekseja mala ir caurspidigs, apejot apkart viss oki. cik saprotu tad vaina ir pareiza seciba zimet punktus, clockwise vai preteji. vai ari textura ir jamapo otradak. nespeju saskatit kljudu, varbut saku uz vakaru jau nogurt vai ari tur vag kko enablot prieks gl? public class Box { private float x, y, z; private float size; private String filename = "res/box.png"; private int textureid; public Box(float size, float x, float y, float z) { this.size = size; this.x = x; this.y = y; this.z = z; textureid = TextureManager.loadTexture(filename); } public void render() { glBindTexture(GL_TEXTURE_2D, textureid); glBegin(GL_QUADS); glTexCoord2f(0.0f, 0.0f); glVertex3f(x, y, z); // Bottom Left Of The Texture and Quad glTexCoord2f(1.0f, 0.0f); glVertex3f(x + size, y, z); // Bottom Right Of The Texture and Quad glTexCoord2f(1.0f, 1.0f); glVertex3f(x + size, y + size, z); // Top Right Of The Texture and Quad glTexCoord2f(0.0f, 1.0f); glVertex3f(x, y + size, z); // Top Left Of The Texture and Quad // Back Face glTexCoord2f(1.0f, 0.0f); glVertex3f(x + size, y, z - size); // Bottom Right Of The Texture and Quad glTexCoord2f(1.0f, 1.0f); glVertex3f(x + size, y + size, z - size); // Top Right Of The Texture and Quad glTexCoord2f(0.0f, 1.0f); glVertex3f(x, y + size, z - size); // Top Left Of The Texture and Quad glTexCoord2f(0.0f, 0.0f); glVertex3f(x, y, z - size); // Bottom Left Of The Texture and Quad // Top Face glTexCoord2f(0.0f, 1.0f); glVertex3f(x, y + size, z - size); // Top Left Of The Texture and Quad glTexCoord2f(0.0f, 0.0f); glVertex3f(x, y + size, z); // Bottom Left Of The Texture and Quad glTexCoord2f(1.0f, 0.0f); glVertex3f(x + size, y + size, z); // Bottom Right Of The Texture and Quad glTexCoord2f(1.0f, 1.0f); glVertex3f(x + size, y + size, z - size); // Top Right Of The Texture and Quad // Bottom Face glTexCoord2f(1.0f, 1.0f); glVertex3f(x + size, y, z - size); // Top Right Of The Texture and Quad glTexCoord2f(0.0f, 1.0f); glVertex3f(x, y, z - size); // Top Left Of The Texture and Quad glTexCoord2f(0.0f, 0.0f); glVertex3f(x, y, z); // Bottom Left Of The Texture and Quad glTexCoord2f(1.0f, 0.0f); glVertex3f(x + size, y, z); // Bottom Right Of The Texture and Quad // Right face glTexCoord2f(1.0f, 0.0f); glVertex3f(x + size, y, z); // Bottom Right Of The Texture and Quad glTexCoord2f(1.0f, 1.0f); glVertex3f(x + size, y + size, z); // Top Right Of The Texture and Quad glTexCoord2f(0.0f, 1.0f); glVertex3f(x + size, y + size, z - size); // Top Left Of The Texture and Quad glTexCoord2f(0.0f, 0.0f); glVertex3f(x + size, y, z - size); // Bottom Left Of The Texture and Quad // Left Face glTexCoord2f(0.0f, 0.0f); glVertex3f(x, y, z - size); // Bottom Left Of The Texture and Quad glTexCoord2f(1.0f, 0.0f); glVertex3f(x, y, z); // Bottom Right Of The Texture and Quad glTexCoord2f(1.0f, 1.0f); glVertex3f(x, y + size, z); // Top Right Of The Texture and Quad glTexCoord2f(0.0f, 1.0f); glVertex3f(x, y + size, z - size); // Top Left Of The Texture and Quad glEnd(); } } Labots Februāris 14, 2013 - AndrisBB Link to comment Share on other sites More sharing options...
Recommended Posts
Izveido kontu, vai pieraksties esošajā, lai komentētu
Jums ir jābūt šī foruma biedram, lai varētu komentēt tēmas
Izveidot jaunu kontu
Piereģistrējies un izveido jaunu kontu, tas būs viegli!
Reģistrēt jaunu kontuPierakstīties
Jums jau ir konts? Pierakstieties tajā šeit!
Pierakstīties tagad!