虽然我想编译我的opengl代码我得到以下错误:
Error 1 error LNK2019: unresolved external symbol __imp__glewInit@0
Error 2 error LNK2019: unresolved external symbol __imp__glewGetErrorString@4
Error 3 error LNK2001: unresolved external symbol __imp____glewAttachShader
Error 4 error LNK2001: unresolved external symbol __imp____glewCompileShader
Error 5 error LNK2001: unresolved external symbol __imp____glewCreateProgram
Error 6 error LNK2001: unresolved external symbol __imp____glewCreateShader
Error 7 error LNK2001: unresolved external symbol __imp____glewDeleteProgram
Error 8 error LNK2001: unresolved external symbol __imp____glewDisableVertexAttribArray
Error 9 error LNK2001: unresolved external symbol __imp____glewEnableVertexAttribArray
Error 10 error LNK2001: unresolved external symbol …Run Code Online (Sandbox Code Playgroud) 我想在vulkan中绘制两个对象.为此,我按照为每个模型创建两个不同描述符集的过程进行操作.但是,我对指定所需描述符集计数的结构感到困惑.困扰我的要点如下:
在VkDescriptorSetLayoutBinding指定描述符计数
VkDescriptorSetLayoutBinding stagingLayoutBinding = {};
...
stagingLayoutBinding.descriptorCount = 1; <- i have one mat4 element for each descriptors
Run Code Online (Sandbox Code Playgroud)在VkDescriptorPoolSize指定描述符计数
VkDescriptorPoolSize stagingPoolSize = {};
...
stagingPoolSize.descriptorCount = static_cast<uint32_t>(model.size()); <- allocate two descriptor sets from one descriptor pool
Run Code Online (Sandbox Code Playgroud)在VkDescriptorPoolCreateInfo中指定最大值集
VkDescriptorPoolCreateInfo poolInfo = {};
...
poolInfo.maxSets = model.size(); <- max descriptor sets = 2
Run Code Online (Sandbox Code Playgroud)最后在VkDescriptorSetAllocateInfo中指定描述符集创建
VkDescriptorSetAllocateInfo allocInfo = {};
...
allocInfo.descriptorSetCount = static_cast<uint32_t>(model.size());
Run Code Online (Sandbox Code Playgroud)但是,抛出异常vkAllocateDescriptorSets(device, &allocInfo, descriptorSet.data())并且验证层中的调试消息如下: -
validation Layer: Object: 0xcccccccccccccccc (Type …Run Code Online (Sandbox Code Playgroud) 在我的Opengl程序中(在我应用透视投影矩阵之前)每当我绘制一些对象时,我都会在世界坐标系的原点处绘制它,但是几乎所有Opengl教程都指出相机(我的投影视图)位于原点朝向正 z 轴(这取决于稍后如何处理投影矩阵中的 z 值),但是如果这是真的,我的相机(位于原点)如何能够查看位于原点的对象。
注意:我需要这些信息,以便我移动世界并围绕原点旋转它,这样我就得到旋转相机的错觉。
我正在练习一些opengl代码,但是当我想强制opengl上下文通过glutInitContextVersion()使用某个版本的opengl时,它会失败编译过程并给出这样的信息: -
使用未声明的标识符'glutInitContextVersion'
我想解决这个问题,所以我保持我的代码尽可能简单
码
#include "File.h"
#include <GLUT/GLUT.h>
#include <OpenGL/OpenGL.h>
using namespace std;
int main ()
{
glutInitContextVersion(3,2);
return 1;
}
Run Code Online (Sandbox Code Playgroud)
但是,我能够使用其他过剩函数,没有任何错误或警告消息
我正在使用OS X 10.9.1在Macbook air上运行Xcode 4.4.1
我正在使用Mac OS Air OS X 10.9.2我的显卡是(Intel HD Graphics 4000 1024 MB)苹果声称Macbook air的规格与我的支持最高的Opengl 4.1你可以在这里阅读 - > http:// support.apple.com/kb/HT5942.但是当我使用SDL2并强制系统使用opengl 3.2时,当我通过glGetString()查询OpenGL版本时, 我得到以下行:
2.1 INTEL-8.24.11
Run Code Online (Sandbox Code Playgroud)
我的代码:
#include <iostream>
#include <SDL2/SDL.h>
#include <opengL/gl3.h>
using namespace std;
void sdldie(const char *msg)
{
printf("%s: %s\n", msg, SDL_GetError());
SDL_Quit();
exit(1);
}
void checkSDLError(int line = -1)
{
#ifndef NDEBUG
const char *error = SDL_GetError();
if (*error != '\0')
{
printf("SDL Error: %s\n", error);
if (line != -1)
printf(" + line: %i\n", line);
SDL_ClearError();
}
#endif …Run Code Online (Sandbox Code Playgroud) 最近我开始学习福尔康API,有一些话题让我困惑,我的问题是什么是一个渲染通道,为什么它是用命令缓冲区记录同时使用?什么是子传递,子传递依赖和附件?通常与渲染过程相关.
我想将vulkan与SDL2一起使用,但我停留在曲面创建阶段,我无法使用vkCreateWin32SurfaceKHR扩展函数以及VkWin32SurfaceCreateInfoKHR扩展结构,因为它们未定义,但是使用其他扩展元素(如(vkGetPhysicalDeviceSurfaceSupportKHR,等等..),表面扩展是否需要单独的头文件?我如何使它工作?
我使用的预处理器指令如下
#include <vulkan\vulkan.h>
#include <SDL.h>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <exception>
#define VK_USE_PLATFORM_WIN32_KHR
Run Code Online (Sandbox Code Playgroud)
请注意,我没有使用任何程序就将vulkan与glfw一起使用,这是我第二次尝试运行vulkan,所以我认为我没有任何驱动程序支持问题。
我想把这个问题分成 3 部分:-
limit.minUniformBufferOffsetAlignment的概念是什么,为什么我们需要使用它来获取我们所需的对齐方式并从中导出缓冲区的偏移量?Vulkan 不能自动区分不同的数据类型和它们各自的对齐方式吗?
在 Sascha Willems 示例中,他计算了一个 4X4 矩阵的动态对齐,如下所示
size_t uboAlignment = vulkanDevice->properties.limits.minUniformBufferOffsetAlignment
dynamicAlignment = (sizeof(glm::mat4) / uboAlignment) * uboAlignment + ((sizeof(glm::mat4) % uboAlignment) > 0 ? uboAlignment : 0);
Run Code Online (Sandbox Code Playgroud)
一个 4X4 矩阵是 64 字节,允许的最小对齐大小是 256 字节,但据我所知,他的 dynamicAlignment 计算结果为 (64+256 = 320 //我认为这在 vulkan 中是不允许的) 我不太明白这个dynamicAlignment 是如何实现的计算工作
这个 dynamicAlignment 变量如何反映到
VkBufferCreateInfo bufferInfo = {};
bufferInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
bufferInfo.size = size;
Run Code Online (Sandbox Code Playgroud)
和内存映射之类的
void * data;
vkMapMemory(device, uniformStagingBufferMemory, 0, sizeof(matrix), 0, &data);
memcpy(data, …Run Code Online (Sandbox Code Playgroud)是功能,如glmatrixmode(),gltranslate(),glrotate(),和glscale()在OpenGL 4.3过时?
如果不推荐使用,那么Core OpenGL配置文件中的哪些新函数可以进行矩阵操作?
我想绘制一个场景,其中包含多个对象,每个对象都有自己的统一缓冲区和纹理,目前我能够使用动态统一缓冲区绘制多个对象,我这样做的方法是遍历动态统一缓冲区对象偏移量和索引命令缓冲区记录期间的顶点,这样我告诉 Vulkan 使用特定的全局矩阵绘制模型,但是我不知道如何在此操作期间绑定纹理信息,以便 Vulkan 知道为该对象使用正确的纹理,在我的示例中,我有四个具有四种不同纹理的盒子。
我试图将自定义类对象附加到相同类型的向量,但是当我尝试编译我的代码时,编译器给出以下错误
gltf::gltf(const gltf &): attempting to reference a deleted function
我的函数接受一个字符串(文件名)作为参数并加载该文件,然后解析该文件并填充它的变量
功能如下: -
void enigma::loadModel(std::string file)
{
gltf stagingModel;
stagingModel.loadAsset(file); // populates my object with data
model.push_back(stagingModel); // appends the populated object to a vector array (this line generates the error)
.... // the rest of the code
}
Run Code Online (Sandbox Code Playgroud)
我的gltf类decleration如下: -
#pragma once
#include <iostream>
#include <vector>
#include <sstream>
#include <fstream>
#include "meshClass.h"
#include "bufferClass.h"
#include <gtx/quaternion.hpp>
#include <gtx/transform.hpp>
#include"stagingNodeClass.h"
#include"stagingMeshClass.h"
#include"stagingAccessorClass.h"
#include"stagingBufferViewClass.h"
#include"stagingImageClass.h"
#include"stagingSamplerClass.h"
#include"stagingTextureClass.h"
#include"stagingMaterialClass.h"
#include"stagingSkinClass.h"
class gltf …Run Code Online (Sandbox Code Playgroud)