Samsung Galaxy S2 Problem

Problems with Canvas, OpenGL, etc...

Samsung Galaxy S2 Problem

Postby Unicate » Wed Oct 12, 2011 4:32 pm

Hi everyone!

I have a problem with textures on the SGS2.
I am loading photo's into an opengles 2.0 environment. So far so good. As long as I know it works on all phones except the SGS2. The Mesh itself gets drawn, but without any texture. LogCat doesnt tell me anything even I am printing all gleserrors in there. Textures are like 512x1024 or similar(power of 2).

Do you have any clue what that could be?
Is there any special config I have to change for the sgs2?

Thanks in advance!

[Edit:] what I figured out so far:
The texture is NOT, NOT loading.
After I've seen, that the meshes had a single color, but its not the same all the time, I tried to try images that have an very strong color. so I used a different set of bitmaps which have one color only. And this colors are shown.
Then I tried to figure out which pixels of the image it takes to show. So I colored each corner of a red rectangle in different colors. To color one pixel is not enough, I had to use like 10x10 pixels (<= not precise enough) in each corner (on a 128x128 pixel rectangle) to see, that the texture is filled with the color in the right bottom corner on the texture. Thats propably the direction in which the JPEGReader reads the image out of the file.

Any suggestions?
Unicate
Junior Developer
Junior Developer
 
Posts: 10
Joined: Thu Sep 02, 2010 8:23 am

Top

Re: Samsung Galaxy S2 Problem

Postby Unicate » Tue Oct 18, 2011 2:19 pm

Here's the cpp code that make me headaches...

Syntax: [ Download ] [ Hide ]
Using cpp Syntax Highlighting
  1. // if the image is not loaded into memory yet return false
  2. if(image == 0)
  3.         return false;
  4. LOGE("trying to upload image: %ix%i - %i", reader->getTextureWidth(), reader->getTextureHeight(), reader->getID());
  5.  
  6. //              LOGI("uploading %ix%i pixels %s", image->getWidth(),image->getHeight(), reader->getFilepath());
  7.  
  8. GLuint textureID;
  9. //  Generate a texture object
  10. glGenTextures(1, &textureID);
  11. // Bind the texture object
  12. glBindTexture(GL_TEXTURE_2D, textureID);
  13.  
  14.  
  15. // Set the filtering mode
  16. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
  17. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
  18.  
  19. //              LOGE("uploading image: %i on texture %i file: %s", reader->getID(), textureID, reader->getFilepath());
  20. //  upload the texture
  21. glTexImage2D(GL_TEXTURE_2D, 0, image->getColorFormat(),
  22.                 reader->getTextureWidth(), reader->getTextureHeight(), 0,
  23.                 image->getColorFormat() , GL_UNSIGNED_BYTE,
  24.                 image->getPixelData());
  25.  
  26. // set the texture's ID
  27. _textureID = textureID;
  28. // set the image ID to the uploaded one
  29. _imageID = reader->getID();
  30.  
Parsed in 0.008 seconds, using GeSHi 1.0.8.4
Unicate
Junior Developer
Junior Developer
 
Posts: 10
Joined: Thu Sep 02, 2010 8:23 am

Re: Samsung Galaxy S2 Problem

Postby Unicate » Wed Oct 19, 2011 9:37 am

Solved!

The problem was:

Syntax: [ Download ] [ Hide ]
Using cpp Syntax Highlighting
  1. gvTextureHandle = glGetAttribLocation(gProgram, "aTextureCoord");
  2.  
Parsed in 0.004 seconds, using GeSHi 1.0.8.4


returned 0 (just on SGS2).

so when I wanted to update the shader I was requesting smth. like that:

Syntax: [ Download ] [ Hide ]
Using cpp Syntax Highlighting
  1. if(_textureCoords && textureHandle != 0) // update shader
  2.  
Parsed in 0.004 seconds, using GeSHi 1.0.8.4
Unicate
Junior Developer
Junior Developer
 
Posts: 10
Joined: Thu Sep 02, 2010 8:23 am

Re: Samsung Galaxy S2 Problem

Postby roopa » Thu Oct 20, 2011 12:32 pm

I really appreciate for your brilliant Efforts on spending time to post this information in a simple and systematic manner, so That visitors and readers can easily Understand the concept.I Efforts must appreciate you posting these on information.
roopa
Developer
Developer
 
Posts: 27
Joined: Wed Sep 14, 2011 6:46 am

Top

Return to Android 2D/3D Graphics - OpenGL Problems

Who is online

Users browsing this forum: No registered users and 1 guest