小编Nat*_*amm的帖子

在 OpenGL 4.5 中对盒子进行纹理处理 -(不起作用)

我画了一个盒子。我添加了处理 vao 和 vbo 的基本类。

class BasicObject_V2
{
public:
    BasicObject_V2(GLuint typeOfPrimitives = 0){
        this->typeOfPrimitives = typeOfPrimitives;
        switch (this->typeOfPrimitives){
            case GL_QUADS: numVertsPerPrimitive = 4; break;
}}
void allocateMemory(){
        glGenVertexArrays(1, &vaoID);
        glBindVertexArray(vaoID);

        glGenBuffers(1, &vboID);
        glBindBuffer(GL_ARRAY_BUFFER, vboID);

        glBufferData(GL_ARRAY_BUFFER, vertices.size() * sizeof(vertexAttributes), &vertices[0], GL_STATIC_DRAW);

        glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 48, (const void*)0);
        glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 48, (const void*)12);
        glVertexAttribPointer(2, 4, GL_FLOAT, GL_FALSE, 48, (const void*)24);
        glVertexAttribPointer(3, 2, GL_FLOAT, GL_FALSE, 48, (const void*)40);

        glEnableVertexAttribArray(0);
        glEnableVertexAttribArray(1);
        glEnableVertexAttribArray(2);
        glEnableVertexAttribArray(3);
    }

    GLuint vboID;
    GLuint vaoID;
    GLuint typeOfPrimitives;
    GLuint …
Run Code Online (Sandbox Code Playgroud)

c++ opengl

-1
推荐指数
1
解决办法
1099
查看次数

C程序 - 在linux下工作; Windows中的运行时故障

我用C做了一个电话簿程序(带有dinamical结构等).

它在linux下完美运行但是当我尝试在Windows中运行它(在devc ++中编译之后)它启动正常但是在我向列表中添加一些数据之后它就停止并退出.这只是通过向电话簿添加新数据而发生的.当我使用其他功能时,没有中断等等.

在我附加的模块的开头windows.hconio.hfor getch()systen("cls").也许我使用了Windows中不允许的某些功能或像这样的smth.

这是我的第一个c项目,通常我在linux上工作,那么我该怎么做呢?

/*SCREEN*/
#ifdef __WIN32__                                           /*for Windows*/
#include<windows.h>
#define GETCH printf("press ENTER...\n");getch() 
#define CLEAR system("cls")
#endif
#ifdef __unix__                                             /*for unix*/
#include<unistd.h> 
#define GETCH printf("\n\npress ENTER...");getchar()
#define CLEAR system("clear")
#endif
Run Code Online (Sandbox Code Playgroud)

我也以同样的方式添加名称和pnonenumber

printf("++ ADD DATA: ++\n");
         /*LASTNAME*/
                 printf(">> add lastname :  ");
                 fgets(buf,128,stdin);
                 lastname = malloc(strlen(buf));     /*allocate memory for lastdane*/ 
                 if( lastname != NULL)               /*successful allocation*/
                 {
                   strcpy( lastname, buf ); …
Run Code Online (Sandbox Code Playgroud)

c linux windows

-2
推荐指数
1
解决办法
211
查看次数

标签 统计

c ×1

c++ ×1

linux ×1

opengl ×1

windows ×1