Draw constant size object regardless of zoom

  • Follow


Hi,
I want to draw a load of spheres that are drawn the same size no
matter how much the user zooms in or out of the scene (zooming is done
by translating).  They would be the same number of pixels across all
the time.  Is it possible?
I would have thought I could do something clever involving reading the
current model view matrix and then creating a new one, but would that
work in a list?

Any tips would be great,

bob
0
Reply bob_jeffcoat 4/18/2008 5:29:13 PM

bob_jeffcoat@hotmail.com a �crit :
> Hi,
> I want to draw a load of spheres that are drawn the same size no
> matter how much the user zooms in or out of the scene (zooming is done
> by translating).  They would be the same number of pixels across all
> the time.  Is it possible?
> I would have thought I could do something clever involving reading the
> current model view matrix and then creating a new one, but would that
> work in a list?
> 
> Any tips would be great,
> 
> bob

Hello,

I'm not sure of what you want to do. Isn't it ok to draw the spheres 
before doing the translation?

If you really want to perform a zoom, you got to change the field of 
vision (the first parameter of gluPerspective for example), translating 
will not have the same visual result.

Can you just precise what you really want to do? Will the spheres move 
(with rotations, etc...) or always remain at the same place in the 
screen whatever the transformations are?

David
0
Reply singin_dav 4/18/2008 6:17:00 PM


On Apr 18, 12:29 pm, bob_jeffc...@hotmail.com wrote:

> I want to draw a load of spheres that are drawn the same size no
> matter how much the user zooms in or out of the scene (zooming is done
> by translating).  They would be the same number of pixels across all
> the time.  Is it possible?

Perhaps:

// Zoom scene
glScalef(scale_fac, scale_fac, scale_fac);

// draw stuff

// Unzoom spheres
gluSphere(quad, radius / scale_fac, nslices, nstacks);

?

- Chris

0
Reply crjjrc 4/18/2008 6:46:49 PM

On Apr 18, 8:46 pm, crjjrc <crj...@gmail.com> wrote:
> On Apr 18, 12:29 pm, bob_jeffc...@hotmail.com wrote:
>
> > I want to draw a load of spheres that are drawn the same size no
> > matter how much the user zooms in or out of the scene (zooming is done
> > by translating).  They would be the same number of pixels across all
> > the time.  Is it possible?
>
> Perhaps:
>
> // Zoom scene
> glScalef(scale_fac, scale_fac, scale_fac);
>

I could have sworn he said "zooming is done by translating"...

Visible size of an object is simple trigonometry.

http://tinyurl.com/6aobsh

You know the angle of view "a" (the parameter passed to
glFrustum/gluPerspective) and you can calculate "n" - the
distance from the viewer to the object

--
<\___/>
/ O O \
\_____/  FTB.     Remove my socks for email address.
0
Reply fungus 4/18/2008 7:05:06 PM

<bob_jeffcoat@hotmail.com> wrote in message 
news:ecb90bf2-dd7e-4eb7-8124-1ea2f4a3adea@m3g2000hsc.googlegroups.com...
> Hi,
> I want to draw a load of spheres that are drawn the same size no
> matter how much the user zooms in or out of the scene (zooming is done
> by translating).  They would be the same number of pixels across all
> the time.  Is it possible?
> I would have thought I could do something clever involving reading the
> current model view matrix and then creating a new one, but would that
> work in a list?
>
> Any tips would be great,
>
> bob

could they be bitmap opjects ?

jbw 


0
Reply jbwest 4/19/2008 1:26:03 AM

On Apr 18, 2:05 pm, fungus <openglMYSO...@artlum.com> wrote:

> > > I want to draw a load of spheres that are drawn the same size no
> > > matter how much the user zooms in or out of the scene (zooming is done
> > > by translating).  They would be the same number of pixels across all
> > > the time.  Is it possible?
>
> > // Zoom scene
> > glScalef(scale_fac, scale_fac, scale_fac);
>
> I could have sworn he said "zooming is done by translating"...

Why are you so angry and sarcastic?  There are multiple ways to zoom.
If he can achieve his goal through an alternate way, I'm going to
suggest it.

- Chris
0
Reply crjjrc 4/21/2008 12:21:12 PM

On 21 Apr, 13:21, crjjrc <crj...@gmail.com> wrote:
> On Apr 18, 2:05 pm, fungus <openglMYSO...@artlum.com> wrote:
>
> > > > I want to draw a load of spheres that are drawn the same size no
> > > > matter how much the user zooms in or out of the scene (zooming is done
> > > > by translating).  They would be the same number of pixels across all
> > > > the time.  Is it possible?
>
> > > // Zoom scene
> > > glScalef(scale_fac, scale_fac, scale_fac);
>
> > I could have sworn he said "zooming is done by translating"...
>
> Why are you so angry and sarcastic?  There are multiple ways to zoom.
> If he can achieve his goal through an alternate way, I'm going to
> suggest it.
>
> - Chris

hello,

sorry, i wasn't very clear.  I draw a 3D shape that the user can pan/
orbit/zoom.  On this 3D shape there are a number of markers that
represent important points.  I want these markers to be drawn in 3D
and shaded but to be constant size in the view.  This would mean that
when the view was very zoomed out the 3D shape may be obscured by
comparitively very large markers.  When the view was very zoomed in
the markers would seem much smaller compared to the 3D shape.
The effect would be the same as if I was using a bitmap object, as was
suggested, but I want them to be shaded spheres.  Also, when the
markers draw themselves they want to create a GL list that exhibits
this behaviour, I don't want to have to redraw them as the view is
zoomed.

Is it possible?

Thanks,
0
Reply bob_jeffcoat 4/21/2008 4:36:44 PM

<bob_jeffcoat@hotmail.com> wrote in message 
news:7c317061-5e2c-4e46-aa8d-7f4f43be524d@p25g2000pri.googlegroups.com...
> On 21 Apr, 13:21, crjjrc <crj...@gmail.com> wrote:
>> On Apr 18, 2:05 pm, fungus <openglMYSO...@artlum.com> wrote:
>>
>> > > > I want to draw a load of spheres that are drawn the same size no
>> > > > matter how much the user zooms in or out of the scene (zooming is 
>> > > > done
>> > > > by translating).  They would be the same number of pixels across 
>> > > > all
>> > > > the time.  Is it possible?
>>
>> > > // Zoom scene
>> > > glScalef(scale_fac, scale_fac, scale_fac);
>>
>> > I could have sworn he said "zooming is done by translating"...
>>
>> Why are you so angry and sarcastic?  There are multiple ways to zoom.
>> If he can achieve his goal through an alternate way, I'm going to
>> suggest it.
>>
>> - Chris
>
> hello,
>
> sorry, i wasn't very clear.  I draw a 3D shape that the user can pan/
> orbit/zoom.  On this 3D shape there are a number of markers that
> represent important points.  I want these markers to be drawn in 3D
> and shaded but to be constant size in the view.  This would mean that
> when the view was very zoomed out the 3D shape may be obscured by
> comparitively very large markers.  When the view was very zoomed in
> the markers would seem much smaller compared to the 3D shape.
> The effect would be the same as if I was using a bitmap object, as was
> suggested, but I want them to be shaded spheres.  Also, when the
> markers draw themselves they want to create a GL list that exhibits
> this behaviour, I don't want to have to redraw them as the view is
> zoomed.
>
> Is it possible?
>
> Thanks,

see "point sprite".
-jbw



0
Reply jbwest 4/22/2008 1:23:35 AM

7 Replies
394 Views

(page loaded in 1.597 seconds)

Similiar Articles:













7/22/2012 8:52:07 PM


Reply: