从 C 矩阵到现代 OpenGL 中的纹理?

2024-01-18

Problem

我正在尝试使用 OpenGL 用 C 编写一个简单的程序,这将允许“绘制”2D C 数组(int **,32 位整数)根据调色板。

目前(我还没有做到这一点,还很远:))我正在学习如何将 32 位有符号整数数组发送到 GPU 并以某种方式显示它。

我正在尝试在现代 OpenGL 中做到这一点。

我的方法(请耐心等待,因为我两天前才开始学习这些主题):

  1. 几何数据由四个顶点组成(vertices)用于定义基于两个三角形的矩形(通过使用索引选取顶点来定义(indices)). The vertices数据还与 2D 纹理坐标交错(用于着色器中的纹理采样)。
  2. 我进行 VAO、VBO 和 EBO 的生成和绑定,以将顶点数据从 RAM 获取到 VRAM。
  3. 然后,我使用创建 2D 纹理glTexImage2D(),内部格式等于GL_R32I因为我的 C 数组是类型int **。我不太确定format and type参数,但我已将它们设置为GL_RED_INTEGER and GL_UNSIGNED_INT, 分别。
  4. 在片段着色器中,我尝试通过执行类似的操作来“读取”原始整数texture(texture1, TexCoord).r但可能这是不对的...还尝试将红色组件转换为浮动:(float) texture(texture1, TexCoord).r但也不起作用。只是为了让您放心,代码可能会做正确的事情,只留下FragColor = vec4(1.0f, 0.8f, 0.2f, 1.0f);片段着色器中确实显示了该颜色,这意味着我得到了一个用该颜色填充窗口的矩形。因此,只有当我开始摆弄纹理时,我才会得到黑屏或青色 RGB:(0, 1.0, 1.0, 1.0).

注意:我的C数组被命名为plane,现在它被左边的块填满了0值和右块1s.

现在,如果我可以在片段着色器中硬编码一个 if 语句来为片段着色,我会很高兴0s and 1来自 32 位的plane成任意两种其他颜色。然后我想我可以继续在调色板中包含一维纹理......就像完成的那样here https://gamedev.stackexchange.com/questions/43294/creating-a-retro-style-palette-swapping-effect-in-opengl.

Code

pixel.h

#ifndef PIXEL_H
#define PIXEL_H

/* 
  To make sure there will be no header conflicts, you can define
  GLFW_INCLUDE_NONE before the GLFW header to explicitly disable
  inclusion of the development environment header. This also allows
  the two headers to be included in any order. 
*/
#define GLFW_INCLUDE_NONE

#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <plane.h>
#include <utils.h>
#include <stdlib.h>
#include <stdio.h>

#endif

pixel.c

#include <pixel.h>

const char *vertexShaderSource = "#version 330 core\n"
"layout (location = 0) in vec3 aPos;\n"
"layout (location = 1) in vec2 aTexCoord;\n"
"out vec2 TexCoord;\n"
"void main()\n"
"{\n"
"   gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);\n"
"   TexCoord = vec2(aTexCoord.x, aTexCoord.y);\n"
"}\0";
const char *fragmentShaderSource = "#version 330 core\n"
"out vec4 FragColor;\n"
"in vec2 TexCoord;\n"
"uniform isampler2D texture1;\n"
"void main()\n"
"{\n"
"   FragColor = vec4(1.0f, 0.8f, 0.2f, 1.0f);\n"
"   //FragColor = vec4(texture(texture1, TexCoord).r, 1.0f, 1.0f, 1.0f);\n"
"}\n\0";

