小编Sha*_*tam的帖子

libSDL2main.a 的用途是什么?

有些消息来源称-lSDL2main.a在构建 SDL2 程序时将其作为要链接的文件之一,但有些消息来源则不然。该程序在这两种情况下都运行良好。它是做什么用的?

c c++ linker sdl sdl-2

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

为什么 GIF 的 MPEG-4 压缩会产生奇怪的结果?

我想知道如果 MPEG-4 尝试压缩具有完全随机像素的图像会发生什么。所以我用 Python 中的 Pillow 制作了一个带有随机像素的图像。

实际的 GIF:

GIF 帧示例

这不是动画,因为动画太大了。每个像素的颜色是完全随机的。因为 MPEG-4 应该只混合相似的颜色。因此,由于颜色偶然相似,因此应该有一些混合颜色。那不是发生的事情。

MP4 帧之一: MP4 帧

压缩中有一个CLEAR模式。它看起来像一个清晰的、未压缩的补丁和压缩混合补丁的矩阵。这是怎么回事?效果在 .mp4 文件中更加清晰,请单击此处查看。在我的设备上存储的原始文件中,它更加清晰。这不是 Python 通过random模块生成的伪随机数应该发生的事情。

所有帧中的所有像素都是通过以下方式创建的:

[random.randint(0, 255), random.randint(0, 255), random.randint(0, 255)]
Run Code Online (Sandbox Code Playgroud)

python random video animated-gif mpeg-4

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

为什么 OpenGL 中的 3D 投影可以工作,但会留下痕迹?

我刚刚从Wikipedia 中为 3D 投影做了一些数学运算,因为我注意到它们很简单,不需要库。它确实有效,但立方体在移动时会留下痕迹。请注意,立方体实际上并没有移动,我实际上是在改变相机位置,使立方体看起来像是在移动。

没有必要指出我正在做的 100 个坏习惯,我知道,这只是一个快速测试。

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <glad/glad.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <SDL2/SDL_opengl.h>
#include <math.h>
#include "utils.h"
#include "keys.h"

char p = 1;

typedef struct Vec3 {
float x;
float y;
float z;
} Vec3;

void Mat_iden(float *m, Uint32 s) {
Uint32 i = 0;
Uint32 unt = s + 1;
while (i < s) {
    m[unt * i] = 1;
    i++;
}
}

float one[3][3];
float two[3][3];
float three[3][3]; …
Run Code Online (Sandbox Code Playgroud)

c opengl 3d glsl

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

标签 统计

c ×2

3d ×1

animated-gif ×1

c++ ×1

glsl ×1

linker ×1

mpeg-4 ×1

opengl ×1

python ×1

random ×1

sdl ×1

sdl-2 ×1

video ×1