PDA

View Full Version : Modifying image-texture-test example



pion
12-06-2010, 12:25 PM
I am learning about texture based on http://www.khronos.org/webgl/wiki/WebGL ... ing_Images (http://www.khronos.org/webgl/wiki/WebGL_and_OpenGL#Loading_Images)

I replaced test_texture.jpg with gorilla.jpg as shown below:

function init() {
gl.clearColor(0., 0., .7, 1.);
gl.viewport(0, 0, g_width, g_height);

// g_texture = loadTexture("test_texture.jpg"); // original code. it works
g_texture = loadTexture("gorilla.jpg"); // this texture does not show up

initShaders();
}


Both test_texture.jpg and gorilla.jpg have the same properties: 256x256 pixels, 72 dpi, bit depth: 24

Unfortunately, the gorilla.jpg does not show up.

What did I do wrong?

Thanks in advance for your help.

SteveBaker
12-06-2010, 05:41 PM
Obviously, if all you've done is change the filename, that's not going to be an issue. So the odds are high that it's something wrong with the image. You're going to need to at least post the URLs where we can download these images to see what's going amiss otherwise there is zero chance that we can help.

pion
12-06-2010, 06:08 PM
The texture is on http://webkit2000.appspot.com/3d/khrono ... orilla.jpg (http://webkit2000.appspot.com/3d/khronos/webkit/resources/gorilla.jpg).

Thanks.

pion
12-06-2010, 06:34 PM
The texture is on http://webkit2000.appspot.com/3d/khrono ... orilla.jpg (http://webkit2000.appspot.com/3d/khronos/webkit/resources/gorilla.jpg)

Thanks.

Additional info ...

I then tried running the SpiritBox.html from https://cvs.khronos.org/svn/repos/regis ... os/webkit/ (https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/sdk/demos/webkit/) as explained on http://www.khronos.org/webgl/wiki/Tutorial.

The demo works fine.

I then replaced the texture with the above gorilla.jpg. I works fine, too.