int main(void)
{
  
  // Window width and height.
  const unsigned int width = 20;
  const unsigned int height = 10;
  
  // Before you can use most GLFW functions, the library must be initialized.
  if (!glfwInit()) {
    printf("Could not initialise GLFW library!");
    exit(EXIT_FAILURE);
  }
  
  /*
   * By default, the OpenGL context GLFW creates may have any version.
   * You can require a minimum OpenGL version by setting the
   * GLFW_CONTEXT_VERSION_MAJOR and GLFW_CONTEXT_VERSION_MINOR hints
   * before creation. If the required minimum version is not supported
   * on the machine, context (and window) creation fails.
   */
  glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
  glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
  glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
  
  // Create a GLFW window.
  GLFWwindow* window = glfwCreateWindow(width, height, "pixel example", NULL, NULL);
  if (!window)
  {
    printf("Window or OpenGL context creation failed!\n");
    glfwTerminate();
    exit(EXIT_FAILURE);
  }
  
  // Before you can use the OpenGL API, you must have a current OpenGL context.
  glfwMakeContextCurrent(window);
  
  /* 
   * If you are using an extension loader library to access modern OpenGL
   * then this is when to initialize it, as the loader needs a current
   * context to load from. This example uses glad, but the same rule applies
   * to all such libraries.
   */
  gladLoadGL();
  
  /*
   * Set a framebuffer size callback to update the viewport when
   * the window size changes.
   */
  glfwSetFramebufferSizeCallback(window, fb);
  
  /*
   * 
   * Data to be drawn.
   * 
   */
  int **plane = NewPlane(width, height);
  PLANE(width, height, if (i < width / 2) plane[i][j] = 0; else plane[i][j] = 1;)
  //plane[width/2][height/2] = 1;
  //PLANE(width, height, printf("%d %d %d\n", i, j, plane[i][j]);)
  printf("size of int: %ld bytes\n", sizeof(int));
  
  // build and compile our shader program
  // ------------------------------------
  // vertex shader
  unsigned int vertexShader = glCreateShader(GL_VERTEX_SHADER);
  glShaderSource(vertexShader, 1, &vertexShaderSource, NULL);
  glCompileShader(vertexShader);
  // check for shader compile errors
  int success;
  char infoLog[512];
  glGetShaderiv(vertexShader, GL_COMPILE_STATUS, &success);
  if (!success)
  {
    glGetShaderInfoLog(vertexShader, 512, NULL, infoLog);
    printf("ERROR::SHADER::VERTEX::COMPILATION_FAILED\n%s\n", infoLog);
  }
  // fragment shader
  unsigned int fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
  glShaderSource(fragmentShader, 1, &fragmentShaderSource, NULL);
  glCompileShader(fragmentShader);
  // check for shader compile errors
  glGetShaderiv(fragmentShader, GL_COMPILE_STATUS, &success);
  if (!success)
  {
    glGetShaderInfoLog(fragmentShader, 512, NULL, infoLog);
  printf("ERROR::SHADER::FRAGMENT::COMPILATION_FAILED\n%s\n", infoLog);
  }
  // link shaders
  unsigned int shaderProgram = glCreateProgram();
  glAttachShader(shaderProgram, vertexShader);
  glAttachShader(shaderProgram, fragmentShader);
  glLinkProgram(shaderProgram);
  // check for linking errors
  glGetProgramiv(shaderProgram, GL_LINK_STATUS, &success);
  if (!success) {
    glGetProgramInfoLog(shaderProgram, 512, NULL, infoLog);
    printf("ERROR::SHADER::PROGRAM::LINKING_FAILED%s\n", infoLog);
  }
  glDeleteShader(vertexShader);
  glDeleteShader(fragmentShader);
  
  
  // float vertices[] = {
  //    1.0f,  1.0f, 0.0f, // top right
  //    1.0f, -1.0f, 0.0f, // bottom right
  //   -1.0f, -1.0f, 0.0f, // bottom left
  //   -1.0f,  1.0f, 0.0f  // top left 
  // };
  float vertices[] = {
    // positions          // texture coords
     1.0f,  1.0f, 0.0f,   1.0f, 1.0f, // top right
     1.0f, -1.0f, 0.0f,   1.0f, 0.0f, // bottom right
    -1.0f, -1.0f, 0.0f,   0.0f, 0.0f, // bottom left
    -1.0f,  1.0f, 0.0f,   0.0f, 1.0f  // top left 
  };
  
  unsigned int indices[] = {
    // note that we start from 0!
    0, 1, 3, // first triangle
    1, 2, 3 // second triangle
  };
  
  unsigned int VBO, VAO, EBO;
  glGenVertexArrays(1, &VAO);
  printf("VAO: %d\n", VAO);
  glGenBuffers(1, &VBO);
  printf("VBO: %d\n", VBO);
  glGenBuffers(1, &EBO);
  printf("EBO: %d\n", EBO);
  // bind the Vertex Array Object first, then bind and set vertex buffer(s), and then configure vertex attributes(s).
  glBindVertexArray(VAO);
  
  glBindBuffer(GL_ARRAY_BUFFER, VBO);
  glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
  
  glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);
  glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);
  
  // glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);
  // glEnableVertexAttribArray(0);
  // position attribute
  glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);
  glEnableVertexAttribArray(0);
  // texture coord attribute
  glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));
  glEnableVertexAttribArray(1);
  
  
  // note that this is allowed, the call to glVertexAttribPointer registered VBO as the vertex attribute's bound vertex buffer object so afterwards we can safely unbind
  glBindBuffer(GL_ARRAY_BUFFER, 0); 
  
  // remember: do NOT unbind the EBO while a VAO is active as the bound element buffer object IS stored in the VAO; keep the EBO bound.
  //glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
  
  // You can unbind the VAO afterwards so other VAO calls won't accidentally modify this VAO, but this rarely happens. Modifying other
  // VAOs requires a call to glBindVertexArray anyways so we generally don't unbind VAOs (nor VBOs) when it's not directly necessary.
  glBindVertexArray(0); 
  
  // uncomment this call to draw in wireframe polygons.
  //glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
  
  unsigned int texture;
  glGenTextures(1, &texture);
  glBindTexture(GL_TEXTURE_2D, texture);
  if (plane) {
    glTexImage2D(GL_TEXTURE_2D, 0, GL_R32I, width, height, 0, GL_RED_INTEGER, GL_UNSIGNED_INT, plane);
  }
  
  /*
   * 
   * Main loop
   * 
   */
  
  while (!glfwWindowShouldClose(window))
  {
    
    // Check if Escape is pressed and signal to close the window.
    input(window);
    
    // The glClearColor function is a state-setting function
    glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
    
    // The glClear is a state-using function in that it uses the
    // current state to retrieve the clearing color from.
    glClear(GL_COLOR_BUFFER_BIT);
    
    // Rendering goes here.
    glUseProgram(shaderProgram);
    glBindVertexArray(VAO); // seeing as we only have a single VAO there's no need to bind it every time, but we'll do so to keep things a bit more organized
    glDrawArrays(GL_TRIANGLES, 0, 6);
    glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
    
    glfwSwapBuffers(window);
    glfwPollEvents();
  }
  
  glfwDestroyWindow(window);
  
  glfwTerminate();
  exit(EXIT_SUCCESS);
}

