Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

glPushAttrib

64 views
Skip to first unread message

V-man

unread,
Feb 22, 2001, 6:54:44 PM2/22/01
to

I needed to use glPushAttrib but the damn thing doesn't work.
I have cull facing enabled and I did this

glPushAttrib(GL_CULL_FACE);
glDisable(GL_CULL_FACE);
.....
glPopAttrib();

and then cull facing was disabled. Why? Isn't it suppose to be enabled or
did I miss something somewhere.

V-man

George Ziniewicz

unread,
Feb 22, 2001, 7:45:38 PM2/22/01
to

Is there a difference between GL_ENABLE_BIT and GL_POLYGON_BIT, both of
which show a GL_CULL_FACE component, or is it the same?

zin

--

For PC & Mac 3-D graphics shareware & more: http://www.zintel.com

Jason Allen

unread,
Feb 22, 2001, 11:39:18 PM2/22/01
to
GL_CULL_FACE isn't an attribute that glPushAttrib takes as a parameter. You
have to save the polygon attribute bit like so:

glPushAttrib(GL_POLYGON_BIT);

The current face culling mode is saved in the polygon bit.

Jason A.
DelphiGL (http://delphigl.cfxweb.net)
"V-man" <v_me...@alcor.concordia.ca> wrote in message
news:Pine.OSF.4.31.01022...@alcor.concordia.ca...

Jason Allen

unread,
Feb 22, 2001, 11:40:40 PM2/22/01
to
Hi,

The GL_ENABLE_BIT just saves whether back face culling is enabled. The
GL_POLYGON_BIT saves the face culling method (front or back).

Jason A.
DelphiGL (http://delphigl.cfxweb.net)

"George Ziniewicz" <zi...@home.com> wrote in message
news:3A95C08C...@home.com...

Marcus Lindblom

unread,
Feb 23, 2001, 1:00:10 AM2/23/01
to

"V-man" <v_me...@alcor.concordia.ca> wrote in message
news:Pine.OSF.4.31.01022...@alcor.concordia.ca...
>
> I needed to use glPushAttrib but the damn thing doesn't work.
> I have cull facing enabled and I did this
>
> glPushAttrib(GL_CULL_FACE);
> glDisable(GL_CULL_FACE);
> .....
> glPopAttrib();

GL_CULL_FACE is not a valid argument to glPushAttrib().

If you run glError() and test the results, you are more likely to catch
stupid errors. I've sprinkled calls all over my code, throwing exceptions
when a glError has occured and I'm able to pinpoint runtime errors quite
fast.

/Marcus


ZZ

unread,
Feb 22, 2001, 9:47:45 PM2/22/01
to
cull face is part of the polygon/enable attribute group (see back of red book)
so either
glPushAttrib(GL_ENABLE_BIT);
or
glPushAttrib(GL_POLYGON_BIT);
or both

one sure fire way is GL_ALL_ATTRIB_BITS

--
lets hear it 4 billy bollux and his AMAZING bouuuncing balls
zed zeek - big bollucked king of the world , messiah , and all round nice guy.
GET IT HERE http://members.xoom.com/myBollux FREE BOLLUX

"V-man" <v_me...@alcor.concordia.ca> wrote in message
news:Pine.OSF.4.31.01022...@alcor.concordia.ca...
>

V-man

unread,
Feb 23, 2001, 1:17:14 PM2/23/01
to

Ahh! I see that some of the bits are grouped. Should have read the fine
print!

V-man

Paul Martz

unread,
Feb 23, 2001, 9:27:20 AM2/23/01
to
"Jason Allen" <jra...@home.com> wrote in message
news:WIll6.601$z_3.14...@den-news1.rmi.net...

> GL_CULL_FACE isn't an attribute that glPushAttrib takes as a parameter.

Correct. The OP could have determined this quite quickly with a call to
glGetError(), which would have retuend GL_INVALID_ENUM.
--
-Paul Martz (paul_...@hp.com)
Hewlett Packard TCD Personal Workstations Lab
OpenGL FAQ: http://www.opengl.org/developers/faqs/technical.html
http://www.frii.com/~martz/oglfaq

Andrew F. Vesper

unread,
Feb 24, 2001, 10:55:04 AM2/24/01
to
Paul Martz wrote:

> "Jason Allen" <jra...@home.com> wrote in message
> news:WIll6.601$z_3.14...@den-news1.rmi.net...
> > GL_CULL_FACE isn't an attribute that glPushAttrib takes as a parameter.
>
> Correct. The OP could have determined this quite quickly with a call to
> glGetError(), which would have retuend GL_INVALID_ENUM.

GL_CULL_FACE is equal to 0x0B44, which is the
same as:

GL_LINE_BIT | GL_LIGHTING_BIT | GL_DEPTH_BUFFER_BIT | GL_ACCUM_BUFFER_BIT |
GL_VIEWPORT_BIT

So this is a perfectly good call to glPushAttrib, although the "spelling" isn't
correct.
--
Andy V (OpenGL Alpha Geek)
"In order to make progress, one must leave the door to the unknown ajar."
Richard P. Feynman, quoted by Jagdish Mehra in _The Beat of a Different Drum_.

Paul Martz's OpenGL FAQ: http://www.opengl.org/developers/faqs/technical.html


V-man

unread,
Feb 24, 2001, 10:58:56 AM2/24/01
to

I was wondering why there were no erors generated. thanks! Anyway, that's
fixed.

V-man

Marcus Lindblom

unread,
Feb 25, 2001, 5:37:15 PM2/25/01
to

"Andrew F. Vesper" <andy....@acm.org> wrote in message
news:3A97D958...@acm.org...

> Paul Martz wrote:
>
> > "Jason Allen" <jra...@home.com> wrote in message
> > news:WIll6.601$z_3.14...@den-news1.rmi.net...
> > > GL_CULL_FACE isn't an attribute that glPushAttrib takes as a
parameter.
> >
> > Correct. The OP could have determined this quite quickly with a call to
> > glGetError(), which would have retuend GL_INVALID_ENUM.
>
> GL_CULL_FACE is equal to 0x0B44, which is the
> same as:
>
> GL_LINE_BIT | GL_LIGHTING_BIT | GL_DEPTH_BUFFER_BIT |
GL_ACCUM_BUFFER_BIT |
> GL_VIEWPORT_BIT
>
> So this is a perfectly good call to glPushAttrib, although the "spelling"
isn't
> correct.

There goes my authority. :)

GL seriously need a C++ wrapper with stronger type checking.
(And function overloads, dammit!) Perhaps something like this
already exists?

/Marcus


0 new messages