小编Exi*_*ide的帖子

两个三角形纹理正方形的正确方法?

我使用的是OpenGL 4.1和GLSL 410.我试图使用以下坐标对我制作的正方形进行纹理处理:

float points[] = {
    -0.5,  0.5,
    -0.5, -0.5,
     0.5, -0.5,
    -0.5,  0.5,
     0.5, -0.5,
     0.5,  0.5
};
Run Code Online (Sandbox Code Playgroud)

我像这样画广场:

glDrawArrays (GL_TRIANGLES, 0, 6);
Run Code Online (Sandbox Code Playgroud)

在我读过的所有教程中,作者使用元素缓冲区绘制正方形或只有四个顶点.这意味着我读过的所有教程都有与每个顶点对齐的纹理坐标.对我来说,我使用6个顶点,所以我不确定如何排列纹理坐标.

这样的坐标会适用于我的情况:

float texcoords[] = {
    0.0, 1.0,
    0.0, 0.0,
    1.0, 0.0,
    0.0, 1.0,
    1.0, 0.0,
    1.0, 1.0
};
Run Code Online (Sandbox Code Playgroud)

我已经做了很多阅读,但没有遇到任何像我一样使用六个顶点的人.

我的纹理坐标是否有效,如果没有,那么提出纹理坐标的最佳方法是什么.

opengl textures texture-mapping

6
推荐指数
1
解决办法
3875
查看次数

如何在 Azure Pipeline Bash 任务中验证 git push 到 GitHub

在我们的一个 Azure Pipelines 中,我试图将标签推送到 GitHub,但根据我的方法收到两个错误之一。

无需身份验证,只是一个简单的 git push

- bash: 'git push origin $(tag)'
Run Code Online (Sandbox Code Playgroud)
git push origin 2019.07.01.1
fatal: could not read Username for 'https://github.com': terminal prompts disabled
Run Code Online (Sandbox Code Playgroud)

AUTHORIZATION: Bearer ***作为额外的标题传递

- bash: 'git -c http.extraheader="AUTHORIZATION: Bearer $(System.AccessToken)" push origin $(tag)'
Run Code Online (Sandbox Code Playgroud)
git -c http.extraheader="AUTHORIZATION: Bearer ***" push origin 2019.07.01.2
fatal: unable to access 'https://github.com/respondentinc/website/': The requested URL returned error: 400
Run Code Online (Sandbox Code Playgroud)

AUTHORIZATION: Bearer ***使用环境变量作为额外的标头传递

来自:https : //github.com/microsoft/azure-pipelines-agent/issues/1582#issuecomment-392235276

- bash: 'git -c http.extraheader="AUTHORIZATION: Bearer $env:token" push origin $(tag)'
  env: …
Run Code Online (Sandbox Code Playgroud)

git azure-pipelines

6
推荐指数
1
解决办法
2703
查看次数

如何在没有表单的情况下通过ajax传递struts2令牌?

我正在尝试使用tokenStruts附带的拦截器来实现CSRF检查.但是,而不是使用<form />我从一些JS内部进行AJAX调用:

foo.jsp:

<!DOCTYPE html>
<%@ taglib uri="/struts-tags" prefix="s" %>
<html>
<body>
    <s:token />
    <script>
        var strutsToken = "<s:property value="#session['struts.tokens.token']" />";
    </script>
    <script src="bar.js"></script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

bar.js:

$.ajax({
    url: '/endpoint',
    data: strutsToken,
    dataType: 'jsonp',
    cache: true,
    success: function() { console.log('success'); },
    error: function() { console.log('failure'); }
});
Run Code Online (Sandbox Code Playgroud)

我已经确认令牌值正在变成JS变量:

> strutsToken
"N3ZLLLR2Y3QGMZP0L3UCYWI5CO5NYZEY"
Run Code Online (Sandbox Code Playgroud)

不幸的是,当发出AJAX请求时,invalid-token服务器上会抛出错误.

我试图做的是什么,如果是的话,怎么样?

ajax struts2 token interceptor

3
推荐指数
1
解决办法
3045
查看次数