Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (Ayumi, 1 invisible), 1,085 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
draw on models textur? #124902
04/18/07 22:11
04/18/07 22:11

A
Anonymous OP
Unregistered
Anonymous OP
Unregistered
A



maybe it's already asked sometimes?

How can i draw (pixels/sprites) on a models texture at runtime?
And can i determin the color of a pixel of a models texture at runtime?

thanx mercuryus

Last edited by mercuryus; 04/18/07 22:13.
Re: draw on models textur? [Re: ] #124903
04/19/07 02:25
04/19/07 02:25
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
Happy Birthday xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
check the manual, lol.

It's a combination of functions...

Code:

bmap IDK = "Whatever.bmp";
var Color[4];
//
Function readThis(_x, _y, _format, &outColor)
{
var pixel;
pixel = pixel_for_bmap(mapIDK, _x, _y);
pixel_to_vec(color, color[3], _format, pixel);
}



Input X, Y, and FORMAT of bmap. outColor is the return vector of length 4. The fourth (really [3]) is the alpha value...


xXxGuitar511
- Programmer
Re: draw on models textur? [Re: xXxGuitar511] #124904
04/19/07 05:58
04/19/07 05:58

A
Anonymous OP
Unregistered
Anonymous OP
Unregistered
A



thanx - i knew this would be that apparent but sometime it's hard to remember where to be found .

Re: draw on models textur? [Re: xXxGuitar511] #124905
04/19/07 09:16
04/19/07 09:16

A
Anonymous OP
Unregistered
Anonymous OP
Unregistered
A



now i can draw on a bmp but how do i access to a MODELS TEXTURE (skin) this way?

edit: fixed! (it works, maybe there are better ways...)


entity* ent_cube; // assign the model with "ent_cube=me;"
bmap* bmp_skin;

var gv_format = 0;
var gv_pixel = 0;
var gv_alpha = 0;
var gv_col[3];

// get bmap from models texture
bmp_skin = bmap_for_entity(ent_cube,0);

// lock bmap
gv_format = bmap_lock(bmp_skin, 0);

// get pixel (x/y = 10/10)
gv_pixel=pixel_for_bmap(bmp_skin, 10, 10);

// get pixel color & alpha
pixel_to_vec(gv_col,gv_alpha, gv_format, gv_pixel);

// set color
temp.red = 55;
temp.green = 55;
temp.blue = 55;

// create pixel
gv_pixel = pixel_for_vec(temp,100,gv_format);

// set pixel
pixel_to_bmap(bmp_skin,10,10,gv_pixel);

// unlock skin
bmap_unlock(bmp_skin);


thanx, mercuryus

Last edited by mercuryus; 04/19/07 10:21.
Re: draw on models textur? [Re: ] #124906
04/19/07 11:44
04/19/07 11:44
Joined: May 2005
Posts: 155
C:\Program files\GStudio6
alphaindigo Offline
Member
alphaindigo  Offline
Member

Joined: May 2005
Posts: 155
C:\Program files\GStudio6
could i use this to let userd draw on the blend map in the first skin of my terrain? i want this so that users can create custom maps. and can i draw on a seriese of pixels such as in a small circle:
...............
...#.........##...
.###....#####.
...#.........##... etc.
...............

Last edited by alphaindigo; 04/19/07 11:47.
Re: draw on models textur? [Re: alphaindigo] #124907
04/19/07 14:10
04/19/07 14:10
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
Happy Birthday xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
yeah.. you could. I'm not sure how fast these methods are though. And I THINK that there is code on the wiki in the terrain shadow-map gen for saving tga's...


xXxGuitar511
- Programmer

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1