Jump to content
  • Advertisement
Sign in to follow this  
FreJa

materials and textures

This topic is 3606 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

Hi, I'm having some problems dealing with materials on textured objects. The thing is if I call, for example:
float mat[] = { 1.0, 1.0, 1.0 }
glMaterialfv(GL_FRONT, GL_SPECULAR,  mat);
On a non-textured object, I get a nice and expected effect, but I can't see the specular highlight on a textured object. My question is: how are materials handled in games? Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by FreJa
float mat[] = { 1.0, 1.0, 1.0 }
glMaterialfv(GL_FRONT, GL_SPECULAR, mat);
GL_SPECULAR expects 4 floating point values (don't forget the alpha value).

Quote:
On a non-textured object, I get a nice and expected effect, but I can't see the specular highlight on a textured object. My question is: how are materials handled in games?
Don't forget to set GL_SHININESS (with glMaterialf), which is the specular exponent, and defaults to zero.

Share this post


Link to post
Share on other sites
Quote:
Original post by swiftcoder
Quote:
Original post by FreJa
float mat[] = { 1.0, 1.0, 1.0 }
glMaterialfv(GL_FRONT, GL_SPECULAR, mat);
GL_SPECULAR expects 4 floating point values (don't forget the alpha value).

Quote:
On a non-textured object, I get a nice and expected effect, but I can't see the specular highlight on a textured object. My question is: how are materials handled in games?
Don't forget to set GL_SHININESS (with glMaterialf), which is the specular exponent, and defaults to zero.



I did all that I just showed that bit of code to give you an idea... its not actually what i have implemented.

Share this post


Link to post
Share on other sites
Quote:
Original post by FreJa
I did all that I just showed that bit of code to give you an idea... its not actually what i have implemented.
It is a bit hard to tell you where you have gone wrong without seeing any actual code.
Quote:
Original post by FreJa
My question is: how are materials handled in games?
These days materials in games are done entirely through shaders - and speaking for myself at least, everything is considerably simpler with shaders.

Share this post


Link to post
Share on other sites
Quote:
Original post by swiftcoder
Quote:
Original post by FreJa
I did all that I just showed that bit of code to give you an idea... its not actually what i have implemented.
It is a bit hard to tell you where you have gone wrong without seeing any actual code.
Quote:
Original post by FreJa
My question is: how are materials handled in games?
These days materials in games are done entirely through shaders - and speaking for myself at least, everything is considerably simpler with shaders.


hmm, k, i'll take a look at shaders then. Just one thing: how sure can I be that my ogl app, with shaders, will run on a given computer? I mean, when shaders aren't supported by the graphics card, are they always run in software mode?

thanks

Share this post


Link to post
Share on other sites
Quote:
Original post by FreJa
hmm, k, i'll take a look at shaders then. Just one thing: how sure can I be that my ogl app, with shaders, will run on a given computer? I mean, when shaders aren't supported by the graphics card, are they always run in software mode?
At some point, you have to decide what segment of the market you are looking at - going the shaders route is going to rule out many old computers, and the majority of integrated GPUs.

If you are intending to target a fairly 'casual' demographic, then you are probably better off sticking with fixed function for the time being. In this case, I suggest that you get hold of a recent copy of the OpenGL Red Book, and thoroughly read up on materials and lighting.

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!