plane.h

#ifndef PLANE_H
#define PLANE_H

#include <stdlib.h>
#include <stdio.h>

#define PLANE(width, height, A) {int i,j,_ii,_jj;for(i=0,_ii=width;i<_ii;i++)for(j=0,_jj=height;j<_jj;j++){A};}

int **NewPlane(int, int);

#endif

plane.c

#include <plane.h>

int **NewPlane(int width,int height)
{
  int **a;
  int i,j;
  
  a = (int **)calloc((size_t)(width),sizeof(int *));
  if (a == NULL) {
    fprintf(stderr,"NewPlane: error in memory allocation\n");
    exit(EXIT_FAILURE);
  }
  a[0] = (int *)calloc((size_t)((width)*(height)),sizeof(int));
  if (a[0] == NULL) {
    fprintf(stderr,"NewPlane: error in memory allocation\n");
    exit(EXIT_FAILURE);
  }
  for (i=1,j=width; i < j; i++)
    a[i] = a[i-1] + height;
  
  return a;
}

我现在已经开始工作了,有一些事情需要修复。

  1. 正如@Rabbid76所示,整数值的转换value(在片段着色器代码中)到范围内的浮点数[0, 1]是一个重要的变化。
  2. 另外,正如 @tstanisl 所指出的,数据传递给glTexImage2D()需要在内存中连续,因此,就我而言,将调用更改为glTexImage2D(..., plane[0])也很重要。
  3. 最后,我失踪了:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

