为什么仅当我在 SDL2 中设置非零 Alpha 大小时才获得 sRGB 帧缓冲区?

2024-03-31

我正在尝试通过以下方式以伽玛正确的方式渲染典型的 OpenGL 颜色三角形本指南 https://learnopengl.com/#!Advanced-Lighting/Gamma-Correction并查阅 SDL2 文档,了解如何在默认帧缓冲区上启用 SRGB 支持。

这是我编写的绘制三角形的代码:

#include <SDL.h>

// Header file generated with glLoadGen
#include "gl_core_3_3.h"

#include <cstdlib>

void sdl_loop(SDL_Window* window);

static const char* const vertexSource = R"(
#version 330

in vec2 position;
in vec3 color;

out vec3 vs_color;

void main()
{
    gl_Position = vec4(position, 0.0, 1.0);
    vs_color = color;
}
)";

static const char* const fragmentSource = R"(
#version 330

in vec3 vs_color;
out vec4 fragColor;

void main()
{
    fragColor = vec4(vs_color, 1.0);
}
)";

static const float vertices[] = {
    // X    Y     R     G     B
    -0.9f, -0.9f, 1.0f, 0.0f, 0.0f,
    0.9f, -0.9f, 0.0f, 1.0f, 0.0f,
    0.0f,  0.9f, 0.0f, 0.0f, 1.0f,
};

static const unsigned short indices[] = { 0, 1, 2 };

void sdl_loop(SDL_Window* window)
{
    glClearColor(0.0f, 0.1f, 0.2f, 1.0f);

    glEnable(GL_FRAMEBUFFER_SRGB);

    auto program = glCreateProgram();
    auto vertexShader = glCreateShader(GL_VERTEX_SHADER);
    auto fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);

    glShaderSource(vertexShader, 1, &vertexSource, nullptr);
    glShaderSource(fragmentShader, 1, &fragmentSource, nullptr);

    glCompileShader(vertexShader);
    glCompileShader(fragmentShader);

    glAttachShader(program, vertexShader);
    glAttachShader(program, fragmentShader);

    glBindFragDataLocation(program, 0, "fragColor");

    glLinkProgram(program);

    glDetachShader(program, vertexShader);
    glDetachShader(program, fragmentShader);

    glDeleteShader(vertexShader);
    glDeleteShader(fragmentShader);

    auto positionAttr = glGetAttribLocation(program, "position");
    auto colorAttr = glGetAttribLocation(program, "color");

    unsigned vao;
    glGenVertexArrays(1, &vao);
    glBindVertexArray(vao);

    unsigned vertexBuffer;
    glGenBuffers(1, &vertexBuffer);
    glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer);
    glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);

    unsigned indexBuffer;
    glGenBuffers(1, &indexBuffer);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);

    size_t stride = 5 * sizeof(float);
    size_t offset = 0;
    glEnableVertexAttribArray(positionAttr);
    glVertexAttribPointer(positionAttr, 2, GL_FLOAT, false, stride, (void*) offset);
    offset += 2 * sizeof(float);

    glEnableVertexAttribArray(colorAttr);
    glVertexAttribPointer(colorAttr, 3, GL_FLOAT, false, stride, (void*) offset);
    offset += 3 * sizeof(float);

    glUseProgram(program);

    SDL_Event evt;
    for (;;) {
        while (SDL_PollEvent(&evt)) {
            if (evt.type == SDL_QUIT) {
                goto out;
            }
        }

        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);

        glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_SHORT, nullptr);

        SDL_GL_SwapWindow(window);
    }

out:
    glDeleteProgram(program);
    glDeleteBuffers(1, &vertexBuffer);
    glDeleteBuffers(1, &indexBuffer);
    glDeleteVertexArrays(1, &vao);
}

