blending problems

I am trying to render a glow around an object. here is my code for the drawing function:

public void draw()
	{
		
		//System.out.println(x+" "+y+" "+fwdaxis);
		
		if(glowtexture==null)
		{
			glowtexture = serv.gettexture("res/glow.png");
		}
		
		
		GL11.glEnable(GL11.GL_BLEND);
		
		
		GL11.glBlendFunc(GL11.GL_SRC_ALPHA,GL11.GL_ONE);
		
		
GL11.glEnable(GL11.GL_TEXTURE_2D);


		
glowtexture.bind();


// render glow
GL11.glBegin(GL11.GL_QUADS);
GL11.glTexCoord2f(0, 0);
vtx(100,100);
GL11.glTexCoord2f(0, 1);
vtx(-100,100);
GL11.glTexCoord2f(1, 1);
vtx(-100,-100);
GL11.glTexCoord2f(1, 0);
vtx(100,-100);

GL11.glEnd();


		
		GL11.glBegin(GL11.GL_POINTS);
		GL11.glVertex2f(0, 0);

		GL11.glEnd();
		
		
		GL11.glBegin(GL11.GL_TRIANGLE_FAN);
		
		
	
		
		
		
		
		
	GL11.glColor4f(.5f, 0, 0,1);
	

	
	
		
  vtx(0,0);
  

  
  
  
  GL11.glColor4f(1, 0, 0,1)	;
  
  
  int [][] vtxes = new int[][]{{50,50},{50,-50},{25,-70},{-25,-70},{-50,-50},{-50,50},{50,50}  };
  
   int[][] transformed =rotate(vtxes,rot);
   
   
  vtx(transformed[0][0],transformed[0][1]);
  vtx(transformed[1][0],transformed[1][1]);
  vtx(transformed[2][0],transformed[2][1]);
  vtx(transformed[3][0],transformed[3][1]);
  vtx(transformed[4][0],transformed[4][1]);
  vtx(transformed[5][0],transformed[5][1]);
  vtx(transformed[6][0],transformed[6][1]);
  

  

  System.out.println(rot);
		
  GL11.glEnd();
		
  

  
  
  
  
	}

I know, immediate mode is bad. i will change that later. the problem is that nothing gets drawn except the glow. when i comment out the call to glblendfunc, the object renders. why is that?

Bet you’ve got depth writes / test enabled.

Cas :slight_smile:

Or the texture is loaded without alpha.

OK i found that if i disable blending, draw the object, then anable it and draw the glow both show up. why did my object not show up with blending enabled?

If you’re drawing the base object, you don’t want it to be blended in, you only want the glow to be blended. If you’re not sending alpha in correctly for base object, that could screw up the blend equation but I can’t see what color you’re using for the base.

the object color is rgba(1,0,0,1). it’s the triangle strip.