Jump to content
  • Advertisement
Sign in to follow this  
Eniak

why different color?

This topic is 4374 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i run the progame of lesson 2, in the full screen mode,i saw the blue polygon but in window mode,i saw the white one why?

Share this post


Link to post
Share on other sites
Advertisement
I don't know, it shouldn't, but the thing is that the draw color is not set, it should default to white, but this is not always so.
One should always set the color before drawing using glColor4f(1,1,1,1); (or whatever you like).
More on this in lesson 3.

This could also be because of a strange driver bug i have seen in programs like maya and such, so update your drivers.

Share this post


Link to post
Share on other sites
O_o
that souldn't happen, check your PIXELFORMATDESCRIPTOR, it should look something like this

static PIXELFORMATDESCRIPTOR pfd=
{
sizeof(PIXELFORMATDESCRIPTOR),
1,
PFD_DRAW_TO_WINDOW |
PFD_SUPPORT_OPENGL |
PFD_DOUBLEBUFFER,
PFD_TYPE_RGBA,
32,
0, 0, 0, 0, 0, 0,
0,
0,
0,
0, 0, 0, 0,
24,
0,
0,
PFD_MAIN_PLANE,
0,
0, 0, 0
};



You can also check if your desktop bitdepth is set to anything other than 24 or 32bit(truecolor)
Edit: it sould be set to 24 or 32 bit if you misunderstood the above part.

[Edited by - lc_overlord on July 22, 2006 9:01:58 AM]

Share this post


Link to post
Share on other sites
Quote:
Original post by moinho_vlt
my desktop bitdeph was in 32bit (truecolor)
i changed it to 16 and works fine now, tks :)


That shouldn't be, what system are you using (system ,os, GFXcard, GFXdriver)?

Share this post


Link to post
Share on other sites
now,i am in lesson 6,

AT THE LINE 174, i added some code to NEHE's programe,just a simple short code,but when i run it ,i found that is the green & blue pyramid,but in my code,i write a RED GREEN BLUE one,why lost it?

what's more,some time i run the progranme under the VC ,it is running without the red color,en,that is it,But,when i run the *.exe of this code,the system tell me "cant initialization"

Who can help me?

my code,which were added into Lesson 6,is below
// colorful pyramid
glBegin(GL_TRIANGLES); // back face
glColor3f( 1.0f, 0.0f, 0.0f);
glVertex3f( 0.0f, 1.0f, 0.0f);

glColor3f( 0.0f, 1.0f, 0.0f);
glVertex3f(-1.0f,-1.0f,-1.0f);

glColor3f( 0.0f, 0.0f, 1.0f);
glVertex3f( 1.0f,-1.0f,-1.0f);
glEnd();

glBegin(GL_TRIANGLES); // front face
glColor3f( 1.0f, 0.0f, 0.0f);
glVertex3f( 0.0f, 1.0f, 0.0f);

glColor3f( 0.0f, 0.0f, 1.0f);
glVertex3f(-1.0f,-1.0f, 1.0f);

glColor3f( 0.0f, 1.0f, 0.0f);
glVertex3f( 1.0f,-1.0f, 1.0f);
glEnd();

glBegin(GL_TRIANGLES); // left face
glColor3f( 1.0f, 0.0f, 0.0f);
glVertex3f( 0.0f, 1.0f, 0.0f);

glColor3f( 0.0f, 1.0f, 0.0f);
glVertex3f(-1.0f,-1.0f,-1.0f);

glColor3f( 0.0f, 0.0f, 1.0f);
glVertex3f(-1.0f,-1.0f, 1.0f);
glEnd();

glBegin(GL_TRIANGLES); // right face
glColor3f( 1.0f, 0.0f, 0.0f);
glVertex3f( 0.0f, 1.0f, 0.0f);

glColor3f( 0.0f, 1.0f, 0.0f);
glVertex3f( 1.0f,-1.0f, 1.0f);

glColor3f( 0.0f, 0.0f, 1.0f);
glVertex3f( 1.0f,-1.0f,-1.0f);
glEnd();

Share this post


Link to post
Share on other sites
Try adding the line glDisable(GL_TEXTURE_2D); just before the code you inserted

and then add glEnable(GL_TEXTURE_2D); just after glBindTexture(GL_TEXTURE_2D, texture[0]); in DrawGLScene(GLvoid).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!