Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (120)
games submitted by our members
Games in WIP (577)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  [Newbie] Colouring, Lighting, Texturing  (Read 1475 times)
0 Members and 1 Guest are viewing this topic.
Offline immano

Senior Newbie




Java games rock!


« Posted 2005-04-07 20:57:40 »

Greetings again, and thanks for the help provided so far.

I come again with some questions, this time concerning interaction between colors, lights and texturing.

I've been piling up the various tutorials at NeHe on the framework of the one in the "how to get started with jogl" in this very forum, and so far it's been fine. One problem I've found has come up when mixing textured and untextured polygons.

I made the colored pyramid and cube in the solid tutorial, and then decided to texture that same cube. At first, it would work but make the pyramid colored weird. So I thought of disabling the textures when the pyramid was being drawn and reenabling them for the cube, and it worked:


Then I did the lights and filters demo, which adds various filtered textures and, more importantly, lights, to the scene. This time, the trick of enabling and disabling hasn't been enough. If lights are on, it will look like this:


I did put some normals on the pyramid faces to get that reaction to the light (not sure if they're ok, probably wrong) otherwise it'd come out as if lights didn't touch the pyramid, but when I disable the lights, the colors appear just fine (mind that this happens because, as I said, I disable textures when drawing the pyramid and reenable them for the cube):


So, I believe there is some interaction between the textures, the lights and the colors, but I haven't been able to figure out a way to unbundle that. More importantly, I get the feeling that enable-disable isn't good programming, but then again I'm new to all this, so the answer might just be in front of my eyes and I just can't see. What do you make of it?

Thanks for your time in advance.
Offline rexguo

Junior Duke




Real-Time Java


« Reply #1 - Posted 2005-04-08 03:33:24 »

You probably need to use the function
glTexEnv() to control how the colors from
the lights are combined with the colors
from the texture.

http://www.rexguo.com - Technologist + Designer
Offline immano

Senior Newbie




Java games rock!


« Reply #2 - Posted 2005-04-08 06:09:30 »

Quote
You probably need to use the function
glTexEnv() to control how the colors from
the lights are combined with the colors
from the texture.


Thank you. I will look it up in the reference book (it's too bad that the javadoc for jogl is still in embryo form, though it's certainly of help sometimtes).

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline ozak

Junior Duke




Java demon has no respect for bad code!!!


« Reply #3 - Posted 2005-04-08 06:21:22 »

If you enable GL_COLOR_MATERIAL your vertex colors should work for the pyramid as well.


Want to do multiplayer? Why not try my free Socky socket server?
It's scriptable through JavaScript!
Check it out at http://www.furi.dk/socky
Offline immano

Senior Newbie




Java games rock!


« Reply #4 - Posted 2005-04-08 07:17:29 »

Quote
If you enable GL_COLOR_MATERIAL your vertex colors should work for the pyramid as well.



Thank you sir, once again you were most useful. That did the trick.

Guess next thing I'll look into is how to texture triangles, just so that the poor thing doesn't feel left out. ^^
Offline ozak

Junior Duke




Java demon has no respect for bad code!!!


« Reply #5 - Posted 2005-04-08 08:47:45 »

Quote

Guess next thing I'll look into is how to texture triangles, just so that the poor thing doesn't feel left out. ^^


Why not load models instead? That way it'll be the artists problem Smiley

Lot's of free model resources on the internet too.
I have some classes to easily load/display models of various format if you're interested.

Want to do multiplayer? Why not try my free Socky socket server?
It's scriptable through JavaScript!
Check it out at http://www.furi.dk/socky
Offline immano

Senior Newbie




Java games rock!


« Reply #6 - Posted 2005-04-08 09:02:12 »

Quote


Why not load models instead? That way it'll be the artists problem Smiley

Lot's of free model resources on the internet too.
I have some classes to easily load/display models of various format if you're interested.


It's just that I'm still learning everything from scratch, so...I don't even know what a model is. ^^;
It will probably come in handy for what I have to do, though. If it is not complicated, could you give me a brief explanation, or otherwise point me to one?
Offline immano

Senior Newbie




Java games rock!


« Reply #7 - Posted 2005-04-08 10:13:16 »

As an example of how I don't know the way things work, after enabling GL_COLOR_MATERIAL, lights work and colors show up (if I understand correctly, the material is what determines how a surface reflects lights, and the constant above enables management of such a property in terms of fill color and not just textures?), but I notice the light is a lot brighter everywhere. My guess would be that the pyramid is reflecting light and diffusing it, but I notice that this light is brighter even on the other side of the cube (see image below), so this brightness increase is not directional. If the behaviour before enabling GL_COLOR_MATERIAL is to be considered the default, then I wonder what exactly causes this variation.

(this picture *does* have shadows, they just are less evident. Check the right face of the cube)
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Longarmx (52 views)
2014-10-17 03:59:02

Norakomi (43 views)
2014-10-16 15:22:06

Norakomi (33 views)
2014-10-16 15:20:20

lcass (37 views)
2014-10-15 16:18:58

TehJavaDev (68 views)
2014-10-14 00:39:48

TehJavaDev (66 views)
2014-10-14 00:35:47

TehJavaDev (59 views)
2014-10-14 00:32:37

BurntPizza (73 views)
2014-10-11 23:24:42

BurntPizza (45 views)
2014-10-11 23:10:45

BurntPizza (85 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!