glut

    0熱度

    2回答

    我使用OpenGL OBJ loader,可以下載here! 我從Blender導出了一個OBJ模型。 問題是我想實現平滑的陰影。 As you can see, it is not smooth here. 我該如何做到這一點?法線向量計算器可能有問題嗎? float* Model_OBJ::calculateNormal(float *coord1, float *coord2, float

    0熱度

    1回答

    如果我想在OpenGL畫一個平面,我會做類似下面: glBegin(GL_POLYGON); glColor3f(1.0, 1.0, 1.0); glVertex3f(0.5, -0.5, 0.5); glVertex3f(0.5, 0.5, 0.5); glVertex3f(-0.5, 0.5, 0.5); glVertex3f(-0.5, -0.5, 0.5); glEnd();

    0熱度

    2回答

    我正在使用opengl C++並嘗試在終端上渲染隨機多邊形的代碼。我使用的是CodeBlocks 13.12。 int width=800; int height=600; void RandomPolygons() { glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); GLint x[100],y[100],n,r,

    1熱度

    1回答

    glRectf()不顯示我的窗口內: #include <GL/gl.h> #include <GL/glut.h> void renderScene(){ glClearColor(0.0f,1.0f,1.0f,1.0f); glClear(GL_COLOR_BUFFER_BIT); glColor3f(1.0f,0.0f,0.0f); glRect

    0熱度

    1回答

    我有一個名爲getWorldPosition的函數,它應該返回一個代表任何VisualObject(我定義的超類)當前位置的vec3。 glm::vec3 VisualObject::getWorldPosition() { glm::mat4 totalTransformation = getParentModelMatrix() * modelMatrix; return

    2熱度

    1回答

    我製作了一個非常簡單的引擎,它基本上繪製了一個角色,然後您可以在屏幕上移動它。 但我確實在相當可怕的方式運動,我的意思是它是基於這樣的離散值: void Scene::movePlayer(int dir) { switch (dir){ case 1: yy = yy + 0.05; break; case 2: xx = xx - 0.05;

    2熱度

    1回答

    目前我正在試圖從我的屏幕的底部左側開始和照明對我的屏幕的中心,但我的光源不會出現圓形(光似乎並不輕定位從單一現身點)。 移動光源後,它照在整個物體上,但是期望的效果是光源只向右(基於點)發光。 void init() { camPos[0]= -(size/2)*.1; camPos[1]= size*.1; camPos[2]= -(size/2)*.1;

    0熱度

    1回答

    我使用下面的命令編譯程序: g++ main.cpp -o run -lglut -lm 並獲得以下錯誤: main.cpp:20:21: fatal error: GL\glut.h: No such file or directory #include <GL\glut.h> ^ compilation terminated. 雖然過剩已經安裝:易於得到安裝free

    -1熱度

    1回答

    這是代碼。請幫助球員 #include <GL/glut.h> #include <iostream> #include <math.h> #include "SOIL.h" using namespace std; GLuint texture[1]; int LoadGLTextures() { texture[0] = SOIL_load_OGL_texture

    0熱度

    1回答

    我有一個1000x1000像素的屏幕尺寸,我試圖獲得opengl座標。我明白了OpenGL的座標系如下: (-1,1) | (1,1) | --------(0,0)------- | | (-1,-1) | (1,-1) void mouse(int btn, int state, int x, int y){ float mx =