小编ddl*_*ddl的帖子

OpenGL - ARB和非ARB功能之间的差异

我知道ARB意味着函数是OpenGL核心的扩展,但是如果GLEW让我能够使用例如:

glCompileShaderARB()
Run Code Online (Sandbox Code Playgroud)

glCompileShader()
Run Code Online (Sandbox Code Playgroud)

他们之间有什么区别?

opengl

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

编译器是否调整int大小?

我想知道在这种情况下,compiller会将int变量大小调整到最大可能值吗?或者它会使用整个32位int?

pseudocode:

int func()
{
    if (statement)
        return 10;
    else if (statement2)
        return 50;
    else
        return 100;
}

// how much memory will be alocated as it needs only 1 byte?
Run Code Online (Sandbox Code Playgroud)

c++ int types

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

SortedSet <>.包含()如何实现自己的比较?

我想检查具有给定值的Object是否存在,SortedSet<>但我不明白自定义比较在这里是如何工作的.在List<>.Exists()我可以只使用lambda,但我不能那样做,我没有得到整个界面的东西,而msdn说我需要覆盖int返回功能.

public class Node
{
    public int X, Y;
    public int rand;

    public Node(int x, int y, int r)
    { X = x; Y = y; rand = r; }
}

class Program
{
    static void Main(string[] args)
    {
        SortedSet<Node> mySet = new SortedSet<Node>();
        mySet.Add(new Node(1, 2, 90));
        Node myNode = new Node(1, 2, 50);
        // I want this to check if X and Y are the same
        if (mySet.Contains(myNode, interfaceThing))
            Console.WriteLine("Sth is already …
Run Code Online (Sandbox Code Playgroud)

c# sortedset

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

GLSL语法错误:"in"解析错误

我正在尝试在我的程序中使用着色器,但我得到了非常奇怪的错误...

Vertex shader failed to compile with the following error
ERROR: 0:6: error(#132) Syntax error: "in" parse error
ERROR: error(#273) 1 compilation errors.  No code generated
Run Code Online (Sandbox Code Playgroud)

我认为问题在于文件读取,但在尝试了很多方法后,它仍然无法正常工作.

所以这是我的代码:

bool ShaderProgram::LoadShaderFile(const char* shader_path, GLuint& shader_id)
{
    ifstream oFileStream(shader_path);
    if(oFileStream)
    {
        // Load shader code
        string sShaderSource;
        sShaderSource.assign((istreambuf_iterator<char> (oFileStream) ), istreambuf_iterator<char> () );

        // Forward shader code to OGL
        const GLchar* chShaderSource = sShaderSource.c_str() + '\0';
        printf("%s", chShaderSource);
        glShaderSource(shader_id, 1, (const GLchar**) &chShaderSource, NULL);


        return true;
    }
    else
        return false;

}
Run Code Online (Sandbox Code Playgroud)

我的着色器: …

c++ opengl shader glsl parse-error

0
推荐指数
1
解决办法
2894
查看次数

标签 统计

c++ ×2

opengl ×2

c# ×1

glsl ×1

int ×1

parse-error ×1

shader ×1

sortedset ×1

types ×1