View Full Version : pbm with cube mapping
11-17-2000, 04:13 AM
my problem is that when I use 2 differents cube maps for 2 objects, both of them use the last 6-cube maps that have been loaded.
I have checked everything, and my program bind the right textures with the right object, so I don't understand why I can't use 2 different cube maps.
Thanks a lot
11-17-2000, 05:20 AM
check carefully if all your bind texture functions
are out side any glbegin() glend() pair.
that was my problem. i got all the binding calls out side those calls
11-21-2000, 11:41 PM
No, my binding calls seem to be at the right place. Here is a small sample of my code :
/* enable cube texture mapping */
/* set the environnement mode */
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_EXT);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_EXT);
glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_EXT);
/* bind the textures */
/* draw the geometry */
Hi, with you'r code, the texture used for the geometry is the "mytexture" isn't it ?
If you use different objects with different textures, i think u should do:
/* Draw the geometry relative to the texture number i */
/* Draw the geometry realtive to the texture number j */
I think u can just bind textures one by one.
11-24-2000, 09:04 PM
no, no, since I use cube mapping for my objects, my geometry uses the 6 textures !!
[each numer has a special number which tells called CubeMapNum]. Here is my binding method :
glBindTexture(GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT+C ubeMapNum, NumTex);
glMaterialfv(GL_FRONT, GL_SPECULAR, Specular);
glMaterialf(GL_FRONT, GL_SHININESS, Shine);
glMaterialfv(GL_FRONT, GL_AMBIENT, Ambient);
glMaterialfv(GL_FRONT, GL_DIFFUSE, Diffuse);
glMaterialfv(GL_FRONT, GL_EMISSION, Emission);
I realy don't understand why it does not work, because if I only use one cube mapping [i.e. 6 textures !], it works well, but if I use 2 cube map [i.e. 12 textures !], only the second cube map is taken into account !
[This message has been edited by nikopol0 (edited 11-24-2000).]
11-24-2000, 09:52 PM
A cubemap is not 6 textures -- it is 6 images all in one texture.
The target that cubemap textures are bound to is GL_TEXTURE_CUBE_MAP_ARB. (or in your case, _EXT)
However, when you specify a cubemap texture image, you need to say what face it is for.
Likewise, when you enable/disable cubemapping, you use GL_TEXTURE_CUBE_MAP_ARB.
11-25-2000, 09:14 AM
ok, so I only call :
for all my 6 map, am I wrong ?
but I still have the same pbm ...
perhaps I am wrong when I load my 6 image into memory ... here is my code :
where CubMapNum is the number of the map
thx a lot
You only bind ONE texture for all SIX sides
of the cube. As far as I can tell, there's
just ONE texture which contains all the six
faces of the cube (tiled within it).
11-25-2000, 12:17 PM
Not only is it one texture and not six, but also the offset from the POSITIVE_X face should be from 0 to 5, not 1 to 6.
11-26-2000, 12:04 PM
ok, that's exactly what I do [I only bind once the texture, and my ofset starts at 0], but I still have the problem when I load 2 differents cube maps ...
I really don't know what to do .......
but thx a lot for your reply !
and if someone has a piece of code that works well, it would be very nice to send it to me.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.