Sign in to follow this  
Eniak

why different color?

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this