小编Mar*_*ala的帖子

使用顶点数组对象渲染三角形不显示任何内容(OpenGL)

我使用OpenGL 3.2,GLFW和GLEW.我尝试在OS X(10.8.2)上使用VAO和简单着色器渲染简单的三角形,但没有显示,只有白色屏幕.着色器编译好了,GLEW就好了,glGetString(GL_VERSION)显示3.2,试图在每一行之后放置glGetError,它没有报告任何错误.我不知道我做错了什么.这是代码:

#include "include/GL/glew.h"
#include "include/GL/glfw.h"
#include <cstdlib>
#include <iostream>

GLuint program;

char *textFileRead(char *fn) {


    FILE *fp;
    char *content = NULL;

    int count=0;

    if (fn != NULL) {
        fp = fopen(fn,"rt");

        if (fp != NULL) {

      fseek(fp, 0, SEEK_END);
      count = ftell(fp);
      rewind(fp);

            if (count > 0) {
                content = (char *)malloc(sizeof(char) * (count+1));
                count = fread(content,sizeof(char),count,fp);
                content[count] = '\0';
            }
            fclose(fp);
        }
    }
    return content;
}


void checkCompilationStatus(GLuint s) {
    GLint status = 0;

    glGetShaderiv(s, GL_COMPILE_STATUS, &status); …
Run Code Online (Sandbox Code Playgroud)

c++ opengl glew glsl glfw

4
推荐指数
1
解决办法
795
查看次数

标签 统计

c++ ×1

glew ×1

glfw ×1

glsl ×1

opengl ×1