single colour rectangles on a single surface

Blitz3D Forums/Blitz3D Programming/single colour rectangles on a single surface

Fry Crayola(Posted 2004) [#1]
I'm using a single surface system for my graphics, and want to be able to draw a rectangle of a single colour onto this surface.

I don't believe Vertex Colours would do the trick, as using them means I can't use my brush (and therefore all my graphics can't be displayed).

The best way I can think of is to have a section of the texture I use set aside, and draw on it a single pixel of the required colour. I can then use this as the u,v coords for the quad and the rectangle will be textured as required.

However, such a method means I have to have the colours I want to use predefined. Not really a problem, but considering this texture is split into tiles which can be loaded or deleted as appropriate, I have to set aside one whole tile for this information - or implement a system of smaller tiles for one section of the texture.

Before I begin all that, I ask "Is there a simpler way to achieve what I want?" It could save me a lot of work.

Ta.


fredborg(Posted 2004) [#2]
Why can't you use a brush with vertex colors?


Fry Crayola(Posted 2004) [#3]
The manual gives me the impression that you can either use vertex colouring, or textured brushes, but not both. I haven't tested yet, so maybe that's not true.

Do you know for sure?


fredborg(Posted 2004) [#4]
Yes :) Just keep a white pixel on your texture and stretch that across the tris where you want a plain color. Then color it using vertex colors. Remember to set the BrushFX to 2 to enable vertex colors.


Fry Crayola(Posted 2004) [#5]
What happens if I don't set the u,v coords on the vertex? I did that and it comes out as a white texture which can be coloured using vertex colours (set the FX).

What is the default if you don't set u,v?


fredborg(Posted 2004) [#6]
the default u,v if you create a vertex is 0,0 which is the top left hand corner of the texture.


Fry Crayola(Posted 2004) [#7]
That makes sense now. So I'll just ensure there's a pixel free for my purposes.