- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在OpenGL项目上工作,即使我包含glut.h并链接了诸如opengl32.lib,glfw3.lib,glaux.lib,glu32.lib,glut32.lib之类的常见库文件,也遇到了以下编译错误。以下是我的代码片段无法正常运行(cpu_fan.h):
#ifndef CPU_FAN
#define CPU_FAN
#include "parameter.h"
#include "dragHandler.h"
#include <iostream>
#include <glad/glad.h>
#include <GLFW\glfw3.h>
#include "motion.h"
#include "objects.h"
#include "bitmap.h"
#include "light.h"
#include <GL/glut.h>
#include <windows.h>
class cpu_fan {
private:GLfloat c_center[3] = { 0.0075, 0.0075, 0.0075};
GLfloat c_meshCylinder[3] = { 0.0075, 0.0075, 0.0075 };
GLfloat c_meshBlade[3] = { 0.015, 0.015, 0.015 };
GLfloat c_rim[3] = { 0., 0., 0. };
GLfloat c_blade[3] = { .0 , .0, .0 };
GLfloat fan_spin_theta = 0, y_spin = 0;
GLuint fan_no_blades = 6;
int sides = 30;
float rim_start = 0., rim_end = -0.9;
float mesh_start = rim_end - 0.05, mesh_end = mesh_start - 3.;
int meshCount = 50;
GLfloat v_blade[30][3] = { {0.5, 0., -0.6},
{4.05, 0.9, 0.},
{4.9, 2., 0.},
{5.5, 3., 0.},
{6.15, 4., 0.},
{6.73, 5., 0.},
{7.23, 6., 0.},
{7.55, 7., 0.},
{8.1, 8., 0.},
{8.5, 9., 0.},
{8.8, 10., 0.},
{9.1, 11., 0.},
{9.28, 12., -0.1},
{9.47, 13., -0.15},
{9.51, 14., -0.2},
{9.4, 15., -0.25},
{9., 15.8, -0.3},
{8., 16.72, -0.35},
{7., 17.3, -0.4},
{6., 17.60, -0.45},
{5., 17.70, -0.5},
{4., 17.57, -0.55},
{3., 17.4, -0.6},
{2., 16.46, -0.65},
{1.3, 16., -0.7},
{1., 15.46, -0.75},
{0.5, 15., -0.8},
{0.15, 14., -0.85},
{0.123, 13., -0.9},
{0.12, 12., -0.95} };
point3D move;
GLfloat viewTheta = 0.;
bool visible = true;
bool objMove = false;
void draw_fan_blades();
void draw_fan_center();
void draw_fan_rim();
void draw_cooler_grills();
void showDescrpiton();
void motionHandle();
public: void render();
};
void cpu_fan::showDescrpiton() {
GLfloat diff = 1.5;
glPushMatrix();
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
// Transperent Glass Frame
glColor4f(0., 0., 0., .7);
glBegin(GL_POLYGON);
glVertex3f(-10., -10., objLoc.z - diff);
glVertex3f(-10., 10., objLoc.z - diff);
glVertex3f(10., 10., objLoc.z - diff);
glVertex3f(10., -10., objLoc.z - diff);
glEnd();
glPopMatrix();
}
void cpu_fan::motionHandle() {
if (((enterPressed && objIndex == REMOVE_FAN) || objMove == true) && !assemble)
{
objMove = true;
move.x -= 0.007;
if (move.x < disapphereLimit)
{
enterPressed = false;
visible = false;
objMove = false;
}
}
else if (((enterPressed && objIndex == REMOVE_FAN-1) || objMove == true) && assemble)
{
objMove = true;
visible = true;
move.x += 0.007;
if (move.x >= 0.)
{
enterPressed = false;
objMove = false;
}
}
}
void cpu_fan::render() {
motionHandle();
if (!visible) return;
glPushMatrix();
glTranslatef(move.x, move.y, move.z);
glRotatef(viewTheta, 0., 1., 0.);
glColor3f(.001, 0.001, .001);
glTranslatef(-0.974, .52, -0.745);
glTranslatef(8.72, 4.321, -3.821);
/// Remove this to stop rotate
//glRotatef(y_spin * 0.5, 0., 1., 0.); //Rotate whole on Y axis
//y_spin += 2.;
//if (y_spin >= 720.) y_spin = 0;
glRotatef(-90., 0., 1., 0.);
glScalef(0.009375, 0.009375, 0.046875);
draw_fan_blades();
draw_fan_center();
draw_fan_rim();
draw_cooler_grills();
glPopMatrix();
}
#include <iostream>
#include <glad/glad.h>
#include <GLFW\glfw3.h>
#include "parameter.h"
#include "motion.h"
#include "objects.h"
#include "bitmap.h"
#include "light.h"
#include <GL/glut.h>
#include <windows.h>
/* TEXTURE HANDLING */
void loadTexture(GLuint texture, const char* filename) {
BmpLoader image(filename);
glBindTexture(GL_TEXTURE_2D, texture);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGB, image.iWidth, image.iHeight, GL_RGB, GL_UNSIGNED_BYTE, image.data);
}
void textureInit() {
// Create Texture.
textures = new GLuint[NUM_TEXTURE];
glGenTextures(NUM_TEXTURE, textures);
// Load the Texture.
for (int i = 0; i < NUM_TEXTURE; i++)
loadTexture(textures[i], texPath[i]);
}
/* REDNDERING HANDLING */
void change_size(int w, int h) {
// Update global parameters
width = w;
hight = h;
// Do reshape
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
float ratio = 0.0f;
h = h == 0 ? 1 : h;
ratio = (float)w / (float)h;
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(80.0f, ratio, 0.7f, 100.0f);
glMatrixMode(GL_MODELVIEW);
}
1>------ Build started: Project: desktop-simulator, Configuration: Debug Win32 ------
1>main.cpp
1>C:\Users\username\cpu_fan.h(7,56): warning C4305: 'initializing': truncation from 'double' to 'GLfloat'
1>C:\Users\username\cpu_fan.h(8,57): warning C4305: 'initializing': truncation from 'double' to 'GLfloat'
1>C:\Users\username\cpu_fan.h(9,51): warning C4305: 'initializing': truncation from 'double' to 'GLfloat'
1>C:\Users\username\cpu_fan.h(15,39): warning C4305: 'initializing': truncation from 'double' to 'float'
1>C:\Users\username\cpu_fan.h(16,30): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
1>C:\Users\username\cpu_fan.h(16,60): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
1>C:\Users\username\cpu_fan.h(47,28): warning C4305: 'initializing': truncation from 'double' to 'GLfloat'
1>C:\Users\username\cpu_fan.h(66,2): error C3861: 'glPushMatrix': identifier not found
1>C:\Users\username\cpu_fan.h(71,2): error C3861: 'glColor4f': identifier not found
1>C:\Users\username\cpu_fan.h(72,10): error C2065: 'GL_POLYGON': undeclared identifier
1>C:\Users\username\cpu_fan.h(72,2): error C3861: 'glBegin': identifier not found
1>C:\Users\username\cpu_fan.h(73,3): error C3861: 'glVertex3f': identifier not found
1>C:\Users\username\cpu_fan.h(74,3): error C3861: 'glVertex3f': identifier not found
1>C:\Users\username\cpu_fan.h(75,3): error C3861: 'glVertex3f': identifier not found
1>C:\Users\username\cpu_fan.h(76,3): error C3861: 'glVertex3f': identifier not found
1>C:\Users\username\cpu_fan.h(77,2): error C3861: 'glEnd': identifier not found
1>C:\Users\username\cpu_fan.h(78,2): error C3861: 'glPopMatrix': identifier not found
1>C:\Users\username\cpu_fan.h(110,2): error C3861: 'glPushMatrix': identifier not found
最佳答案
不推荐使用glPushMatrix
和glPopMatrix
等(Legacy OpenGL),并且在核心配置文件OpenGL context中不可用。您必须使用兼容性配置文件OpenGL上下文,并且必须生成相应的OpenGL加载程序。
Glad加载器生成器提供“配置文件”选项,可以将其设置为“兼容性”或“核心”
关于c++ - 'glPopMatrix':找不到标识符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61403128/
C++ Primer 说: The identifier we define in our programs may not contain 2 consecutive underscores, no
标识符术语在文档 alongside constants 中定义。 , 使用几乎相同的用例,尽管术语在运行时计算它们的值,而常量在编译时得到它。潜在地,这可能会使术语使用全局变量,但这是一个遥远而丑陋
我想知道,.Net 标识符中接受哪些字符? 不是 C# 或 VB.Net,而是 CLR。 我问这个的原因是我正在查看 yield return 语句是如何实现的 (C# In Depth),并看到
在PowerShell中,当我专门使用Active Directory时,通常会编译一个包含一组人群列表的对象,通常使用$x = get-adgroup -filter {name -like "*"
使用 hibernate 时: 我必须为每个实体指定一个 ID 或复合 ID,如果我想使用没有任何主键且没有复合键的表怎么办... 提前致谢 最佳答案 没有键的表不是一个好的关系模型。我不会推荐它。
所以我有一些代码正在尝试编译,但我不断收到此错误: 3SATSolver.java:3: expected 这是代码。我只是没有看到什么吗? import java.util.ArrayList;
我正在寻找有关 C 标准(C99 和/或 C11)部分内容的一些说明,主要是关于标识符的使用。 上下文是一个完整的C99标准库的实现,我希望它完全符合标准。 基本问题是:C 标准允许我在多大程度上声明
我有这个 Shader.h 文件,我正在用这段代码制作它: #include #include #include #include in vec2 TexCoords; out vec4 co
很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visit the help center . 关闭 1
这是我的代码: #include "stdafx.h" #include #include #include #include using namespace std; int _tmain(
pthread_create() 的第一个参数是一个thread 对象,用于标识新创建的线程。但是,我不确定我是否完全理解其中的含义。 例如,我正在编写一个简单的聊天服务器并且我计划使用线程。线程会随
我想从我的标识符中获得匹配项。 我在 {/describe:foo} 中有一个这样的字符串,我正在尝试匹配 {/describe:} 以返回 foo,但我没有得到正确的正则表达式,会有人介意指出我做错
我遇到了一个奇怪的问题,我似乎找不到答案,但我想我不妨问问。 我有一个执行碰撞检查的抽象类,它有一个“更新”函数,以及“updateX”和“updateY”函数。 class MapCollidabl
我正在尝试创建一个程序来将所有文件从一个目录复制到另一个目录。但我遇到了一个基本问题。它说当我尝试在第 52 行编译时需要标识符。 public bool RecursiveCopy() {
1>cb.c(51): error C2061: syntax error : identifier 'SaveConfiguration' 1>cb.c(51): error C2059: synt
我刚刚发现命名变量 arguments 是个坏主意。 var arguments = 5; (function () { console.log(arguments); })(); Outpu
我们对我们的网站进行了安全测试,并发现了一个漏洞。 问题 If the session identifier were known by an attacker who had access to t
为了估计程序在一次内核启动中可以处理多少数据,我尝试使用 cudaMemGetInfo() 获取一些内存信息。但是,编译器告诉我: 错误:标识符“cudaMemGetInfo”未定义 cudaGetD
我发现我需要使用 xpath 查询来定位几乎是 regexp 类型的字符串,但无法看到如何管理它。我正在使用的当前查询是: $result = $xpath->query('//ul/li[sta
我正在创建我的学生计划表的虚拟版本,它基本上可以让你记下你有哪些科目的作业。 这是界面: 用户从组合框中选择主题,并在相邻的备忘录中输入一些注释。完成后,他们将单击“保存”按钮,将其保存到 .ini
我是一名优秀的程序员,十分优秀!