Posts

Showing posts from January 12, 2019

Translate and scale a rectangle with OpenGL 3+

Image
0 I want to translate and scale a rectangle to specific coordinates. At this time I have to scale the rectangle only in the y plane. The translation works well, I have problems with the scaling, the rectangle is not placed at the right position. I tried to apply another solutions I found here and in another posts in stack overflow without success. This should be very easy, but I can't find the solution. I become from my source the top, bottom, left and right coordinates. This is a part of the code. Vertex and Fragment Shader: vertexShaderSource = "#version 150 n" "in vec2 aPos;n" "in vec4 aColor;n" "uniform mat4 projection;n" "uniform mat4 model;n" "uniform bool isLine;n" "out vec4 oColor;n" "void main() {n" " gl_

python - html - how to modify code by converting text outside of a tag into a tag

Image
2 How to replace/convert/correct a string representing tag into a tag? I have below example where I need to clean some parts of the code and need to convert strings like &lt;/div&gt; into the proper tags html = """ <html> <body> <div> &lt;/div&gt; <----- how to convert the line into </div> <div class="first_class"> <h1 id="Header_1"> Header_1 </h1> </div> </body> </html> """ I tried soup = BeautifulSoup(html,"lxml") tag = soup.find(text="&lt;") tag.replace_with("<") print(soup.prettify()) but this logic doesn't work, the find function doesn't pick u