Skip to main content
GameDev.net gamedev.net
🔒 Locked

Opengl- Diffrent Output for Adreno and Mali GPU

Started by alireza.pir Mar 21, 2016 at 8:48 PM 9 replies 4k views
Original Post
alireza.pir
alireza.pir

I have A part of code in my Android App that gives me two diffrent Outputs for Two Adreno And Mali GPU:

Sg1hh.png

For Mali GPU

Sm8we.jpg

For Adreno GPU

And this is the Code:


if (DRAW_DEST_POLY && DrawDest) {
gl.glEnable(GL10.GL_BLEND);
gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
gl.glLineWidth(2.0f);
gl.glPointSize(3f);
gl.glColor4f(0.8f, 0.0f, 0.0f, 1.0f);
gl.glVertexPointer(2, GL10.GL_FLOAT, 0, mBufDestVertices);
gl.glDrawArrays(GL10.GL_LINE_LOOP, 0, OpenglPoly.getNumPoints());
gl.glDisable(GL10.GL_BLEND);
}

I want the OutPut to be like what in Mali GPU is. (the problem is the inner shape that in second image has faded out)

alh420
alh420

Where does the color come from?

In the code you just set black color, but the shape is red?

is GL_COLOR_ARRAY enabled?

I'm guessing the problem might be with that

alireza.pir
alireza.pir

Where does the color come from?

In the code you just set black color, but the shape is red?

is GL_COLOR_ARRAY enabled?

I'm guessing the problem might be with that

sorry this is the right code:


if (DRAW_DEST_POLY && DrawDest) {
gl.glEnable(GL10.GL_BLEND);
gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
gl.glLineWidth(2.0f);
gl.glPointSize(3f);
gl.glColor4f(0.8f, 0.0f, 0.0f, 1.0f);
gl.glVertexPointer(2, GL10.GL_FLOAT, 0, mBufDestVertices);
gl.glDrawArrays(GL10.GL_LINE_LOOP, 0, OpenglPoly.getNumPoints());
gl.glDisable(GL10.GL_BLEND);
}
alh420
alh420

Maybe try glDisableClientState(GL_COLOR_ARRAY); explicitly if you don't need it (and not already doing it)?

Just guessing, maybe it is enabled for some reason on the adreno and you get weird colors though that.

Looks very weird though, I notice also the frame has the same problem, and it looks to happen at the same X coordinate.

Is the frame drawn with 4 points one for each corner? If so, I don't think the problem is the color array...

_the_phantom_
_the_phantom_
I know I say this a lot but Android and the graphics API support there is a big clusterfuck of shit.

You've run in to a driver bug; this will never be updated or fixed so best you can do is figure out a work around, detect the OS/device/driver combo and activate the work around when it is detected.
vlj
vlj
Is glColor4f an immediate mode draw call? I think you're mixing vertex array and immediate color here.
Do you use a shader?
L. Spiro
L. Spiro
Mali and Adreno are specifically the 2 I cite often when discussing problems with Android.
http://www.gamedev.net/topic/650841-opengl-es-30-matrix-array-only-using-first-matrix/#entry5114748
http://www.gamedev.net/topic/668301-developing-for-a-range-of-phonesossmods-android/#entry5228676

What I do to fix these kinds of issues is punch into my monitor. My fist comes out of the monitor of some guy at ARM or Qualcomm who works on their drivers and punches him hard in the face. Sometimes it takes 3 or 4 punches.

If you don’t have a monitor that supports punching people through their own monitors, you just have to play with things until it works.
Always use shaders. Simple shaders. Nothing fancy like arrays, unless you only access them statically.
Get rid of your use of ::glColor4f(). The more OpenGL calls you make, the more time the device spends in their intern-written drivers and the more likely things are to go wrong.
Never mix fixed-function and shaders. ARM and Qualcomm engineers never ever imagined anyone would ever do this. Your best chance is to do only the most obvious expected lines of code possible.


L. Spiro
I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid
21st Century Moose
21st Century Moose

Is glColor4f an immediate mode draw call? I think you're mixing vertex array and immediate color here.
Do you use a shader?


glColor is actually legal in ES and legal to mix with vertex arrays (ES doesn't have immediate mode), but like the others said, don't do anything unexpected and you stand the best chance of things actually working.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls. 
cgrant
cgrant

I usually find the Adreno drivers to be the least compliant of all, with that said, I would not recommend using another GPU to confirm correctness. That said, I would verify using a third GPU is available, but who knows you may have encountered a driver bug..they are rampant in these mobile GPU drivers. Also, you are calling glVertexPointer, but I don't see where you are enabling/disabling the vertex array.

21st Century Moose
21st Century Moose

Another consideration is your use of glLineWidth; from the ES documentation for this call:

There is a range of supported line widths. Only width 1 is guaranteed to be supported; others depend on the implementation. To query the range of supported widths, call glGet with argument GL_ALIASED_LINE_WIDTH_RANGE.

The implementation is, of course, supposed to clamp to the maximum, but I'd suggest trying with width 1 to see if that's your problem anyway.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls. 

Topic Locked

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

Sign in to reply to this topic.