Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 900 guests, and 2 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
Page 1 of 2 1 2
RGB values? #87544
08/26/06 16:25
08/26/06 16:25
Joined: Jul 2006
Posts: 783
London, UK
sheefo Offline OP
User
sheefo  Offline OP
User

Joined: Jul 2006
Posts: 783
London, UK
Is it possible to make 3D GameStudio read colours as RGB instead of BGR? Like maybe in A7? (or the next update).

It's gets anoying when I have to ensure everything is colour is formatted as Blue, Green then Red. Who the hell uses BGR values anyway?

Re: RGB values? [Re: sheefo] #87545
08/26/06 16:45
08/26/06 16:45
Joined: Aug 2003
Posts: 7,439
Red Dwarf
Michael_Schwarz Offline
Senior Expert
Michael_Schwarz  Offline
Senior Expert

Joined: Aug 2003
Posts: 7,439
Red Dwarf
Quote:

Who the hell uses BGR values anyway?




Some LCD displays


"Sometimes JCL reminds me of Notch, but more competent" ~ Kiyaku
Re: RGB values? [Re: Michael_Schwarz] #87546
08/26/06 18:01
08/26/06 18:01
Joined: Jan 2003
Posts: 4,615
Cambridge
Joey Offline
Expert
Joey  Offline
Expert

Joined: Jan 2003
Posts: 4,615
Cambridge
the windows gdi and graphic cards store it in this order afaik.

Re: RGB values? [Re: Joey] #87547
08/26/06 19:14
08/26/06 19:14
Joined: Jul 2006
Posts: 783
London, UK
sheefo Offline OP
User
sheefo  Offline OP
User

Joined: Jul 2006
Posts: 783
London, UK
This was the first time I'd seen colour values formatted this way, I am used to RGB(A). Even DirectX uses RGB.
It would make life easier (for me) if 3D GameStudio used RGB... it's just a thought...

Re: RGB values? [Re: sheefo] #87548
08/27/06 03:18
08/27/06 03:18
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
ulillillia Offline
Senior Expert
ulillillia  Offline
Senior Expert

Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
When using BMP images, it's BGR format. You can make Gamestudio write BMP images. When writing the color 64, 128, 255, which is sky blue in the RGB format, it's treated as a bright grayish-orange color in the BGR format. You can see this for yourself. Just use this RGB color and save a small 16x16 BMP image of all this color. In a hex edittor, you'd see it as FF 80 40 repeated 256 times after the 54-byte file header data. I don't know if this applies to other image formats (like JPG, PNG, GIF, or, more easily, TGA (easy when uncompressed - Gamestudio can write uncompressed TGA images)).


"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip My 2D game - release on Jun 13th; My tutorials
Re: RGB values? [Re: ulillillia] #87549
08/27/06 15:53
08/27/06 15:53
Joined: Jul 2006
Posts: 783
London, UK
sheefo Offline OP
User
sheefo  Offline OP
User

Joined: Jul 2006
Posts: 783
London, UK
Oh yeah. I guess, but it's like using a CD (or VCR, if you like TV) instead of a DVD in the year 2006!

Re: RGB values? [Re: sheefo] #87550
08/27/06 19:34
08/27/06 19:34
Joined: Aug 2003
Posts: 7,439
Red Dwarf
Michael_Schwarz Offline
Senior Expert
Michael_Schwarz  Offline
Senior Expert

Joined: Aug 2003
Posts: 7,439
Red Dwarf
i still use CDs instead of DVD because CD's are more reliable...


"Sometimes JCL reminds me of Notch, but more competent" ~ Kiyaku
Re: RGB values? [Re: Michael_Schwarz] #87551
08/27/06 19:40
08/27/06 19:40
Joined: Jul 2006
Posts: 783
London, UK
sheefo Offline OP
User
sheefo  Offline OP
User

Joined: Jul 2006
Posts: 783
London, UK
... oh. Well, you got me there

EDIT: I just noticed that in SED, the 'color picker' writes it in RGB.

Re: RGB values? [Re: ulillillia] #87552
08/28/06 05:25
08/28/06 05:25
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
ulillillia Offline
Senior Expert
ulillillia  Offline
Senior Expert

Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
Quote:

You can make Gamestudio write BMP images.




This proves my claim (fully tested too using pure C-script - it makes a palette much like a 16-bit palette, complete with details):

Code:

var temp_handle;

