OpenGL Quad Rendering
Moderator: Coders of Rage
OpenGL Quad Rendering
I was watching your video on Quad rendering (Rectangles) with opengl which inspired me to try and clone it. I was just wondering how exactly you derived your vector positions from the scale, width, height and position of the rectangle. And do you have to constantly update this? Any information would be great.
- RyanPridgeon
- Chaos Rift Maniac
- Posts: 447
- Joined: Sun Sep 21, 2008 1:34 pm
- Current Project: "Triangle"
- Favorite Gaming Platforms: PC
- Programming Language of Choice: C/C++
- Location: UK
- Contact:
Re: OpenGL Quad Rendering
You can use the glScale, glRotate and glTranslate functions with glPushMatrix and glPopMatrix to do this.
- Ginto8
- ES Beta Backer
- Posts: 1064
- Joined: Tue Jan 06, 2009 4:12 pm
- Programming Language of Choice: C/C++, Java
Re: OpenGL Quad Rendering
well for rendering I completely agree with RyanPridgeon, but if you are trying to find those coordinates for collision detection or the sort, avansc's "Separating Axis Theorem for the Rest of Us" has an algorithm: (Taken from cRect::calc_World_Coords())dejai wrote:I was watching your video on Quad rendering (Rectangles) with opengl which inspired me to try and clone it. I was just wondering how exactly you derived your vector positions from the scale, width, height and position of the rectangle. And do you have to constantly update this? Any information would be great.
Code: Select all
/*
x' = cos(theta)*x - sin(theta)*y
y' = sin(theta)*x + cos(theta)*y
*/
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.