小编fun*_*son的帖子

在ubuntu 10.10中编译和运行OpenGL(过剩)程序

我写了这段代码:

#include <stdio.h>
#include <stdlib.h>
#include <GL/glx.h>    
#include <GL/gl.h>
#include <GL/glut.h>


void init()
{
    glClearColor(1.0,1.0,1.0,0.0);
    glMatrixMode(GL_PROJECTION);
    gluOrtho2D(0.0,200.0,0.0,150.0);
 }

 void lineSegment()
 {
    glClear(GL_COLOR_BUFFER_BIT);
    glColor3f(0.0,0.0,1.0);
        glBegin(GL_TRIANGLES);
            glVertex2i(40,120);
            glVertex2i(40,20);
            glVertex2i(80,20);
        glEnd();
    glFlush();
 }
 int main()
 {
    glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
    glutInitWindowPosition(50,100);
    glutInitWindowSize(400,300);
    glutCreateWindow("An Example OpenGL....");
    init();
    glutDisplayFunc(lineSegment);
    glutMainLoop();
    return 0;
 }
Run Code Online (Sandbox Code Playgroud)

这是我的错误.

funfullson@funfullson:~$ gcc gl.cpp 
/tmp/cchfRGT2.o: In function `init()':
gl.cpp:(.text+0x2a): undefined reference to `glClearColor'
gl.cpp:(.text+0x36): undefined reference to `glMatrixMode'
gl.cpp:(.text+0x5a): undefined reference to `gluOrtho2D'
/tmp/cchfRGT2.o: In function `lineSegment()':
gl.cpp:(.text+0x6e): undefined reference to `glClear'
gl.cpp:(.text+0x8d): undefined reference …
Run Code Online (Sandbox Code Playgroud)

opengl

5
推荐指数
2
解决办法
3万
查看次数

在Visual Studio 2010 C#中发布代码

我用Visual Studio 2010在C#中编写了一个程序,现在需要确保我的程序可以在任何具有XP或7或vista windows版本的系统上运行.我在我的项目中使用.net和directX.如何在启动时使用安装程序压缩它?

c#

0
推荐指数
1
解决办法
57
查看次数

标签 统计

c# ×1

opengl ×1