Crystal Space
Welcome, Guest. Please login or register.
September 02, 2014, 06:39:42 am

Login with username, password and session length
Search:     Advanced search
9009 Posts in 2043 Topics by 8374 Members
Latest Member: Donaldyokley
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Projects
| |-+  Project Discussion
| | |-+  Set color
« previous next »
Pages: [1] Print
Author Topic: Set color  (Read 4405 times)
mik
Newbie
*
Posts: 36


View Profile Email
« on: November 06, 2008, 07:26:41 pm »

Hi again,

until now i have setting the color of my meshes loading a texture of that color from a file and then creating a material from these texture, but now i'm interested on set the color of a mesh (in particular a submesh of a General Mesh) using code (i.e., using a RGB format). How can i do that? I can't find it in the documentation.

Thank you.
Logged
Vincent
Full Member
***
Posts: 191


View Profile WWW
« Reply #1 on: November 09, 2008, 02:28:41 pm »

Code:
<material name="red">
  <color red="1" green="0" blue="0" />
</material>
Logged
mik
Newbie
*
Posts: 36


View Profile Email
« Reply #2 on: November 10, 2008, 10:36:22 am »

That method is for loading the objects from a file, but i need set the color while programming the object in c++. Any idea? I'm using General Mesh.
Logged
bookeater2
Newbie
*
Posts: 45


View Profile Email
« Reply #3 on: November 10, 2008, 04:34:21 pm »

There are different ways with different benefits. Vertex colors for example, I think they can be set with iMeshObject.SetColor()? Those only work with a shader that reads them, like std_lighting. You could also change the texture it's self, like by drawing on it. You could just modify any shader to use a custom value.
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 5.155 seconds with 16 queries.