小编And*_*urg的帖子

Jenkins + Windows + CMake +多种构建类型(调试,发布)

我怎样才能让Jenkins做到以下几点?

Checkout trunk /来自SVN,然后使用CMake构建配置Debug和Release,而不需要配置的重复作业.

windows cmake jenkins

10
推荐指数
3
解决办法
7669
查看次数

TortoiseSVN,如何转储存储库?

我使用Windows 7,并且我也使用TortoiseSVN来跟踪我的代码(当你需要右键单击鼠标时生活很好),现在我想将我的存储库迁移到云服务,并且需要创建一个*.dump文件,但我找不到创建该死的文件的方法,一些论坛说使用"svnadmin"但我也找不到它.

我的问题是如何使用TortoiseSVN创建*.dump文件?

tortoisesvn

9
推荐指数
4
解决办法
2万
查看次数

计算着色器不修改3d纹理

我想将3D纹理的初始化从CPU移动到GPU.作为测试,我写了一个着色器将所有体素设置为常量值,但纹理根本没有修改.我如何使其工作?

计算着色器:

#version 430

layout(local_size_x=1, local_size_y=1, local_size_z=1) in;
layout(r8, location = 0) uniform image3D volume;

void main()
{
  imageStore(volume, ivec3(gl_WorkGroupID), vec4(0));
}
Run Code Online (Sandbox Code Playgroud)

调用:

glEnable(GL_TEXTURE_3D);
glActiveTexture(GL_TEXTURE0);
glGenTextures(1, &volume_tid);
glBindTexture(GL_TEXTURE_3D, volume_tid);
glTexImage3D(GL_TEXTURE_3D, 0, GL_R8, volume_dims[0], volume_dims[1], volume_dims[2], 0, GL_RED, GL_UNSIGNED_BYTE, voxels);

ShaderProgram computeVolumeShader;
computeVolumeShader.loadShader(GL_COMPUTE_SHADER, "compute_volume.glsl");
computeVolumeShader.link();
computeVolumeShader.use();
computeVolumeShader.uniform("volume", 0);
glBindImageTexture(0, volume_tid, 0, GL_FALSE, 0, GL_READ_WRITE, GL_R8);
glDispatchCompute(volume_dims[0], volume_dims[1], volume_dims[2]);
glBindImageTexture(0, 0, 0, GL_FALSE, 0, GL_READ_WRITE, GL_R8);
computeVolumeShader.unUse();
glMemoryBarrier(GL_ALL_BARRIER_BITS);
Run Code Online (Sandbox Code Playgroud)

注意:voxelsfed into glTexImage3D包含CPU初始化数据.

opengl glsl

8
推荐指数
1
解决办法
1957
查看次数

倾斜的平截头体/离轴投影用于OpenGL中的头部跟踪

我正在尝试在我的应用程序中进行离轴投影,并尝试根据用户的头部位置更改场景的视角.通常情况下,鉴于我必须在屏幕上画一个方框,我会在屏幕上画一个方框:

ofBox(350,250,0,50); //ofBox(x, y, z, size); where x, y and z used here are the screen coordinates
Run Code Online (Sandbox Code Playgroud)

要在这里进行离轴投影,我知道我必须更改透视投影,如下所示:

