Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
stencil buffer working with draw to bitmap?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
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
 
Peter Meier  
View profile  
 More options Nov 5 2002, 10:22 am
Newsgroups: comp.graphics.api.opengl
From: Peter Meier <peter.me...@iwb.tum.de>
Date: Tue, 05 Nov 2002 16:22:48 +0100
Local: Tues, Nov 5 2002 10:22 am
Subject: stencil buffer working with draw to bitmap?
Hello out there, please help,

I am writing a windows service-application (no visible window), that
renders a scene with opengl and writes pictures out. Rendered things
come out, but the stencil buffer does not work. I am rendering a 3D
scene and then drawing a background with drawpixels. Drawpixels should
not draw where any 3d things are drawn. This method works well with
PFD_DRAW_TO_WINDOW and doublebuffering. In the bitmap setup drawpixels
draws everywhere (overwriting the rendered scene). I take the picture by
using glReadPixels. Thanks for helping, Peter

Here my pfd setup:
static PIXELFORMATDESCRIPTOR pfd = {
    sizeof(PIXELFORMATDESCRIPTOR),            // Size of this structure
      1,                                      // Version of this
structure
      PFD_DRAW_TO_BITMAP |                    // Draw to bitmap
      PFD_SUPPORT_OPENGL |
      PFD_SUPPORT_GDI,
      PFD_TYPE_RGBA,                          // RGBA Color mode
      m_BitsPerPixel,                                   // Want 24bit
color
      0,0,0,0,0,0,                            // Color bits ignored
      0,0,                                    // No alpha buffer
      0,0,0,0,0,                              // Shift bits ignored
      16,                                     // Size of depth buffer
      16,           //16-bit stencil buffer
      0,                                      // no auxiliary buffer
      PFD_MAIN_PLANE,                         // Draw in main plane
      0,                                      // reserved
      0,0,0         // layer masks ignored
 };

Here my stencil setup:

glEnable(GL_STENCIL_TEST | GL_DEPTH_TEST);

//if zbuffertest is passed then write 1 to stencil buffer
 glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);

// Clear out the color, stencil & depth buffers
 glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT |
GL_STENCIL_BUFFER_BIT);

 //renderfirst setting stencil
 //stencil test is always passed
 glStencilFunc(GL_ALWAYS, 1, 1);
 render3D();

 //drawvideo where stencil isn't set to 1
 glStencilFunc (GL_NOTEQUAL, 1, 1);
  //video changes projection setup, we safe current projection
 glMatrixMode(GL_PROJECTION);
 glPushMatrix();
 render2D();

//return to 3D Projection
glMatrixMode(GL_PROJECTION);
 glPopMatrix();
 glMatrixMode(GL_MODELVIEW);

--
Dipl.-Ing. Peter Meier
Phone:  +49 (0)89 289 15570
Fax:    +49 (0)89 289 15555

Institut für Werkzeugmaschinen und Betriebswissenschaften (iwb)
Prof. Dr.-Ing. M. Zäh
Prof. Dr.-Ing. G. Reinhart
TU Muenchen

peter.me...@iwb.tum.de
http://www.iwb.tum.de


 
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.
Jerker Olofsson  
View profile  
 More options Nov 5 2002, 11:10 am
Newsgroups: comp.graphics.api.opengl
From: Jerker Olofsson <Jerker.Olofs...@epl.ericsson.se>
Date: Tue, 05 Nov 2002 16:55:07 +0100
Local: Tues, Nov 5 2002 10:55 am
Subject: Re: stencil buffer working with draw to bitmap?

Peter Meier wrote:

> Hello out there, please help,

> I am writing a windows service-application (no visible window), that
> renders a scene with opengl and writes pictures out. Rendered things
> come out, but the stencil buffer does not work. I am rendering a 3D
> scene and then drawing a background with drawpixels. Drawpixels should
> not draw where any 3d things are drawn. This method works well with
> PFD_DRAW_TO_WINDOW and doublebuffering. In the bitmap setup drawpixels
> draws everywhere (overwriting the rendered scene). I take the picture by
> using glReadPixels. Thanks for helping, Peter

<snip>

Try switching from 24bpp to 32bpp..


 
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.
Peter Meier  
View profile  
 More options Nov 5 2002, 12:00 pm
Newsgroups: comp.graphics.api.opengl
From: Peter Meier <peter.me...@iwb.tum.de>
Date: Tue, 05 Nov 2002 18:00:47 +0100
Local: Tues, Nov 5 2002 12:00 pm
Subject: Re: stencil buffer working with draw to bitmap?
Hello, thanks a lot for the reply, but I just now found the error.
Unfortunately I know what I dit to fix it, but I do not know why it works now.
Apparently there must have been some openGL calls in some lib, that screwed up
my stencil function. I just repeated the call at another place and now it
works.

See ya, Peter

Jerker Olofsson schrieb:

--
Dipl.-Ing. Peter Meier
Phone:  +49 (0)89 289 15570
Fax:    +49 (0)89 289 15555

Institut für Werkzeugmaschinen und Betriebswissenschaften (iwb)
Prof. Dr.-Ing. M. Zäh
Prof. Dr.-Ing. G. Reinhart
TU Muenchen

peter.me...@iwb.tum.de
http://www.iwb.tum.de


 
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.
End of messages
« Back to Discussions « Newer topic     Older topic »