Skip to main content
gamedev.net
🔒 Locked

(JOGL) Annoying Hexagons Appear when Using Quadrics

Started by JavaIsGood 0 replies 600+ views
Original Post
JavaIsGood
JavaIsGood
Thanks for answering my thread! I was using code from a tutorial from NeHe (quadrics). I have used quadrics before, but when I used them this time, hexagons appear on the sphere, tube, and cone quadrics when I render them. The textures load perfectly, but these annoying hexagons are the problem. I compared the code I used with the code I used previously, but the hexagons would not disappear. Any suggestions would be appreciated; thanks! Quadric code: ... quadric = glu.gluNewQuadric( ); glu.gluQuadricNormals(quadric, GLU.GLU_SMOOTH); glu.gluQuadricTexture(quadric, true); loadTextures( ); addLight( ); ... (in load textures) int mag = GL.GL_TEXTURE_MAG_FILTER; int min = GL.GL_TEXTURE_MIN_FILTER; tex[0] = loader.loadTexture("earth.jpg", mag, GL.GL_NEAREST, min,GL.GL_NEAREST); tex[1] = loader.loadTexture("earth.jpg", mag, GL.GL_LINEAR, min, GL.GL_LINEAR); tex[2] = loader.loadTexture("earth.jpg", mag, GL.GL_LINEAR, min, GL.GL_LINEAR_MIPMAP_NEAREST); Dimension d = loader.getImageDimensions("earth.jpg"); TextureData data = loader.getTextureData("earth.jpg"); glu.gluBuild2DMipmaps(GL.GL_TEXTURE_2D, 3, (int)d.getWidth( ),(int)d.getHeight( ), GL.GL_RGB, GL.GL_UNSIGNED_BYTE, data.getBuffer( )); ... (when rendering the quadrics) ... gl.glEnable(GL.GL_TEXTURE_2D); tex[filter].bind( ); // where filter is an int corresponding to a texture gl.glPushMatrix( ); gl.glTranslatef(3.0f, 3.0f, 3.0f); ... (I'll just use the sphere code) float [ ] grayCol = { 0.8f, 0.8f, 0.8f, 1.0f }; gl.glMaterialfv(GL.GL_FRONT, GL.GL_AMBIENT_AND_DIFFUSE, grayCol, 0); float [ ] whiteCol = { 1.0f, 1.0f, 1.0f, 1.0f }; gl.glMaterialfv(GL.GL_FRONT, GL.GL_SPECULAR, whiteCol, 0); gl.glMateriali(GL.GL_FRONT, GL.GL_SHININESS, 100); gl.glRotatef(90.0f, 1.0f, 0.0f, 0.0f); glu.gluSphere(quadric, 1.0f, 32, 32);

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.