vertFov = 0.5; near = 0.5; aspRatio = 1.33;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(near * (-vertFov * aspRatio + headX),
          near * (vertFov * aspRatio + headX),
          near * (-vertFov + headY),
          near * (vertFov + headY),
          near, far); //frustum changes as per the position of headX and headY
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(headX * headZ, headY * headZ, 0, headX * headZ, headY * headZ, …
Run Code Online (Sandbox Code Playgroud)

c++ opengl 3d openframeworks

7
推荐指数
1
解决办法
4161
查看次数

您自己的类型的结构化绑定,不是结构或元组(通过公共成员函数)

我正在经历Herb Scutter的

旅程:走向更强大,更简单的C++编程

结构绑定部分

为了理解这个概念.Best是编写一个我试过的程序,但是遇到了一些错误

只是想尝试如何在类上使用私有数据的结构绑定.请忽略下面的示例.如果您能提供任何示例

#include<iostream>
#include<string>
using namespace std;

class foobar {
public:
    foobar() { cout << "foobar::foobar()\n"; }
    ~foobar() { cout << "foobar::~foobar()\n"; }

    foobar( const foobar &rhs )
    { cout << "foobar::foobar( const foobar & )\n"; }
    void ival( int nval, string new_string ) { _ival = nval;s=new_string; }

private:
    int _ival;
    string s;
};

foobar f( int val,string new_string ) {
    foobar local;
    local.ival( val,new_string );
    return local;
}

template<> struct tuple_element<0,foobar> { using …
Run Code Online (Sandbox Code Playgroud)

c++ stdtuple c++17 structured-bindings if-constexpr

7
推荐指数
2
解决办法
1553
查看次数

如何使用boost :: format生成十六进制输出?

考虑以下 :

#include <vector>
#include <string>
#include <iostream>

#include <boost/format.hpp>
#include <boost/assign.hpp>
#include <boost/assign/list_of.hpp>
#include <boost/assign/std/vector.hpp>

using namespace std;

typedef unsigned char byte;
typedef vector<byte> byte_array;

const byte_array bytes = list_of(0x05)(0x04)(0xAA)(0x0F)(0x0D);

int main()
{
    const string formatter = "%1%-%2%-%3%-%4%-%5%";
    const string result = (format(formatter)
                           % bytes[0]
                           % bytes[1]
                           % bytes[2]
                           % bytes[3]
                           % bytes[4]
                                    ).str();
    cout << result << endl;
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

我希望看到结果打印为:"05-04-AA-0F-0D".我需要做什么才能实现格式化程序字符串?

c++ boost

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

C++:在OpenGL中绘制2D磁盘

我已经尝试用OpenGL编写一个适当的功能,用于在屏幕上绘制2D磁盘几天了,我似乎无法正确使用它:(

这是我目前的代码:

void Disk( Float x, Float y, Float r, const Color& vColor )
{
    glBegin( GL_TRIANGLE_FAN );
        glVertex2f( x, y );
        for( Float i = 0; i <= 2 * PI + 0.1; i += 0.1 )
        {
            glVertex2f( x + sin( i ) * r, y + cos( i ) * r );
        }
    glEnd();
}
Run Code Online (Sandbox Code Playgroud)

放大时,生成的磁盘显示尖峰,而不是边缘,但指示出尖峰.

此函数也不会仅绘制一个磁盘,但总是多于一个 - 这意味着如果启用了alpha,则结果看起来不对.

  • 我需要更改我的功能,以便正确绘制磁盘?

c++ opengl

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

如何使用 Escape 隐藏 Sublime 内联错误(幻影)

所以问题是将它分配给 Escape 而不覆盖任何其他功能。我尝试了以下方法,但不起作用。

{
  "keys": ["escape"],
  "command": "exec",
  "args": {"hide_phantoms_only" : true },
  "context": [ { "key": "phantom_visible", "operator": "equal", "operand": true }],
},
Run Code Online (Sandbox Code Playgroud)

我还没有找到任何关于存在哪些上下文键的文档,所以phantom_visible只是猜测。

sublimetext3

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

如何实现两次通过之间的深度值不变性?

我有两个几何通道.在第一遍中,我将片段的深度值写入浮点纹理glBlendEquation(GL_MIN),类似于双深度剥离.在第二遍中,我使用它在片段着色器中进行早期深度测试.

但是,对于某些片段,深度测试会失败,除非我略微偏移最小深度值(eps下面):

在此输入图像描述

设置纹理:

glBindTexture(GL_TEXTURE_2D, offscreenDepthMapTextureId);
glTexStorage2D(GL_TEXTURE_2D, 1, GL_RG32F, screenWidth, screenHeight);

glBindFramebuffer(GL_DRAW_FRAMEBUFFER, offscreenDepthMapFboId);
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
  offscreenDepthMapTextureId, 0);
Run Code Online (Sandbox Code Playgroud)

请注意,纹理用作颜色附件,而不是深度附件.我GL_DEPTH_TEST在两次传球都禁用了,因为我不能在最后一次传球中使用它.

顶点着色器,用于两个过程:

#version 430

layout(location = 0) in vec4 position;

uniform mat4 mvp;
invariant gl_Position;

void main()
{
  gl_Position = mvp * position;
}
Run Code Online (Sandbox Code Playgroud)

第一次传递片段着色器,带有offscreenDepthMapFboId边界,因此它将深度作为颜色写入纹理.混合确保只有最小值最终在红色组件中.

#version 430

out vec4 outputColor;

void main()
{
  outputColor.rg = vec2(gl_FragCoord.z, -gl_FragCoord.z);
}
Run Code Online (Sandbox Code Playgroud)

第二遍,写入默认的帧缓冲区.纹理用作depthTex.

#version 430

out vec4 outputColor;

uniform sampler2D depthTex;

void main()
{
  vec2 zwMinMax = …
Run Code Online (Sandbox Code Playgroud)

opengl glsl

5
推荐指数
1
解决办法
502
查看次数

如何在 CMake 的不同目录中使用文件 glob

file(GLOB ...)并且file(GLOB_RECURSE ...)似乎只适用于当前的源目录。有什么办法可以全局访问不同的目录吗?

cmake

5
推荐指数
1
解决办法
6296
查看次数