如中所解释的GL_R32I TexImage2D 未正确上传 https://stackoverflow.com/questions/43355491/gl-r32i-teximage2d-not-uploading-correctly.

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

从 C 矩阵到现代 OpenGL 中的纹理? 的相关文章

  • 我应该把 try/catch 和“using”语句放在哪里? [复制]

    这个问题在这里已经有答案了 可能的重复 try catch using 正确的语法 https stackoverflow com questions 4590490 try catch using right syntax 我想try c
  • WebClient.DownloadDataAsync 冻结了我的 UI

    我在 Form 构造函数中的 InitializeComponent 之后有以下代码 using WebClient client new WebClient client DownloadDataCompleted new Downloa
  • 如何使用 ASP.NET MVC 编辑多选列表?

    我想编辑一个如下所示的对象 我希望用 UsersGrossList 中的一个或多个用户填充 UsersSelectedList 使用 mvc 中的标准编辑视图 我只得到映射的字符串和布尔值 下面未显示 我在 google 上找到的许多示例都
  • IEnumerable 的 String.Join(string, string[]) 的类似物

    class String包含非常有用的方法 String Join string string 它从数组创建一个字符串 用给定的符号分隔数组的每个元素 但一般来说 它不会在最后一个元素之后添加分隔符 我将它用于 ASP NET 编码 以用
  • 异常堆栈跟踪不显示抛出异常的位置

    通常 当我抛出异常 捕获它并打印出堆栈跟踪时 我会看到抛出异常的调用 导致该异常的调用 导致该异常的调用that 依此类推回到整个程序的根 现在它只向我显示异常所在的调用caught 而不是它所在的地方thrown 我不明白是什么改变导致了
  • 如何以编程方式播放 16 位 pcm 数组 [关闭]

    Closed 这个问题不符合堆栈溢出指南 help closed questions 目前不接受答案 我有一个包含 16 位 pcm 值的短 数组 我希望能够在不添加任何标题 也不将任何文件保存到内存的情况下播放它 我知道我可能需要一个提供
  • 全局使用和 .NET Standard 2.0

    我最近意识到我可以使用 C 10 功能文件范围的命名空间在 NET Standard 2 0 项目中也可以通过设置
  • while循环中的变量初始化

    我有一个可以分块读取文件的函数 public static DataObject ReadNextFile 数据对象看起来像这样 public DataObject public string Category get set And ot
  • 你好,我最近正在开发我的新游戏,我遇到了*无限跳跃*的问题

    所以基本上当我按跳跃 空格键时我会跳跃但是如果我连续按空格键它 只是跳啊跳啊跳等等 我不想要我只想它跳一次 code if Input GetKeyDown space isGrounded velocity y Mathf Sqrt ju
  • 使用 C# 中的 Google 地图 API 和 SSIS 包获取行驶距离

    更新 找到了谷歌距离矩阵并尝试相应地修改我的代码 我在这里收到无效参数错误 return new GeoLocation dstnc uri ToString catch return new GeoLocation 0 0 https 基
  • 用于连接 DataTable 上的动态列的动态 LINQ

    我目前遇到的情况不确定如何继续 我有两个从数据库填充的数据表 我还有一个可用的列名称列表 可用于将这两个数据表连接在一起 我希望编写一组 LINQ 查询 这些查询将 显示两个数据表中的行 内部联接 用于从一个数据表更新另一个数据表 显示一个
  • Xamarin - SignalR 挂在连接上

    我正在尝试将我的 Xamarin 应用程序连接到托管在 Azure 上的 SignalR 后端 我遇到的问题是每次我在 HubConnection 上调用 StartAsync 时 它都会挂起客户端并且请求永远不会完成 我尝试通过应用程序进
  • C++ 到 C# 事件处理

    所以我有我的C WinForm 应用程序 我从中调用我的C CLI MFC dll图书馆 但也有一些events在我的 C 库上 甚至此事件也发生在该库的本机 非 CLI 部分 我需要从我的 C 应用程序调用一些代码 并获取一些有关此事件的
  • 如何使用 CSI.exe 脚本参数

    当你运行csi exe 安装了 Visual Studio 2015 update 2 您将得到以下语法 Microsoft R Visual C Interactive Compiler version 1 2 0 51106 Copyr
  • 使用多线程进行矩阵乘法?

    我应该使用线程将两个矩阵相乘 有两件事 当我运行程序时 我不断得到 0 我还收到消息错误 对于每个错误 它在粗体行上显示 警告 从不兼容的指针类型传递 printMatrix 的参数1 我尝试打印输出 还要注意 第一个粗体块 这是我解决问题
  • 为什么 f(i = -1, i = -1) 是未定义的行为?

    我正在读关于违反评估顺序 http en cppreference com w cpp language eval order 他们举了一个令我困惑的例子 1 如果标量对象上的副作用相对于同一标量对象上的另一个副作用是无序的 则行为未定义
  • 使用 xslt 将 xml 转换为 xsl-fo 时动态创建超链接?

    我想使用 xsl 文件在 PDF 报告中创建标题 如果源文件包含超链接 则应将其呈现为超链接 否则呈现为纯文本 例如 我的 xml 如下所示 a href http google com target blank This is the h
  • 浮点字节序?

    我正在为实时海上模拟器编写客户端和服务器 并且由于我必须通过套接字发送大量数据 因此我使用二进制数据来最大化可以发送的数据量 我已经了解整数字节顺序以及如何使用htonl and ntohl为了规避字节顺序问题 但我的应用程序与几乎所有模拟
  • 在哪里可以下载没有 Visual Studio 2010 的 C# 4.0 编译器?

    我知道 CTP VS 2010 映像 但我可以只下载 NET Framework 4 0 和 C 编译器吗 AFAIK VS 2010 CTP 仅作为 VM 映像提供 我不相信 Microsoft 发布了 VS 的安装程序 其中一个绝对不适
  • 如何将 int 作为“void *”传递给线程启动函数?

    我最初有一个用于斐波那契变量数组的全局变量 但发现这是不允许的 我需要进行基本的多线程处理并处理竞争条件 但我无法在 pthread 创建中将 int 作为 void 参数提供 我尝试过使用常量指针 但没有成功 由于某些奇怪的原因 void

