stschwabe
YaBB Newbies
Offline
Posts: 3
Re: transparency problems, using gestalt-library
Reply #2 - Mar 15th , 2008, 12:18pm
this is my code part 2 class Punkt{ int row, col; float x,y,z,u,v,xAlt,yAlt; boolean aktive=false; Punkt(int row, int col, float x, float y, float z, float u, float v){ this.row = row; this.col = col; this.x = x; this.y = y; this.z = z; this.u = u; this.v = v; xAlt=x; yAlt=y; } void draw(){ noStroke(); fill(0); ellipse(x+width/2,y+height/2,3,3); if (POINT_ACTIVE && mouseX > x+width/2-10 && mouseX < x+width/2+10 && mouseY > y+height/2-10 && mouseY < y+height/2+10){ aktive=!aktive; POINT_ACTIVE=false; } noStroke(); fill(0); if (aktive) { if (LINKS) x-=1; if (RECHTS) x+=1; if (OBEN) y+=1; if (UNTEN) y-=1; ellipse(x+width/2,y+height/2,10,10); } } } import java.io.Serializable; import java.util.ArrayList; import gestalt.Gestalt; import gestalt.context.GLContext; import gestalt.render.Drawable; import gestalt.impl.jogl.shape.JoglMaterial; import mathematik.TransformMatrix4f; import mathematik.Vector3f; import gestalt.shape.material.TexturePlugin; private class MyDrawable extends AbstractDrawable { public JoglMaterial material; public MyDrawable() { material = new JoglMaterial(); } public void draw(GLContext theRenderContext) { final GL gl = ( (JoglGLContext) theRenderContext).gl; material.begin(theRenderContext); for(int i=0; i < punkt.length; i++) { if (punkt[i].row != gridSizeY-1 && punkt[i].col != gridSizeX-1){ gl.glBegin(GL.GL_QUADS); gl.glColor4f(1f,1f,1f,1f); gl.glTexCoord2f(punkt[i].u, punkt[i].v); gl.glVertex3f(punkt[i].x,punkt[i].y,punkt[i].z); gl.glTexCoord2f(punkt[i+1].u, punkt[i+1].v); gl.glVertex3f(punkt[i+1].x,punkt[i+1].y,punkt[i+1].z); gl.glTexCoord2f(punkt[i+gridSizeX+1].u, punkt[i+gridSizeX+1].v); gl.glVertex3f(punkt[i+gridSizeX+1].x,punkt[i+gridSizeX+1].y,punkt[i+gridSizeX+1].z); gl.glTexCoord2f(punkt[i+gridSizeX].u, punkt[i+gridSizeX].v); gl.glVertex3f(punkt[i+gridSizeX].x,punkt[i+gridSizeX].y,punkt[i+gridSizeX].z); gl.glEnd(); } } material.end(theRenderContext); } } public static void main(String[] args) { new UsingCustomDrawables().init(); } }