int main()
{
    if (SDL_Init(SDL_INIT_EVERYTHING) < 0) {
        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
                     "Couldn't initialize SDL: %s", SDL_GetError());
        SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
                                 "Couldn't initialize SDL", SDL_GetError(), nullptr);
        return EXIT_FAILURE;
    }

    SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
    SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);

    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);

    SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
    SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 8);

    SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
    SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
    SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
    // Commenting this line out doesn't give you an sRGB framebuffer on Intel GPUs
    SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);

    SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
    SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);

    SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
    SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG);
    SDL_GL_SetAttribute(SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, 1);

    auto* window = SDL_CreateWindow("Hello OpenGL 3!",
                                    SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
                                    800, 600,
                                    SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL);

    if (window == nullptr) {
        SDL_LogError(
            SDL_LOG_CATEGORY_APPLICATION,
            "Couldn't initialize SDL window: %s", SDL_GetError());
        SDL_ShowSimpleMessageBox(
            SDL_MESSAGEBOX_ERROR,
            "Couldn't create SDL window", SDL_GetError(), nullptr);
        return EXIT_FAILURE;
    }

    auto context = SDL_GL_CreateContext(window);
    SDL_GL_MakeCurrent(window, context);
    SDL_GL_SetSwapInterval(1);

    ogl_LoadFunctions();

    sdl_loop(window);

    SDL_GL_DeleteContext(context);
    SDL_DestroyWindow(window);

    SDL_Quit();

    return EXIT_SUCCESS;
}

我在 Ubuntu 16.04(带有 HWE 驱动程序)上运行,我使用的机器既有 Intel HD 4000 GPU 又有带有 Optimus 的专用 nvidia GPU。理论上,我应该得到一个 sRGB 帧缓冲区。但是,只有在 nvidia GPU 下运行或使用 ApiTrace 时,我才会获得 sRGB 帧缓冲区。如果我在 Intel GPU 下运行,如果我使用 SDL2 指定非零 alpha 大小,我只会获得 sRGB 帧缓冲区。如果我为 Alpha 指定零大小(或者根本不指定大小),我将得到一个线性帧缓冲区。

This is how my example looks when running under the nvidia GPU (and the Intel GPU with a non-zero alpha bit size): nvidia GPU and Intel GPU with non-zero alpha bit size

This is how it looks when running under the Intel GPU with a zero alpha bit size (sRGB incorrect): Intel GPU with zero alpha bit size

And this is what I get with ApiTrace: ApiTrace

我也跑了glxinfo -t据我所知,即使设置了零 alpha 位,我也应该获得 sRGB 支持(EDIT: 事实并非如此。的输出glxinfo应该显示ses 在 sRGB 列中,但由于某种原因不会发生):

40 GLX Visuals
Vis   Vis   Visual Trans  buff lev render DB ste  r   g   b   a      s  aux dep ste  accum buffer   MS   MS         
 ID  Depth   Type  parent size el   type     reo sz  sz  sz  sz flt rgb buf th  ncl  r   g   b   a  num bufs caveats
