I want to fill with color a triangle?
I want to fill with color a triangle?
Which graphics API are you using?
Videogame Memories!
A site dedicated to keeping videogame memories alive!
http://www.videogamememories.com/
Share your experiences with us now!
"We will game forever!"
I dunno, do you? Be sure to weigh the pros and cons first and make sure you really want to fill a triangle with colour.I want to fill with color a triangle?
EDIT: sorry, I couldn't resist.
Last edited by psychopath; 05-01-2007 at 06:03 AM.
M.Eng Computer Engineering CandidateB.Sc Computer Science
Robotics and graphics enthusiast.
For each x draw a line such that x -> T(x), :-D (imagine integrals). This could be a stupid answer, i mean I guess there's a better way to do it.
I do know OpenGL supports such functionality, just envoke the right properties or something, google.com.
If your triangle is at an angle you'd just find the slope and include it in to the calculation for x->T(x), where T(x) is each point of the triangle above what ever side you use as the base.
Like if you're using side A, then draw a line from every point at A to B->C, or just C/B if it's 90d triangle...
This is probably a really dumb idea since it would likely take a lot of calculations and there's probably low level API exposed in what your using to fill shapes.
Why didn't you just google what ever your using and look for documentation... ?
How on earth do you just say "i want to fill a triangle with a color." I can't read your freaking mind!!! What are you making triangles with? Noodles? Because if your using noodles, just pour the sauce in the gap.
Or if you made a triangle with plastic spoons, I'd probably use cardboard cut outs, make sure to get a variety pack of colored papers.
*sorry, -I- couldn't resist.*
quick OpenGL code
Code:glColor3f(1.0, 1.0, 1.0);//fils triangle with white glBegin(GL_TRIANGLES); glVertex3f(-1.0, -1.0, 0.0); //bottom left vertex glVertex3f(0.0, 1.0, 0.0); //top vertex glVertex3f(1.0, -1.0, 0.0); //bottom right vertex glEnd();
If you use GDI you can call CreatePolygonRgn() and FillRgn
I think you guys are not funny at all, despite how hard you're trying to.
Any idiot can see that he's looking for an efficient solution, and that the question mark was just a typo. If you knew a way, you didn't have to know his graphics library to explain it.
If you think you know a function call to do this, the only thing you would ask is: "What graphics API are you using". Period.
Question mark, actually.
But you seem to know none of these, so we don't need your comments at all.
Except if he's using GDI (presumably 2D), then there are, as you pointed out, functions that create 2D filled triangles. If he's using OpenGL or Direct3D, you don't fill a triangle with colour by colouring the pixels in the region like you generally do in a 2D library, you define a triangle with verticies and set the vertex colour. So yeah, I do need to know the graphics library.Originally Posted by pronecracker
In any case, it was a joke. It was also meant to (perhaps a little too sarcastically) point out to the OP that he gave basically no information for us to go by to help him. Lighten up.
EDIT:
I don't see where he asked us how to effeciently fill a triangle.Originally Posted by pronecracker
Last edited by psychopath; 06-04-2007 at 11:10 AM.
M.Eng Computer Engineering CandidateB.Sc Computer Science
Robotics and graphics enthusiast.