Jump to content

View more

Image of the Day

Boxes as reward for our ranking mode. ヾ(☆▽☆)
#indiedev #gamedev #gameart #screenshotsaturday https://t.co/ALF1InmM7K
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

OPENGL lesson 3

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
3 replies to this topic

#1 supercoollee   Members   

100
Like
0Likes
Like

Posted 07 May 2010 - 09:00 PM

i have just started learning OPENGL, i use MASM for programming. in lesson 3, if there isn't a lightsource in the scene, how can the color be shown? and i tried to put up a scene with a lightsource and a triangle, the glColor3x (b or f) function doesn't change the color of the triangle , it always appear gray, i don't know why.

#2 Dubh   Members   

122
Like
0Likes
Like

Posted 19 May 2010 - 03:37 AM

Can you post some of your code?

#3 Katie   Members   

2219
Like
0Likes
Like

Posted 19 May 2010 - 04:01 AM

If you don't enable lighting, the "flat" colours specified by the glColour() will be used.

If you turn on lighting, then the glColor() is ignored -- the default material colour will be used instead. Hence your triangle will be drawn in white; which will end up gray after lighting.


You probably want to enable glColorMaterial which will copy colours out of the glColor() calls into the ambient/diffuse/both material colours.



#4 supercoollee   Members   

100
Like
0Likes
Like

Posted 19 May 2010 - 08:56 PM

the problem has been solved. in order to specify color at each vertex,

glEnable(GL_COLOR_MATERIAL)

must be called.

and if no light is specified, GL uses the default lighting, that's why in NEHE's lesson3 the colors can be shown without calling lighting functions.





Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.