--------------------------------------------------------------------------------------------------------------------
0x 21 24 TrueColor    0     32  0  rgba   1   0   8   8   8   8  .   .   0   24  8   0   0   0   0   0   0   None
0x 22 24 DirectColor  0     32  0  rgba   1   0   8   8   8   8  .   .   0   24  8   0   0   0   0   0   0   None
0x b7 24 TrueColor    0     32  0  rgba   1   0   8   8   8   8  .   .   0    0  0   0   0   0   0   0   0   None
0x b8 24 TrueColor    0     32  0  rgba   0   0   8   8   8   8  .   .   0    0  0   0   0   0   0   0   0   None
0x b9 24 TrueColor    0     32  0  rgba   0   0   8   8   8   8  .   .   0   24  8   0   0   0   0   0   0   None
0x ba 24 TrueColor    0     24  0  rgba   1   0   8   8   8   0  .   .   0    0  0   0   0   0   0   0   0   None
0x bb 24 TrueColor    0     24  0  rgba   0   0   8   8   8   0  .   .   0    0  0   0   0   0   0   0   0   None
0x bc 24 TrueColor    0     24  0  rgba   1   0   8   8   8   0  .   .   0   24  8   0   0   0   0   0   0   None
0x bd 24 TrueColor    0     24  0  rgba   0   0   8   8   8   0  .   .   0   24  8   0   0   0   0   0   0   None
0x be 24 TrueColor    0     32  0  rgba   1   0   8   8   8   8  .   .   0   24  8  16  16  16  16   0   0   Slow
0x bf 24 TrueColor    0     24  0  rgba   1   0   8   8   8   0  .   .   0   24  8   0   0   0   0   0   0   None
0x c0 24 TrueColor    0     24  0  rgba   1   0   8   8   8   0  .   .   0   24  8  16  16  16   0   0   0   Slow
0x c1 24 TrueColor    0     32  0  rgba   1   0   8   8   8   8  .   .   0    0  0   0   0   0   0   4   1   None
0x c2 24 TrueColor    0     32  0  rgba   1   0   8   8   8   8  .   .   0    0  0   0   0   0   0   8   1   None
0x c3 24 TrueColor    0     32  0  rgba   1   0   8   8   8   8  .   .   0   24  8   0   0   0   0   4   1   None
0x c4 24 TrueColor    0     32  0  rgba   1   0   8   8   8   8  .   .   0   24  8   0   0   0   0   8   1   None
0x c5 24 TrueColor    0     24  0  rgba   1   0   8   8   8   0  .   .   0    0  0   0   0   0   0   4   1   None
0x c6 24 TrueColor    0     24  0  rgba   1   0   8   8   8   0  .   .   0    0  0   0   0   0   0   8   1   None
0x c7 24 TrueColor    0     24  0  rgba   1   0   8   8   8   0  .   .   0   24  8   0   0   0   0   4   1   None
0x c8 24 TrueColor    0     24  0  rgba   1   0   8   8   8   0  .   .   0   24  8   0   0   0   0   8   1   None
0x c9 24 DirectColor  0     32  0  rgba   1   0   8   8   8   8  .   .   0    0  0   0   0   0   0   0   0   None
0x ca 24 DirectColor  0     32  0  rgba   0   0   8   8   8   8  .   .   0    0  0   0   0   0   0   0   0   None
0x cb 24 DirectColor  0     32  0  rgba   0   0   8   8   8   8  .   .   0   24  8   0   0   0   0   0   0   None
0x cc 24 DirectColor  0     24  0  rgba   1   0   8   8   8   0  .   .   0    0  0   0   0   0   0   0   0   None
0x cd 24 DirectColor  0     24  0  rgba   0   0   8   8   8   0  .   .   0    0  0   0   0   0   0   0   0   None
0x ce 24 DirectColor  0     24  0  rgba   1   0   8   8   8   0  .   .   0   24  8   0   0   0   0   0   0   None
0x cf 24 DirectColor  0     24  0  rgba   0   0   8   8   8   0  .   .   0   24  8   0   0   0   0   0   0   None
0x d0 24 DirectColor  0     32  0  rgba   1   0   8   8   8   8  .   .   0   24  8   0   0   0   0   0   0   None
0x d1 24 DirectColor  0     32  0  rgba   1   0   8   8   8   8  .   .   0   24  8  16  16  16  16   0   0   Slow
0x d2 24 DirectColor  0     24  0  rgba   1   0   8   8   8   0  .   .   0   24  8   0   0   0   0   0   0   None
0x d3 24 DirectColor  0     24  0  rgba   1   0   8   8   8   0  .   .   0   24  8  16  16  16   0   0   0   Slow
0x d4 24 DirectColor  0     32  0  rgba   1   0   8   8   8   8  .   .   0    0  0   0   0   0   0   4   1   None
0x d5 24 DirectColor  0     32  0  rgba   1   0   8   8   8   8  .   .   0    0  0   0   0   0   0   8   1   None
0x d6 24 DirectColor  0     32  0  rgba   1   0   8   8   8   8  .   .   0   24  8   0   0   0   0   4   1   None
0x d7 24 DirectColor  0     32  0  rgba   1   0   8   8   8   8  .   .   0   24  8   0   0   0   0   8   1   None
0x d8 24 DirectColor  0     24  0  rgba   1   0   8   8   8   0  .   .   0    0  0   0   0   0   0   4   1   None
0x d9 24 DirectColor  0     24  0  rgba   1   0   8   8   8   0  .   .   0    0  0   0   0   0   0   8   1   None
0x da 24 DirectColor  0     24  0  rgba   1   0   8   8   8   0  .   .   0   24  8   0   0   0   0   4   1   None
0x db 24 DirectColor  0     24  0  rgba   1   0   8   8   8   0  .   .   0   24  8   0   0   0   0   8   1   None
0x 76 32 TrueColor    0     32  0  rgba   1   0   8   8   8   8  .   .   0   24  8   0   0   0   0   0   0   None

