Problems wrapping simple texture to ofSpherePrimitive

Hi everybody;
This is my code:

void ofApp::setup(){

image.loadImage("tex_2048_1024.png");
tex = image.getTextureReference();

sphere.setRadius(200);

ofEnableDepthTest();

}

void ofApp::draw(){

sphere.setPosition(ofGetWidth()/2, ofGetHeight()/2, 0);

tex.bind();

sphere.draw();

}

Where sphere is an ofSpherePrimitive object.

I’m not getting the texture wrapped to the sphere, but just some color is taken from the texture and applied to the primitive. The texture is much more detailed. Here’s a pic of what I get:

try ofDisableArb()

Hi there!

Like Ahbee wrote, you need to call ofDisableArbTex() on setup.

By default, OF uses rectangle textures (this means they are dimension-dependent). Since ofSpherePrimitive uses normalized tex-coords (from 0 to 1), you are only mapping the first pixels of your texture.

1 Like

Thank you very much! This community is awesome