Stencil and TOpenGLControl lazarus / 70-OpenGL ---------------------------------------------------------------------- Mathias · 2023-10-19 11:31 I want to get Stencil to work with OpenGLControl. With SDL2 this works as follows.      Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   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  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i    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 · 2023-12-10 19:57 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  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i 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 · 2024-03-04 18:16 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i OpenGLControl1 . SchabloneBits : = 8 Thanks, that was exactly the problem.