Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Mockarutan

Member Since 04 Aug 2008
Offline Last Active Apr 10 2011 12:27 PM

Posts I've Made

In Topic: Half transparent textures in openGL ES 2.0?

04 March 2011 - 02:15 PM


I can't figure out how to do normal alpha testing in openGL ES 2.0 on the android platform. I have tried to setup the blending factors exactly like in ES 1.1 where i get it to work, but in 2.0 it doesn't do a difference. I know that ES 2.0 is completely shader based and you are suppose to achieve many blending effects in the shader, but from what i have understood you can only to fully transparent stuff with the "discard" syntax in the shader. (unless you use multi texturing and blend the two textures together with some formula, but thats not blending with the render target.).

So what am i missing here?

Thanx for any help!

//Tobias


Isn't there glEnable(GL_BLEND) and glBlendFunc in OpenGL ES?


It works.... I'm embarrassed xD I guess i misunderstood a text a reed in an openGL ES 2.0 book:

Alpha test and LogicOp are no longer part of the per-fragment
operations stage. These two stages exist in OpenGL 2.0 and OpenGL
ES 1.x. The alpha test stage is no longer needed because the fragment
shader can discard fragments and therefore the alpha test can be
performed in the fragment shader. In addition, LogicOp is removed

as it is very infrequently used by applications and the OpenGL ES
working group did not get requests from independent software
vendors (ISVs) to support this feature in OpenGL ES 2.0.


Thanx!

In Topic: Problem with glDrawArray(GL10.GL_POINT, 0, 0) in opengl ES

31 January 2011 - 02:25 PM

The things that could effect color is texture and lighting. So disable texturing and lighting.


Did not work, thanks for the tip though...

Edit: I cracked it! It was the texturing :D Thanks!

In Topic: Problem with glDrawArray(GL10.GL_POINT, 0, 0) in opengl ES

31 January 2011 - 01:59 PM

I have tried everything now. The closest i get is to draw the points black at the correct position, but they should be red.


//------------sets up the color array-----------------




	ByteBuffer cbb = ByteBuffer.allocateDirect((int)MAXQUADS * 4 * 4);
	cbb.order(ByteOrder.nativeOrder());
	mColorArray = cbb.asFloatBuffer();
    	
	float[] temp = {0.0f, 0.0f, 0.0f, 1.0f};
	for(int i = 0; i < MAXQUADS; i++)
		mColorArray.put(temp);


//-------------render func--------------------------

	gl.glClearColor(mR, mG, mB, 1.0f);
	gl.glClear(GL10.GL_COLOR_BUFFER_BIT);    	
	mVertexBuffer.position(0);
	int error;
		
	gl11.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
	gl11.glEnable(GL11.GL_POINT_SMOOTH);	

        gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, vertexBufferIndex2);
        gl11.glVertexPointer(3, GL11.GL_FLOAT, 0, 0);
        error = gl11.glGetError();
		
	if(error == GL11.GL_INVALID_ENUM)
		Log.i(TAG, "Invalid enum1");
	else if(error == GL11.GL_INVALID_VALUE)
		Log.i(TAG, "Invalid value1");
	else if(error == GL11.GL_INVALID_OPERATION)
		Log.i(TAG, "Invalid operation1");

	gl11.glEnableClientState(GL10.GL_COLOR_ARRAY);
        gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, 0);
        gl11.glColorPointer(4, GL10.GL_FLOAT, 0, mColorArray);

	error = gl11.glGetError();
		
	if(error == GL11.GL_INVALID_ENUM)
		Log.i(TAG, "Invalid enum2");
	else if(error == GL11.GL_INVALID_VALUE)
		Log.i(TAG, "Invalid value2");
	else if(error == GL11.GL_INVALID_OPERATION)
		Log.i(TAG, "Invalid operation2");
        
        error = gl11.glGetError();
		
	if(error == GL11.GL_INVALID_ENUM)
		Log.i(TAG, "Invalid enum3");
	else if(error == GL11.GL_INVALID_VALUE)
		Log.i(TAG, "Invalid value3");
	else if(error == GL11.GL_INVALID_OPERATION)
		Log.i(TAG, "Invalid operation3");
        
	gl.glPushMatrix();
	gl.glTranslatef(5, 1.0f * 5, 0f);

	gl11.glDrawArrays(GL11.GL_POINTS, 0, 4);
	gl.glPopMatrix();
			
	error = gl11.glGetError();
			
	if(error == GL11.GL_INVALID_ENUM)
		Log.i(TAG, "Invalid enum4");
	else if(error == GL11.GL_INVALID_VALUE)
		Log.i(TAG, "Invalid value4");
	else if(error == GL11.GL_INVALID_OPERATION)
		Log.i(TAG, "Invalid operation4");

	gl.glDisableClientState(GL10.GL_COLOR_ARRAY);
	gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);



I'm very greatful for any help. Been stuck on this crap for 2 days now :P

In Topic: Problem with glDrawArray(GL10.GL_POINT, 0, 0) in opengl ES

30 January 2011 - 04:42 PM

Can somebody show me code that works for drawing points? Even if it doesn't use VBO's...

In Topic: Problem with glDrawArray(GL10.GL_POINT, 0, 0) in opengl ES

30 January 2011 - 02:56 PM

Can you narrow down which line gives you the error?




gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, vertexBufferIndex2);
gl11.glVertexPointer(3, GL11.GL_FLOAT, 0, 0);
error = gl11.glGetError();
This gives me invalid operation.. but my enum problem has disappeared...

PARTNERS