Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

OpenGL / C++

Name: Anonymous 2009-08-17 10:56

Sup /prog/
I'm currently trying my way around OpenGL. I've drawn a simple Rectangle and I also know how to determine the current mouse position, when the left mouse button is clicked.
Now how can I found out the window coordinates of my rectangle so I can check if the user does a left click inside the rectangle?

Name: Anonymous 2009-08-17 11:00

>>1
Read SICP.

Name: Anonymous 2009-08-17 11:09

Now how can I found out the window coordinates of my rectangle
You drew it.

Name: Anonymous 2009-08-17 11:11

>>3
I mean how do I found out the WINDOW COORDINATES of where I drew it.

glBegin(GL_QUADS);
      glVertex3f(-2.5f, 1.0f, -6.0f);
        glVertex3f(-0.5f, 1.0f, -6.0f);
        glVertex3f(-0.5f, -1.0f, -6.0f);
        glVertex3f(-2.5f, -1.0f, -6.0f);
    glEnd();


This is how I drew it. But I need window coordinates for checking if the user clicks within the rectangle.

Name: Anonymous 2009-08-17 11:13

>>1
I've never used OpenGl, but wouldn't you need one corner and a size (or two corners) to draw a rectangle? If you can't work out it out from those you have no business programming.

Name: Anonymous 2009-08-17 11:22

>>4
If you're doing 2d, you can adjust the scale to work in window pixels. Otherwise, do some math.

Name: Anonymous 2009-08-17 11:23

>>5
>>6

Yeah just found out I can do it via gluProject. Just need to find a way to generalize the function call so that it works on any given rectangle (or object for that matter). Thanks though.

Name: Anonymous 2010-11-15 21:29

Name: Anonymous 2010-12-06 9:17

Back to /b/, ``GNAA Faggot''

Name: Anonymous 2011-01-31 20:32

<-- check em dubz

Name: Anonymous 2013-09-06 10:33

n [o]
e
s
t
e
d

q
u
o
t
e
s
[o/]

Name: Anonymous 2013-09-06 10:34

n [o]
e
s
t
e
d

q
u
o
t
e
s
[o/]

Name: Anonymous 2013-09-06 10:34

n
e
s
t
e
d

q
u
o
t
e
s

Name: Anonymous 2013-09-06 10:37


N
E
S
T
E
D

Q
U
O
T
E
S
?
[/o]

Name: Anonymous 2013-09-06 10:38


N
E
S
T
E
D

Q
U
O
T
E
S
?
[/o]

Name: Anonymous 2013-09-06 10:40

That was embarrassing.

N
E
S
T
E
D

Q
U
O
T
E
S
?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List