Forum > OpenGL
Stencil and TOpenGLControl
(1/1)
Mathias:
I want to get Stencil to work with OpenGLControl.
With SDL2 this works as follows.
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3); SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 1);
Now I wanted to try it with OpenGLControl and did the following.
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- OpenGLControl1.OpenGLMinorVersion := 3; OpenGLControl1.OpenGLMajorVersion := 3; OpenGLControl1.StencilBits := 1;Only then will unfortunately nothing be drawn at all.
If I don't do any of this at all, then Stencil is simply ignored, so it must be related to context creation.
Anyone have an idea how to do it with OpenGLControl?
Lulu:
Hi Mathias, I just read your post.
I use stencil buffer with OpenGLControl (to clip child surface when drawing them on their parent)
with:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---OpenGLControl1.StencilBits := 8; // I need 8 bits on stencil...glClear(GL_COLOR_BUFFER_BIT or GL_STENCIL_BUFFER_BIT); // clear the buffer color and stencilglEnable(GL_STENCIL_TEST);some drawing...
No problem here (windows10) with OpenGLControl.
Mathias:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---OpenGLControl1 . SchabloneBits : = 8 Thanks, that was exactly the problem.
Navigation
[0] Message Index