Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Mouse Over OpenGL Primitiv
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
JimmyHChan@gmail.com  
View profile  
 More options Dec 4 2008, 1:26 pm
From: "JimmyHC...@gmail.com" <JimmyHC...@gmail.com>
Date: Thu, 4 Dec 2008 10:26:20 -0800 (PST)
Local: Thurs, Dec 4 2008 1:26 pm
Subject: Re: Mouse Over OpenGL Primitiv
I started reading chapter 13 of the Red book http://glprogramming.com/red/chapter13.html

Being a noob, I'm not sure if this help or if pyglet has anything
predefined.

On Dec 2, 9:43 am, "Drew Smathers" <drew.smath...@gmail.com> wrote:

> On Tue, Dec 2, 2008 at 12:10 PM, Silentpolygon <ThorstenWer...@gmx.net> wrote:

> > Hi everybody

> > This is the code, that i have right now. Sorry for the german
> > comments, but I think it should be understandable code. It draws 2 Hex
> > Polys. Now i want know how does pyglet know if the Mouse cursoer is
> > over one of them. Searched in the OpenGL and PyGlet docs but I could
> > not find anything. A Hint would be much appreciated.

> Neither OpenGL or Pyglet "knows" when the mouse is over a geometric
> primitive.  This is functionality you need to implement based on mouse
> location (see pyglet docs) and testing whether the point is inside the
> target shape.  In 2d application this is simple for circles and
> axis-aligned rectangles, but for arbitrary polygons, some more math is
> needed.

> > Thanks in advance
> > Thorsten

> > from pyglet.gl import *
> > window = pyglet.window.Window()

> > class my_hexagon():
> >        def __init__(self, posX, posY):
> >                glBegin(GL_TRIANGLE_FAN)
> >                glVertex2f(posX, posY) # Mittelpunkt
> >                glVertex2f(posX-50, posY-86.6) # Unten Links
> >                glVertex2f(posX+50, posY-86.6) # Unten Rechts
> >                glVertex2f(posX+100, posY) # Rechts
> >                glVertex2f(posX+50, posY+86.6) # Oben Rechts
> >                glVertex2f(posX-50, posY+86.6) # Oben Links
> >                glVertex2f(posX-100, posY) # Links
> >                glVertex2f(posX-50, posY-86.6) # Unten Links
> >                glEnd()

> > @window.event
> > def on_draw():
> >        glClear(GL_COLOR_BUFFER_BIT)
> >        glLoadIdentity()
> >        HexA = my_hexagon(400, 400)
> >        HexB = my_hexagon(200, 200)

> > pyglet.app.run()

> --
> \\\\\/\"/\\\\\\\\\\\
> \\\\/ // //\/\\\\\\\
> \\\/  \\// /\ \/\\\\
> \\/ /\/ / /\/ /\ \\\
> \/ / /\/ /\  /\\\ \\
> / /\\\  /\\\ \\\\\/\
> \/\\\\\/\\\\\/\\\\\\
>                d.p.s


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.