Jump to content
  • Advertisement
Sign in to follow this  
dgi

Android : Objects look like spheres

This topic is 532 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all ,

I have this strange problem : When I run the app on a device all of the objects look like spheres.What I do is develop and test it on windows and than porting it to android with ndk is simple.The first test I did on the device was with a quad and I thought .. ok it works.Then after some time when I was done with loading of the models , textures and so on I went to see how it looks on the phone and the models are rendered in the shape of a sphere.The texturing works..

 

It's like open gl somehow normalizes the position of my vertices.Just for testing I print the max length of the position vectors and It was 3.0f (on windows and adroid).

 

So I don't know what to do If any you have similar experience please tell.

 

The app renders with GL ES 2

 

dgi.

 

Share this post


Link to post
Share on other sites
Advertisement

A screen shot will help a lot. I am curious what your models look like and how they are when displayed as spheres. It will certainly help people to help you if they can see it. It sounds to me like you are drawing the sphere each time but with a different texture so I would start by checking your other models are actually being drawn and not just a sphere over and over. Check they are loaded correctly and so on.

 

Do these models use different shaders? Are you doing any vertex manipulation in your shaders?

 

Put glGetError thrgouhout your code and investigate any errors it tells you about.

 

It is unlikely (though certainly not impossible) that OpenGL is turning your models to spheres.

Share this post


Link to post
Share on other sites

It just might be that you've mistyped, or messed up with input streams/attribute locations.

Vertex shader gets data for normals as inputs for vertex position.

Share this post


Link to post
Share on other sites
My guess is that you've accidentally set the 'normalized' flag of glVertexAttribPointer to true.

That can't turn models into spheres. Normalization should only map integer types to [-1;1] or [0;1] ranges, linearly.

Edited by vstrakh

Share this post


Link to post
Share on other sites

It just might be that you've mistyped, or messed up with input streams/attribute locations.

Vertex shader gets data for normals as inputs for vertex position.

Yep that was it.... I didn't call glBindAttribLocation .. I thought it was going to bind them by order but i guess not.

 

Thanks vstrakh :)

Share this post


Link to post
Share on other sites

I thought it was going to bind them by order but i guess not.
 

I had one bug that surfaced only on devices with VideoCore IV gpu.

Wrong shader info was used when binding uniforms, but the bug was masked with the same order of few first uniforms in shaders.

Bug was found when VideoCore gpu driver assigned uniforms locations in reverse order. Mapping was very different then between shaders.

So, driver is free to assign locations (probably any locations, not just uniforms) in whatever way it might see fit.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!