for (i=0; i<model.numberofface; i++)
{
if (rendermode == 1)
glLoadName(i);
glBegin(GL_TRIANGLES);
.
.
.
glEnd();
}
glPopMatrix();
ImageSetup(); //code from Nehe
DrawGLScene(); //code from Nehe
The problem is, the bmp would not get displayed at all. However, when I disable the RGBA bits in glColor, the bmp will display. Is there any way I can display both the bmp and model? I need to enable the color bits cos I disabled them earlier in the program. Actually, I need to display the bmp as it is and not as a texture, but am first trying with the Nehe code first. Will it be better if I load the bmp only and not as a texture?
Also, I’d like to know why in the code by nehe, there is a need for a translation into the screen by 5.0? The size of the cube is 222 right?
nexusone, yeah, in fact i would like cover part of the object and still be able to see the covered portion through the image. I have an image which consists of two dominant colors, yellow and red, and I would like the object to appear behind the yellow portion, and still see it. So, yellow portion transparent, red portion opaque. Can it be done using glDrawPixels?
Then you need to map the image to an quad object per my last message.
This will let you pull off some neat effects that you find in some demos.
Buy putting the image on a object you can scale it, rotate it, adjust the transparent.
image1 object image2
back <> front
Transpartent
Hopes this helps.
Originally posted by nicky:
[b]Hi guys,
thanks for all your replies.
nexusone, yeah, in fact i would like cover part of the object and still be able to see the covered portion through the image. I have an image which consists of two dominant colors, yellow and red, and I would like the object to appear behind the yellow portion, and still see it. So, yellow portion transparent, red portion opaque. Can it be done using glDrawPixels?[/b]
thanks for all your help, i am able to display both the 3d model and the bitmap now. nexusone, i see your point, it is indeed easier for me to play around with the image by putting the image on the object. thanks a lot.
I have a new problem though. The model now takes the color of the bitmap whenever it gets displayed. It is supposed to be a white model, but it now appears blue due to the blue bitmap. How can I restore the original color of the 3d model?
Sorry but have been traveling and have not been on-line for a week.
Just like when you look through a red lens, everything you see will have a red tint.
You will always have some amount of tint on the object behind the front bit map.
Maybe you need to use a bitmap with a Alpha channel, use the Alpha channel as a mask to create completely transparent areas.
Then your object would move in and out of the filtered areas. This maybe the effect you are looking for?
The other option is to just put your object in front of all the bit maps to keep it white.
The more advanced option would be to render your object and back ground image first. The use the stencil buffer to map a transparent hole the shape of your object in the front bitmap image. This way the object will have its, correct color.
Originally posted by nicky:
[b]Hi guys,
thanks for all your help, i am able to display both the 3d model and the bitmap now. nexusone, i see your point, it is indeed easier for me to play around with the image by putting the image on the object. thanks a lot.
I have a new problem though. The model now takes the color of the bitmap whenever it gets displayed. It is supposed to be a white model, but it now appears blue due to the blue bitmap. How can I restore the original color of the 3d model?[/b]