随机推荐

  • 记录清单

    以下代码似乎向列表中添加了一条新记录 但会用最后创建的记录覆盖所有记录 我可以让它正常工作 lpr Add new personRecord Age pr Age Name pr Name 但这似乎更冗长 并且在真正的应用程序中记录要大得多
  • 使用 Springfox 在 Spring 应用程序中记录 jax-rs 服务

    我想使用 Springfox 记录现有应用程序的 API 我将这些依赖项添加到 pom xml 中
  • 反编译的Jar文件的类路径

    所以我不是计算机科学专业或任何其他专业 我只是在研究一些东西来练习我从视频中观看的一些 Java 技能 我知道这不是主要的方法 但请让我这样做 所以我提取了一个 jar 文件 http www zenlunatics com quizcar
  • C# Linq 与柯里化

    我正在玩一点函数式编程及其各种概念 所有这些东西都很有趣 我曾多次阅读过有关柯里化的内容以及它的优势 但我不明白这一点 以下源代码演示了柯里化概念的使用以及 linq 的解决方案 实际上 我没有看到使用柯里化概念的任何优点 那么 使用柯里化
  • 在 C# 中将结构体指针作为参数传递

    我有一个 C 函数 已导出到 DLL I 包含一个结构体指针作为参数之一 我需要在 C 中使用此函数 因此我使用 DLLImport 作为该函数 并使用 StructLayout 在 C 中重新创建了该结构 我尝试使用 ref 传入参数 并
  • Prisma2:如何用 Paljs 解决 n+1 问题

    感谢您的帮助 我在前端使用阿波罗客户端 在后端使用graphql nexus https nexusjs org docs prisma2 和 graphql yoga 服务器 我想用 paljs plugins 解决n 1 问题 在前端我
  • 自动映射器 - 将对象与集合映射

    使用自动映射器 我需要映射以下类的对象 public class RemoteClass public IEnumerable
  • 如何处理“有符号/无符号不匹配”警告 (C4018)?

    我使用大量编写的计算代码c questions tagged c 2b 2b考虑到高性能和低内存开销 它使用STL容器 主要是std vector 很多 并且几乎在每个函数中迭代该容器 迭代代码如下所示 for int i 0 i lt t
  • 这是使用 thenFetch() 加载多个集合的正确方法吗?

    我正在尝试使用急切地加载所有集合NHibernate 3 阿尔法 1 http nhforge org media p 690 aspx 我想知道这是否是使用 thenFetch 的正确方法 具有复数名称的属性是集合 其他的只是一个单一的对
  • Django 如何使用 django.contrib.auth 添加注销成功消息?

    我没有使用all auth 我正在使用标准身份验证系统和 url 提供的django contrib auth 我还确保注销时用户会自动重定向到登录页面 LOGOUT REDIRECT URL login 我想添加一条消息 以便用户知道他们
  • IntelliJ 检查给出“无法解析符号”,但仍编译代码

    平台 IntelliJ社区版10 0 3SDK jdk1 6 0 21操作系统 Windows 7 所以我在使用 IntelliJ 时遇到了一个奇怪的情况 这让我完全陷入困境 我设置了一个 Maven 项目 并将 log4j 添加为 pom
  • 尝试使用selenium截屏时出现空指针异常[重复]

    这个问题在这里已经有答案了 我编写了一个Java类 它使用selenium webdriver来快速浏览网站并测试各种功能 我还编写了一个单独的类 它将用于执行 takeScreenshot 方法 一旦测试命中执行截图方法的代码 浏览器就会
  • 无法创建推力装置矢量

    所以我尝试开始 GPU 编程并使用 Thrust 库来简化事情 我创建了一个测试程序来使用它并查看它是如何工作的 但是每当我尝试创建具有非零大小的推力 device vector时 程序就会崩溃并显示 运行时检查失败 3 变量 结果 正在使
  • 汇编vim语法高亮

    默认的程序集语法文件不能很好地工作 在网上搜索有关 Gas 程序集的信息时 我没有找到任何有关 vim 的 Gas AT T 语法文件的信息 有人发现这个吗 我无法编写自己的语法文件 http img168 imageshack us im
  • 如何在R中将时间格式转换为数字

    示例如下所示 A tibble 10 x 3 trip id start time end time
  • SonarQube 在代码分析中忽略 getter/setter

    SonarQube 仪表板中是否有允许忽略 getter 和 setter 的设置 这听起来是一个比在代码库中的每个方法上编码 nopmd 更好的选择 我的代码库有很多这样的东西 它们极大地降低了 Sonarqube 仪表板中报告的单元测试
  • 更改 Electron 中可拖动区域上的光标

    我正在 Electron 中制作一个应用程序 我有一个无框窗口 我有一些顶部区域 webkit app region drag但当我这样做时 不会改变 显然它在这个片段中是不可拖动的 因为它不是一个电子应用程序 但基本上光标在可拖动的元素上
  • 使用matlab配色方案将float转换为RGB

    例如 如果我有一个浮动0 568 浮动保证是0 gt 1 有没有办法将其转换为 RGB 值 双精度 1 0 1 0 1 0 or int 255 255 255 在当前的 matlab 配色方案 即正常 热 HSV 等 下 你可以试试这个
  • Intel x86 - 中断服务例程责任

    我没有真正意义上的问题 但我会尽力澄清内容问题 假设我们有一个微内核 PC Intel x86 32 位保护模式 中断描述符表 IDT and 中断服务程序 ISR 对于每个CPU异常 ISR 被成功调用 例如Division by Zer
  • 从 C 矩阵到现代 OpenGL 中的纹理?

    Problem 我正在尝试使用 OpenGL 用 C 编写一个简单的程序 这将允许 绘制 2D C 数组 int 32 位整数 根据调色板 目前 我还没有做到这一点 还很远 我正在学习如何将 32 位有符号整数数组发送到 GPU 并以某种方