64 GLXFBConfigs:
Vis   Vis   Visual Trans  buff lev render DB ste  r   g   b   a      s  aux dep ste  accum buffer   MS   MS         
 ID  Depth   Type  parent size el   type     reo sz  sz  sz  sz flt rgb buf th  ncl  r   g   b   a  num bufs caveats
--------------------------------------------------------------------------------------------------------------------
0x 77  0 TrueColor    0     16  0  rgba   1   0   5   6   5   0  .   .   0    0  0   0   0   0   0   0   0   None
0x 78  0 TrueColor    0     16  0  rgba   0   0   5   6   5   0  .   .   0    0  0   0   0   0   0   0   0   None
0x 79  0 TrueColor    0     16  0  rgba   1   0   5   6   5   0  .   .   0   16  0   0   0   0   0   0   0   None
0x 7a  0 TrueColor    0     16  0  rgba   0   0   5   6   5   0  .   .   0   16  0   0   0   0   0   0   0   None
0x 7b  0 TrueColor    0     16  0  rgba   1   0   5   6   5   0  .   .   0   24  8   0   0   0   0   0   0   None
0x 7c  0 TrueColor    0     16  0  rgba   0   0   5   6   5   0  .   .   0   24  8   0   0   0   0   0   0   None
0x 7d 24 TrueColor    0     32  0  rgba   1   0   8   8   8   8  .   .   0    0  0   0   0   0   0   0   0   None
0x 7e 24 TrueColor    0     32  0  rgba   0   0   8   8   8   8  .   .   0    0  0   0   0   0   0   0   0   None
0x 7f 24 TrueColor    0     32  0  rgba   1   0   8   8   8   8  .   .   0   24  8   0   0   0   0   0   0   None
0x 80 24 TrueColor    0     32  0  rgba   0   0   8   8   8   8  .   .   0   24  8   0   0   0   0   0   0   None
0x 81 24 TrueColor    0     24  0  rgba   1   0   8   8   8   0  .   .   0    0  0   0   0   0   0   0   0   None
0x 82 24 TrueColor    0     24  0  rgba   0   0   8   8   8   0  .   .   0    0  0   0   0   0   0   0   0   None
0x 83 24 TrueColor    0     24  0  rgba   1   0   8   8   8   0  .   .   0   24  8   0   0   0   0   0   0   None
0x 84 24 TrueColor    0     24  0  rgba   0   0   8   8   8   0  .   .   0   24  8   0   0   0   0   0   0   None
0x 85  0 TrueColor    0     16  0  rgba   1   0   5   6   5   0  .   .   0   16  0   0   0   0   0   0   0   None
0x 86  0 TrueColor    0     16  0  rgba   1   0   5   6   5   0  .   .   0   16  0  16  16  16   0   0   0   Slow
0x 87 32 TrueColor    0     32  0  rgba   1   0   8   8   8   8  .   .   0   24  8   0   0   0   0   0   0   None
0x 88 24 TrueColor    0     32  0  rgba   1   0   8   8   8   8  .   .   0   24  8  16  16  16  16   0   0   Slow
0x 89 24 TrueColor    0     24  0  rgba   1   0   8   8   8   0  .   .   0   24  8   0   0   0   0   0   0   None
0x 8a 24 TrueColor    0     24  0  rgba   1   0   8   8   8   0  .   .   0   24  8  16  16  16   0   0   0   Slow
0x 8b  0 TrueColor    0     16  0  rgba   1   0   5   6   5   0  .   .   0    0  0   0   0   0   0   4   1   None
0x 8c  0 TrueColor    0     16  0  rgba   1   0   5   6   5   0  .   .   0    0  0   0   0   0   0   8   1   None
0x 8d  0 TrueColor    0     16  0  rgba   1   0   5   6   5   0  .   .   0   16  0   0   0   0   0   4   1   None
0x 8e  0 TrueColor    0     16  0  rgba   1   0   5   6   5   0  .   .   0   16  0   0   0   0   0   8   1   None
0x 8f 24 TrueColor    0     32  0  rgba   1   0   8   8   8   8  .   .   0    0  0   0   0   0   0   4   1   None
0x 90 24 TrueColor    0     32  0  rgba   1   0   8   8   8   8  .   .   0    0  0   0   0   0   0   8   1   None
0x 91 24 TrueColor    0     32  0  rgba   1   0   8   8   8   8  .   .   0   24  8   0   0   0   0   4   1   None
0x 92 24 TrueColor    0     32  0  rgba   1   0   8   8   8   8  .   .   0   24  8   0   0   0   0   8   1   None
0x 93 24 TrueColor    0     24  0  rgba   1   0   8   8   8   0  .   .   0    0  0   0   0   0   0   4   1   None
0x 94 24 TrueColor    0     24  0  rgba   1   0   8   8   8   0  .   .   0    0  0   0   0   0   0   8   1   None
0x 95 24 TrueColor    0     24  0  rgba   1   0   8   8   8   0  .   .   0   24  8   0   0   0   0   4   1   None
0x 96 24 TrueColor    0     24  0  rgba   1   0   8   8   8   0  .   .   0   24  8   0   0   0   0   8   1   None
0x 97  0 DirectColor  0     16  0  rgba   1   0   5   6   5   0  .   .   0    0  0   0   0   0   0   0   0   None
0x 98  0 DirectColor  0     16  0  rgba   0   0   5   6   5   0  .   .   0    0  0   0   0   0   0   0   0   None
0x 99  0 DirectColor  0     16  0  rgba   1   0   5   6   5   0  .   .   0   16  0   0   0   0   0   0   0   None
0x 9a  0 DirectColor  0     16  0  rgba   0   0   5   6   5   0  .   .   0   16  0   0   0   0   0   0   0   None
0x 9b  0 DirectColor  0     16  0  rgba   1   0   5   6   5   0  .   .   0   24  8   0   0   0   0   0   0   None
0x 9c  0 DirectColor  0     16  0  rgba   0   0   5   6   5   0  .   .   0   24  8   0   0   0   0   0   0   None
0x 9d 24 DirectColor  0     32  0  rgba   1   0   8   8   8   8  .   .   0    0  0   0   0   0   0   0   0   None
0x 9e 24 DirectColor  0     32  0  rgba   0   0   8   8   8   8  .   .   0    0  0   0   0   0   0   0   0   None
0x 9f 24 DirectColor  0     32  0  rgba   1   0   8   8   8   8  .   .   0   24  8   0   0   0   0   0   0   None
0x a0 24 DirectColor  0     32  0  rgba   0   0   8   8   8   8  .   .   0   24  8   0   0   0   0   0   0   None
0x a1 24 DirectColor  0     24  0  rgba   1   0   8   8   8   0  .   .   0    0  0   0   0   0   0   0   0   None
0x a2 24 DirectColor  0     24  0  rgba   0   0   8   8   8   0  .   .   0    0  0   0   0   0   0   0   0   None
0x a3 24 DirectColor  0     24  0  rgba   1   0   8   8   8   0  .   .   0   24  8   0   0   0   0   0   0   None
0x a4 24 DirectColor  0     24  0  rgba   0   0   8   8   8   0  .   .   0   24  8   0   0   0   0   0   0   None
0x a5  0 DirectColor  0     16  0  rgba   1   0   5   6   5   0  .   .   0   16  0   0   0   0   0   0   0   None
0x a6  0 DirectColor  0     16  0  rgba   1   0   5   6   5   0  .   .   0   16  0  16  16  16   0   0   0   Slow
0x a7 24 DirectColor  0     32  0  rgba   1   0   8   8   8   8  .   .   0   24  8   0   0   0   0   0   0   None
0x a8 24 DirectColor  0     32  0  rgba   1   0   8   8   8   8  .   .   0   24  8  16  16  16  16   0   0   Slow
0x a9 24 DirectColor  0     24  0  rgba   1   0   8   8   8   0  .   .   0   24  8   0   0   0   0   0   0   None
0x aa 24 DirectColor  0     24  0  rgba   1   0   8   8   8   0  .   .   0   24  8  16  16  16   0   0   0   Slow
0x ab  0 DirectColor  0     16  0  rgba   1   0   5   6   5   0  .   .   0    0  0   0   0   0   0   4   1   None
0x ac  0 DirectColor  0     16  0  rgba   1   0   5   6   5   0  .   .   0    0  0   0   0   0   0   8   1   None
0x ad  0 DirectColor  0     16  0  rgba   1   0   5   6   5   0  .   .   0   16  0   0   0   0   0   4   1   None
0x ae  0 DirectColor  0     16  0  rgba   1   0   5   6   5   0  .   .   0   16  0   0   0   0   0   8   1   None
0x af 24 DirectColor  0     32  0  rgba   1   0   8   8   8   8  .   .   0    0  0   0   0   0   0   4   1   None
0x b0 24 DirectColor  0     32  0  rgba   1   0   8   8   8   8  .   .   0    0  0   0   0   0   0   8   1   None
0x b1 24 DirectColor  0     32  0  rgba   1   0   8   8   8   8  .   .   0   24  8   0   0   0   0   4   1   None
0x b2 24 DirectColor  0     32  0  rgba   1   0   8   8   8   8  .   .   0   24  8   0   0   0   0   8   1   None
0x b3 24 DirectColor  0     24  0  rgba   1   0   8   8   8   0  .   .   0    0  0   0   0   0   0   4   1   None
0x b4 24 DirectColor  0     24  0  rgba   1   0   8   8   8   0  .   .   0    0  0   0   0   0   0   8   1   None
0x b5 24 DirectColor  0     24  0  rgba   1   0   8   8   8   0  .   .   0   24  8   0   0   0   0   4   1   None
0x b6 24 DirectColor  0     24  0  rgba   1   0   8   8   8   0  .   .   0   24  8   0   0   0   0   8   1   None

