Color + Texture = Weird (!!?)
I''m experimenting a little with texturing and stuff.. And yesterday I made a room with some texture on all the walls.. And I made a little box in the middle of the room spinning around.. I didn''t want to texture it, so I figured out I just put the wonderfull glColor3f making it green... Yeah, in my dreams.. When I ran the program the box was green alright, but so was the entire room!(?).. It still had the proper texture, but it had this green layer on it.. Really weird I thought, I plundered some with the code, but the same result ever goddamn time i compiled. So, for you hardcore programmers; =) Can''t I do texturing and making colors on some other things at the same time? If I can, how?
Yeah It can be a neat effect sometime having the green layer over it all, but that''s not what I want to do at this time.
I tried to have some 2d text as well, and color it too.. but the entire room turned out green.. I wanted to have the text green, so it''s distinct from the rest of the world... Not I have to have it untextured, and it''s black or a very dark grey/brown color, so I can barely see the text.
Please do some explaining for me
Thanks in advance!
Kenneth Wilhelmsen
Download my little game project HERE
--------------------------
He who joyfully marches to music in rank and file has already earned my contempt. He has
been given a large brain by mistake, since for him the spinal cord would fully suffice. This
disgrace to civilization should be done away with at once. Heroism at command, senseless
brutality, deplorable love-of-country stance, how violently I hate all this, how despicable and ignoble war is; I would rather be torn to shreds than be a part of so base an action! It is my conviction that killing under the cloak of war is nothing but an act of murder
it should be simple:
state the color (room color) before you render the room and before you render the box.
good luck
state the color (room color) before you render the room and before you render the box.
good luck
Actually, everytime you make a call to the glColor*f() function, you change an opengl state that sets all objects to that defined colour. What you need to do, is reset this colour state after.
ie.
glColor3f(0,0,1) //green
DrawGreenObject;
glColor3f(1,1,1) //reset colour to pure white
DrawAllOtherObjects;
ie.
glColor3f(0,0,1) //green
DrawGreenObject;
glColor3f(1,1,1) //reset colour to pure white
DrawAllOtherObjects;
Ya I got same problem that is why I came here. But I got new problem after I corrected my script as wAVaRiaN suggested to fix the glcolor3f. When I switched my textured object into transparent the white color remain and only black color on texture map transparented. It is more like color keying. Is there a way to limit glColor3f on a single 3D object without affecting to anything else?
Waldoo
Waldoo
you have to realize OpenGL is a state machine. Color is just a ste in it. Once you set it to some color, that same color will be used until you specify another one. So after drawing your object with green change it to white and everything should be OK
Waldoo : if you use alpha blending you should use :
glColor4f( red, green, blue, ALPHA );
There are more worlds than the one that you hold in your hand...
Waldoo : if you use alpha blending you should use :
glColor4f( red, green, blue, ALPHA );
There are more worlds than the one that you hold in your hand...
Hi !
I got the same problem when I first use the Nehe BaseCode v2.
The rule to be sure to have exactly what you want is :
Specify your settings (including Texture, then color if appliable, blending, lighting,..., whatever your think you should force to get the proper result)
----
David Sporn AKA Sporniket
I got the same problem when I first use the Nehe BaseCode v2.
The rule to be sure to have exactly what you want is :
Specify your settings (including Texture, then color if appliable, blending, lighting,..., whatever your think you should force to get the proper result)
//Draw the room//1. Ensure you have the right textureglBindTexture(my_room_texture); //my_room_texture is a texture from a picture, so no color to setDrawMyRoom();//Draw the cube//1. Ensure you have the right textureglBindTexture(0);//2. Texture 0 is a solid colored texture, so//you should specify the colorglColor3f(0,0,1); //greenDrawMyCube();
----
David Sporn AKA Sporniket
if you want solid color cube you dont need solit texture.. just disable texturing and use colors only. glDisable( GL_TEXTURE_2D );
There are more worlds than the one that you hold in your hand...
There are more worlds than the one that you hold in your hand...
This is a old post from me? Why are people giving it life again, stop posting! =)
Kenneth Wilhelmsen
Try my little 3D Engine project, and mail me the FPS. WEngine
Or just visit my site
--------------------------
He who joyfully marches to music in rank and file has already earned my contempt. He has
been given a large brain by mistake, since for him the spinal cord would fully suffice. This
disgrace to civilization should be done away with at once. Heroism at command, senseless
brutality, deplorable love-of-country stance, how violently I hate all this, how despicable and ignoble war is; I would rather be torn to shreds than be a part of so base an action! It is my conviction that killing under the cloak of war is nothing but an act of murder
Kenneth Wilhelmsen
Try my little 3D Engine project, and mail me the FPS. WEngine
Or just visit my site
--------------------------
He who joyfully marches to music in rank and file has already earned my contempt. He has
been given a large brain by mistake, since for him the spinal cord would fully suffice. This
disgrace to civilization should be done away with at once. Heroism at command, senseless
brutality, deplorable love-of-country stance, how violently I hate all this, how despicable and ignoble war is; I would rather be torn to shreds than be a part of so base an action! It is my conviction that killing under the cloak of war is nothing but an act of murder
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement