Raydium 3D Game Engine

Official forum for everything about Raydium, ManiaDrive, MeMak, ...
It is currently Thu Mar 28, 2024 12:28 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Thu Jun 01, 2006 7:06 am 
Offline
User avatar

Joined: Sun May 28, 2006 7:17 pm
Posts: 12
Location: USA
Hi again, more dumb questions from me.

I've got a few objects loaded, using raydium_ode_object_create, and then raydium_ode_object_sphere_add. I don't have a uv map applied to them and I just want to change their colors. I found the function raydium_rendering_rgb_force, and that worked fine for changing both of the meshes to the same color, but what can I do to make the 2 meshes have different colors?

I think I could just set the material in blender, but I'm wondering if I could do it with something like the rendering_rgb_force function to have a bunch of different colors in game. I would like to just be able to pass an rgb value to different objects I have loaded.

If not, do I need to load a material with something like this?
raydium_texture_load("rgb(0.8,0.1,0.1)")

After loading the material or texture, I was confused how to apply it to the mesh. I think I need to apply the texture to each vertice, but I'm still confused. This is my first time working with opengl, so I was wondering if Raydium had something built in to do that for me. I've taken a look through the code to see how it's loading the texture from the .tri files but it's a bit overwhelming to me.

Thanks :)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 01, 2006 9:40 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2591
Location: gnniiiii (Scrat)
The idea is quite simple : use the raydium_ode_BeforeElementDrawCallback and raydium_ode_AfterElementDrawCallback callbacks to force the needed color.

You must be able to detect each element to apply the correct color, and the best method is to use tags :

Code:
char draw_element_before(int elem)
{
int tag;
tag=raydium_ode_element_tag_get(elem);
switch(tag)
   {
   case 1: raydium_rendering_rgb_force(...); break;
   case 2: raydium_rendering_rgb_force(...); break;
   ...
   }
return 1; // draw element
}

void draw_element_after(int elem)
{
raydium_rendering_rgb_normal();
}

[...]
// objects creation
raydium_ode_object_sphere_add("element1",obj1,0.5,RAYDIUM_ODE_AUTODETECT,RAYDIUM_ODE_STANDARD,1,"mesh.tri");
[...]
raydium_ode_object_sphere_add("element2",obj2,0.5,RAYDIUM_ODE_AUTODETECT,RAYDIUM_ODE_STANDARD,2,"mesh.tri");
[...]
// before calling raydium_callback() :
raydium_ode_BeforeElementDrawCallback=draw_element_before;
raydium_ode_AfterElementDrawCallback=draw_element_after;


Dunno if it's clear ? :)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 02, 2006 6:51 am 
Offline
User avatar

Joined: Sun May 28, 2006 7:17 pm
Posts: 12
Location: USA
That works great, thanks for all the help again Xfennec. :D


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 27 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group