GLBasic forum

Main forum => GLBasic - en => Topic started by: neseir on 2009-Jan-26

Title: Set color on loaded object (ddd)
Post by: neseir on 2009-Jan-26
Hi

I'm trying to set color (override) on an external defined object (ddd format) that I want to be displayd multiple times but with different colors. I can not see any commands in the x_ set of commands to make this work. What is the best approach to do this ?

Regards
Eirik
Title: Re: Set color on loaded object (ddd)
Post by: Kitty Hello on 2009-Jan-26
No. Load a set of differently coloured textures and use X_SETTEXTURE for it.
Title: Re: Set color on loaded object (ddd)
Post by: Hemlos on 2009-Jan-26
Also, another approach, using no textures..
If you built the objects using the x_OBJADDVERTEX commands:

Code (glbasic) Select

vertcolor=RGB(255,255,255)
X_OBJADDVERTEX  0,  0,   0, 0,0,vertcolor


You can make all the colors you want using that method.
What you do is
1. save each object with a unique name....
2. then build an object with frames using convert3d tool

This builds a single object. The colors can be accessed by a frame #
Title: Re: Set color on loaded object (ddd)
Post by: neseir on 2009-Jan-27
Thanks for the response

I'm not sure which approach I will use. Currently I'm doing a "fall-back" to basic gl commands (using the gl file supplied in the common directory). The idea is to create something like a simple particle engine (I are going to look into the one that is already listed in the forum too but now I'm just exploring to get to know the features of GLBasic).

I might use a simple object where I apply a simple texture which are gradient colored and use the texture offset to make the different particles appear with slightly different colors.

Regards
Eirik
Title: Re: Set color on loaded object (ddd)
Post by: mathux on 2009-Jan-28
You could also create 1x1 colored textures on the fly.
Look at the following commands:

- GRABSPRITE
- CREATESCREEN
- USESCREEN

And yes: I like the cool things you can do with the virtual screens. It's magic.