Click here to Skip to main content
14,663,843 members
Home » Discussions » C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: array of 32bit container Pin
Member 1481234224-Apr-20 20:52
MemberMember 1481234224-Apr-20 20:52 
GeneralRe: array of 32bit container Pin
Member 1481234224-Apr-20 20:53
MemberMember 1481234224-Apr-20 20:53 
GeneralRe: array of 32bit container Pin
Richard MacCutchan24-Apr-20 22:07
mveRichard MacCutchan24-Apr-20 22:07 
QuestionFile Explorer Properties Dialog - SOLVED Pin
Richard Andrew x6424-Apr-20 4:27
professionalRichard Andrew x6424-Apr-20 4:27 
QuestionOpenGL stencil not working... Pin
Vaclav_22-Apr-20 10:38
MemberVaclav_22-Apr-20 10:38 
AnswerRe: OpenGL stencil not working... Pin
leon de boer22-Apr-20 19:16
Memberleon de boer22-Apr-20 19:16 
GeneralRe: OpenGL stencil not working... Pin
Vaclav_23-Apr-20 3:10
MemberVaclav_23-Apr-20 3:10 
GeneralRe: OpenGL stencil not working... Pin
Vaclav_23-Apr-20 8:11
MemberVaclav_23-Apr-20 8:11 
Here is my latest code.
I'll try to delete my debugging stuff. Hope I 'll not delete something important.
The code basically works, it does apply the stencil - to show only data INSIDE the stencil circle.

BUT
ONLY when I enable viewing of the stencil AND data being written to the color buffer.
I have highlighted the code. I was under the impression this is ONLY for viewing the stencil, but apparently not.

Obviously I do not have to re-able the color buffer , hence I get BOTH - stencil and the stencilled "fragment".

I have no idea how to proceed and where is my error.






      //
			glClear(
			GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);

			glDisable( GL_STENCIL_TEST);
			glEnable(GL_STENCIL_TEST);
			// clear all three buffers
			glClearStencil(0x0);
			glClear(
			GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
			glStencilMask(GL_TRUE); // MUST enable writing to stencil buffer (??)
			// turn off writing to color buffer
			glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
			// enable only to verify the stencil
			//glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
			// setup stencil function
			// function  - test always are ref and mask bogus , ignored ?
			// referrence
			// mask
			glStencilFunc(GL_ALWAYS, 1, 1);							

			// setup stencil operation
			//glStencilOp(GL_REPLACE, GL_REPLACE, GL_KEEP);			// ??
			// blank here

			//glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
			// get stencil
			// TODO need parameter here to verify 
			parameter_stencil = 42;
			parameter_stencil = Stencil(parameter_stencil);		// parameter);
			glFlush();
			// blank here
			// switch keep area
			if (parameter_stencil == 0) {
				printf(
						"\nStencil full circle parameter %i @function %s @line %i",
						parameter_stencil, __FUNCTION__, __LINE__);
				glStencilFunc(GL_EQUAL, 1, 1);
			}	// keep inside circle
			else {
				printf(
						"\nStencil last circle parameter %i @function %s @line %i",
						parameter_stencil, __FUNCTION__, __LINE__);
				glStencilFunc(GL_NOTEQUAL, 1, 1);
			}	// keep all outside of stencil
		


			{
				// apply stencil 
				//int OpenGL_Render_RealAxis(int parameter = 0)
				//OpenGL_Render_RealAxis(); // int parameter = 0)
				OpenGL_Render_Plus_IMG_Axis(); //int parameter = 0)
				//OpenGL_Render_Minus_IMG_Axis(5); //passed temporary last circle as parameter = 0)
			}

from here I am not sure how to display only the rendered fragment 
I get both stencil and fragment ONLY when writing to color buffer is enabled 

			glStencilMask(GL_FALSE);
			glClear(
						GL_STENCIL_BUFFER_BIT );
			//glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
			//glStencilOp(GL_ZERO, GL_ZERO, GL_REPLACE);
			//GL_ZERO
			//Reenable color
			glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
			glClear(
									GL_STENCIL_BUFFER_BIT );
			glFlush();

QuestionCross Reference/Reporting Tool avaiable which does not resolve macros? Pin
Hans99922-Apr-20 0:57
MemberHans99922-Apr-20 0:57 
AnswerRe: Cross Reference/Reporting Tool avaiable which does not resolve macros? Pin
Richard MacCutchan22-Apr-20 3:47
mveRichard MacCutchan22-Apr-20 3:47 
AnswerRe: Cross Reference/Reporting Tool avaiable which does not resolve macros? Pin
k505422-Apr-20 4:07
mvek505422-Apr-20 4:07 
SuggestionRe: Cross Reference/Reporting Tool avaiable which does not resolve macros? Pin
David Crow22-Apr-20 5:18
MemberDavid Crow22-Apr-20 5:18 
GeneralRe: Cross Reference/Reporting Tool avaiable which does not resolve macros? Pin
Richard MacCutchan22-Apr-20 6:25
mveRichard MacCutchan22-Apr-20 6:25 
GeneralRe: Cross Reference/Reporting Tool avaiable which does not resolve macros? Pin
David Crow22-Apr-20 6:43
MemberDavid Crow22-Apr-20 6:43 
GeneralRe: Cross Reference/Reporting Tool avaiable which does not resolve macros? Pin
Richard MacCutchan22-Apr-20 6:51
mveRichard MacCutchan22-Apr-20 6:51 
Question'get_osfhandle': identifier not found Pin
_Flaviu20-Apr-20 0:13
Member_Flaviu20-Apr-20 0:13 
AnswerRe: 'get_osfhandle': identifier not found Pin
Richard MacCutchan20-Apr-20 0:37
mveRichard MacCutchan20-Apr-20 0:37 
GeneralRe: 'get_osfhandle': identifier not found Pin
leon de boer20-Apr-20 2:05
Memberleon de boer20-Apr-20 2:05 
GeneralRe: 'get_osfhandle': identifier not found Pin
Richard MacCutchan20-Apr-20 3:28
mveRichard MacCutchan20-Apr-20 3:28 
QuestionSOLVED Passing function with parameters as parameter Pin
Vaclav_18-Apr-20 8:38
MemberVaclav_18-Apr-20 8:38 
AnswerRe: Passing function with parameters as parameter Pin
Greg Utas18-Apr-20 9:07
professionalGreg Utas18-Apr-20 9:07 
GeneralRe: Passing function with parameters as parameter Pin
Vaclav_18-Apr-20 9:22
MemberVaclav_18-Apr-20 9:22 
AnswerRe: Passing function with parameters as parameter Pin
Greg Utas18-Apr-20 10:24
professionalGreg Utas18-Apr-20 10:24 
GeneralRe: Passing function with parameters as parameter Pin
Vaclav_18-Apr-20 10:52
MemberVaclav_18-Apr-20 10:52 
GeneralRe: Passing function with parameters as parameter Pin
Greg Utas18-Apr-20 11:04
professionalGreg Utas18-Apr-20 11:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.