function write_bmp()
{
// max_loops = 100000;
var red_color = 0;
var green_color = 255;
var blue_color = 0;
var bit_depth;
var current_data_chunk = 0;
// var total_data_chunks;

temp_handle = file_open_write("16bitpalette.bmp");
// start file header data
file_str_write(temp_handle, "BM");
file_asc_write(temp_handle, 54); // *1 // file size (4 bytes)
file_asc_write(temp_handle, 0); // *256
file_asc_write(temp_handle, 3); // *65536
file_asc_write(temp_handle, 0); // *16777216
file_asc_write(temp_handle, 0); // *1 // reserved (2 bytes)
file_asc_write(temp_handle, 0); // *256
file_asc_write(temp_handle, 0); // *1 // reserved (2 bytes)
file_asc_write(temp_handle, 0); // *256
file_asc_write(temp_handle, 54); // *1 // offset to main bitmap data (4 bytes)
file_asc_write(temp_handle, 0); // *256
file_asc_write(temp_handle, 0); // *65536
file_asc_write(temp_handle, 0); // *16777216
file_asc_write(temp_handle, 40); // *1 // size of the information sector (4 bytes)
file_asc_write(temp_handle, 0); // *256
file_asc_write(temp_handle, 0); // *65536
file_asc_write(temp_handle, 0); // *16777216
file_asc_write(temp_handle, 0); // *1 // image width (4 bytes)
file_asc_write(temp_handle, 4); // *256
file_asc_write(temp_handle, 0); // *65536
file_asc_write(temp_handle, 0); // *16777216
file_asc_write(temp_handle, 64); // *1 // image height (4 bytes)
file_asc_write(temp_handle, 0); // *256
file_asc_write(temp_handle, 0); // *65536
file_asc_write(temp_handle, 0); // *16777216
file_asc_write(temp_handle, 1); // *1 // number of planes (2 bytes)
file_asc_write(temp_handle, 0); // *256
file_asc_write(temp_handle, 24); // *1 // number of bits per pixel (2 bytes)
file_asc_write(temp_handle, 0); // *256
file_asc_write(temp_handle, 0); // *1 // type of compression - 0 if uncompressed (4 bytes)
file_asc_write(temp_handle, 0); // *256
file_asc_write(temp_handle, 0); // *65536
file_asc_write(temp_handle, 0); // *16777216
file_asc_write(temp_handle, 0); // *1 // size of image data (4 bytes)
file_asc_write(temp_handle, 0); // *256
file_asc_write(temp_handle, 3); // *65536
file_asc_write(temp_handle, 0); // *16777216
file_asc_write(temp_handle, 19); // *1 // X resolution - pixels per meter (4 bytes)
file_asc_write(temp_handle, 11); // *256
file_asc_write(temp_handle, 0); // *65536
file_asc_write(temp_handle, 0); // *16777216
file_asc_write(temp_handle, 19); // *1 // Y resolution - pixels per meter (4 bytes)
file_asc_write(temp_handle, 11); // *256
file_asc_write(temp_handle, 0); // *65536
file_asc_write(temp_handle, 0); // *16777216
file_asc_write(temp_handle, 0); // *1 // colors used - 0 if no pallete (4 bytes)
file_asc_write(temp_handle, 0); // *256
file_asc_write(temp_handle, 0); // *65536
file_asc_write(temp_handle, 0); // *16777216
file_asc_write(temp_handle, 0); // *1 // number of important colors - 0 if all are important (4 bytes)
file_asc_write(temp_handle, 0); // *256
file_asc_write(temp_handle, 0); // *65536
file_asc_write(temp_handle, 0); // *16777216
// end file header data

while(current_data_chunk < 65536) // all this creates a palette of 65,536 colors
{
current_data_chunk += 1;
file_asc_write(temp_handle, int(blue_color+0.5)); // BMP uses the BGR format
file_asc_write(temp_handle, int(green_color+0.5));
file_asc_write(temp_handle, int(red_color+0.5));

red_color += 8.226;

if (red_color >= 256)
{
red_color = 0;
blue_color += 8.226;

if (blue_color >= 256)
{
blue_color = 0;
green_color -= 4.048;
}
}
}

file_close(temp_handle);
}

on_v = write_bmp();



Given that it can write BMP files, I'm pretty sure it can write any type of file as well, openable in external programs (such as creating a pure sine WAV file or duplicating an MP3). This would be a decent enhancement for my benchmark tester - create BMP images instead of just numbers in a text file.


"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip My 2D game - release on Jun 13th; My tutorials
Re: RGB values? [Re: ulillillia] #87553
08/28/06 07:18
08/28/06 07:18
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
As to the original question: It is arguable whether RGB (as in DirectX) or BGR (as in all image formats) is better. Today I'd probably also use RGB and also the DirectX coordinate system with the upright Y axis. However, as you can imagine, once we've decided for a format we can hardly change it suddenly.

Page 1 of 2 1 2

Moderated by  old_bill, Tobias 

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