在这种情况下,为什么我没有获得 sRGB 帧缓冲区?我是否可能遇到了英特尔驱动程序错误?


显然罪魁祸首是this bug https://bugs.freedesktop.org/show_bug.cgi?id=92759在 Intel Mesa 驱动程序中(感谢 SO 用户 genpfault 在 freedesktop bugzilla 中找到它)。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

为什么仅当我在 SDL2 中设置非零 Alpha 大小时才获得 sRGB 帧缓冲区? 的相关文章

随机推荐

  • 使用希伯来数字自定义
      编号

    我想要一个使用希伯来字母数字的编号列表 就像希伯来语书籍中常见的那样 拉丁语表示法使用数字 0 9 而希伯来语则按字母顺序编号 但有时值会发生变化 我不知道这在 CSS 中是否可行 但也许在 JavaScript 中可行 我基本上想要这样的
  • Selenium webdriver 无法点击页面外的链接

    我在使用 Selenium WebDriver 时遇到问题 我尝试单击窗口页面外部的链接 您需要向上滚动才能看到它 我当前的代码相当标准 menuItem driver findElement By id MTP menuItem clic
  • 无法更改 iTunes Connect 中的主要语言

    我已向 App Store 提交了我的第一个应用程序 不幸的是 我注意到主要语言设置为德语而不是英语 我尝试更改主要语言 但出现错误 为了将此应用程序的主要语言更改为英语 美国 每个版本必须已经具有所需的英语 美国 屏幕截图 但我已经上传了
  • 如何在另一个应用程序中使用一个 gwt 应用程序的源代码

    我有两个不同的 gwt 项目 并且想要在另一个模块中使用一个 gwt 应用程序的类 有什么办法可以做到这一点吗 我遵循以下方法 在第二个项目中添加了以下两行
  • 我应该使用公共变量还是私有变量?

    我第一次做一个大型项目 我有很多类 其中一些具有公共变量 一些具有带有 setter 和 getter 方法的私有变量 并且相同具有两种类型 我决定重写此代码以主要仅使用一种类型 但我不知道应该使用哪个 仅用于同一对象中的方法的变量始终是私
  • Visual Studio 2005/2012:如何将第一个花括号保持在同一行?

    尝试让我的 css C 函数看起来像这样 body color 222 而不是这个 body color 222 当我自动格式化代码时 C In the Tools菜单点击Options Click 显示所有参数 左下角的复选框 显示所有设
  • 使用 C# 按创建日期降序获取目录中的文件列表

    我想使用 C 获取按创建日期排序的文件夹中的文件列表 我正在使用以下代码 if Directory Exists folderpath DirectoryInfo dir new DirectoryInfo folderpath FileI
  • URL 问号后面的部分是什么术语?

    http www example com foo 该术语是什么foo网址的一部分 这是query 或者有时请求参数 从中捏取有用的图表URI RFC https datatracker ietf org doc html rfc3986 s
  • lua检查多个值是否相等

    我喜欢用 Roblox 制作游戏 并用 lua 编写代码 在编写游戏时 我发现自己经常问一个值是否等于另一个值 这可能会产生很长的代码行 并且可能非常重复 例如 如果 x ClassName 衬衫 或x ClassName 附件 或x Cl
  • (转)发送http请求时如何控制gzip压缩?

    我想问一下大家在请求HTTP Post消息时如何控制gzip压缩 Accept Encoding gzip 作为 Http 请求标头始终添加到我发送的 http 请求中 但我不想使用 gzip 压缩 我该如何处理 在执行http NewRe
  • 在onPause而不是onDestroy中释放资源

    这是关于后蜂窝状 即Android 3 0 以及下面的引用来自https developer android com reference android app Activity html https developer android c
  • Rails 应用程序错误 - ActiveRecord::PendingMigrationError 迁移正在挂起;运行“rake db:migrate RAILS_ENV=development”来解决此问题

    数据库已创建 表已创建 数据已存在 但是当我重新启动Rails应用程序后 我收到了这个错误 该应用程序正在使用 MySQL 这里有什么问题 先感谢您 Solution 只需运行 rake db migrate 在服务器启动之前需要运行一些迁
  • 如何向java简单日期格式添加天数

    如何在使用简单日期格式获得的当前日期上添加 120 天 我看过一些关于它的帖子 但无法让它发挥作用 我的代码如下 SimpleDateFormat dateFormat new SimpleDateFormat dd MM yyyy get
  • 使用 JavaScript 打开另一个 html 页面时传递变量

    这可能是一个非常愚蠢的问题 但我在网上找不到它 而且我已经寻找了至少一个小时 我有一个链接 a href MusicMe html Instruments a 我想在单击后获取它的 ID 因为我需要将一些变量传递到我打开的页面以知道仪器链接
  • 2 个 2D 向量的叉积

    任何人都可以提供一个返回叉积的函数的示例TWO二维向量 我正在尝试实施这个算法 http www blackpawn com texts pointinpoly default html C 代码会很棒 谢谢 EDIT 找到了另一种适用于
  • 查找 NxN 网格中所有路径的算法

    想象一个机器人坐在 NxN 网格的左上角 机器人只能向两个方向移动 向右和向下 机器人有多少种可能的路径 我可以在谷歌上找到这个问题的解决方案 但我对解释不是很清楚 我试图清楚地理解如何解决这个问题并用Java实现的逻辑 任何帮助表示赞赏
  • Android 自定义视图应扩展 AppCompatTextView

    我创建了简单的自定义视图 它扩展自TextView 在 Android Studio 中我收到此警告 This custom view should extend android support v7 widget AppCompatTex
  • 独立移动应用程序上的 WebRTC

    我知道WebRTC是为浏览器设计的 但是可以直接在移动应用程序上使用WebRTC库吗 Thanks 截至5月14日here https github com pchab AndroidRTC是一个android项目 使用WebRTC效果很好
  • 为什么我不能在 kotlin 中使用 lambda 接口? [复制]

    这个问题在这里已经有答案了 看 我有一个 Java 类 public final class JavaReceiveSingle public static void useSingle Single single single doSth
  • 为什么仅当我在 SDL2 中设置非零 Alpha 大小时才获得 sRGB 帧缓冲区?

    我正在尝试通过以下方式以伽玛正确的方式渲染典型的 OpenGL 颜色三角形本指南 https learnopengl com Advanced Lighting Gamma Correction并查阅 SDL2 文档 了解如何在默认帧缓冲区