glut

Drawing many spheres in OpenGL

折月煮酒 提交于 2019-11-28 21:42:41
问题 I want to draw many spheres (~100k) using OpenGL. So far, I'm doing something like for (int i=0; i<pnum; i++){ glPushMatrix(); glTranslatef(bpos[i].x, bpos[i].y, bpos[i].z); glCallList(DListSPHERE); glPopMatrix(); } Before using proper spheres, I used GL_POINTS . That allowed me to call glDrawArrays with an array containing all points which was very efficient. Is there a better way than the above code to draw many, identical objects? 回答1: Have a look at this page on instancing: it contains

xcode 5 deprecation warning about glut functions

核能气质少年 提交于 2019-11-28 18:47:16
I just upgrade my mac os x 10.6.8 to 10.9 this morning. Everything goes fine except the Xcode 5 with OpenGL Glut APIs. Whenever I run my program involving glut functions, I got 30 deprecation warns, like: 'gluErrorString' is deprecated: first deprecated in OS X 10.9. 'glutBitmapCharacter' is deprecated: first deprecated in OS X 10.9. 'glutSwapBuffers' is deprecated: first deprecated in OS X 10.9. 'glutDisplayFunc' is deprecated: first deprecated in OS X 10.9. 'glutIdelFunc' is deprecated: first deprecated in OS X 10.9. ... Change "OS X Deployment Target" back to OSX10.8, then it works. Hope

Difference between OpenGL files glew.h and gl.h/glu.h

删除回忆录丶 提交于 2019-11-28 16:54:32
I've built an OpenGL program with my glu and gl header files default included in windows 7 professional edition. Now, I've bought a book that describes OpenGL game development. The author of this book said, I have to include the glew header into my project. After I've done this I got some unresolved external symbol errors. So, now I'm really confused. I've worked earlier with glBegin and glEnd statements in my program. Now I've to work with glBindBuffers and glGenBuffer etcetera, but I get the unresolved external symbol errors, like that: 1>cWindows.obj : error LNK2001: unresolved external

OpenGL and GLUT in Eclipse on OS X

穿精又带淫゛_ 提交于 2019-11-28 12:11:21
I have been trying to setup the OpenGL and GLUT libraries in Eclipse, with CDT, on OS X with not very much success. I cannot seem to get eclipse to actually realize where GLUT is. It is currently giving me the error that I have an unresolved inclusion GL/glut.h. Looking around online I found that I should be using the -framework GLUT flag in the gcc linker settings, but this seems ineffective. Derek Litz Ok. I got it working in X11. The reason I could only get it working on X11 is because it seems the OpenGL libs on the OS are for the 64-bit architecture, but eclipse will only compile code if

OpenGL - Mouse coordinates to Space coordinates [closed]

旧巷老猫 提交于 2019-11-28 10:38:09
My goal is to place a sphere right at where the mouse is pointing (with Z-coord as 0). I saw this question but I didn't yet understand the MVP matrices concept, so I researched a bit, and now I have two questions: How to create a view matrix from the camera settings such as the lookup, eye and up vector? I also read this tutorial about several camera types and this one for webgl . I still can put it all together I don't know how to get the projection matrix also... What steps should I do to implement all of this? In a rendering, each mesh of the scene usually is transformed by the model matrix

Error with GLUT compile in ubuntu [duplicate]

吃可爱长大的小学妹 提交于 2019-11-28 08:21:37
This question already has an answer here: What is an undefined reference/unresolved external symbol error and how do I fix it? 33 answers I try to compile some "hello world" glut application: #include <stdlib.h> #include <GL/gl.h> #include <GL/glu.h> #include <GL/glut.h> GLint Width = 512, Height = 512; const int CubeSize = 200; void Display(void) { int left, right, top, bottom; left = (Width - CubeSize) / 2; right = left + CubeSize; bottom = (Height - CubeSize) / 2; top = bottom + CubeSize; glClearColor(0, 0, 0, 1); glClear(GL_COLOR_BUFFER_BIT); glColor3ub(255,0,0); glBegin(GL_QUADS);

Cmake link library target link error

本小妞迷上赌 提交于 2019-11-28 07:23:24
Hi I have problem with linkg Glfw and other libraries using cmake. From command line i compile like this g++ main.cpp -lGL -lGLU -lGLEW -lglfw But I wanted to use cmake for compiling. I tried to use target_linkg_libraries but this produce error CMake Error at CMakeLists.txt:18 (target_link_libraries): Cannot specify link libraries for target "GL" which is not built by this project. I tried do this using add definitions. I dont see error but this don't link libraries. cmake_minimum_required (VERSION 2.6) project (test) find_package(OpenGL REQUIRED) find_package(GLEW REQUIRED) ADD_DEFINITIONS(

openGL中的gl,glu,glut

…衆ロ難τιáo~ 提交于 2019-11-28 07:10:23
OpenGL函数库相关的API有核心库(gl)、实用库(glu)、辅助库(aux)、实用工具库(glut)、窗口库(glx、agl、wgl)和扩展函数库等。gl是核心,glu是对gl的部分封装。glx、agl、wgl 是针对不同窗口系统的函数。glut是为跨平台的OpenGL程序的工具包,比aux功能强大。扩展函数库是硬件厂商为实现硬件更新利用OpenGL的扩展机制开发的函数。下面逐一对这些库进行详细介绍。 (glut是基本的窗口界面,是独立于gl和glu的,如果不喜欢用glut可以用MFC和Win32窗口等代替,但是glut是跨平台的,这就保证了我们编出的程序是跨平台的,如果用MFC或者Win32只能在windows操作系统上使用。选择OpenGL的一个很大原因就是因为它的跨平台性,所以我们可以尽量的使用glut库。) 1.GL OpenGL核心库 核心库包含有115个函数,函数名的前缀为gl。 这部分函数用于常规的、核心的图形处理。此函数由gl.dll来负责解释执行。由于许多函数可以接收不同参数,根据参数的类型,可以派生出来的函数原形多达300多个。核心库中的函数主要可以分为以下几类函数。 绘制基本几何图元的函数。如绘制图元的函数glBegain()、glEnd()、glNormal*()、glVertex*()。 矩阵操作、几何变换和投影变换的函数

Faces missing when drawing icosahedron in OpenGL following code in redBook

此生再无相见时 提交于 2019-11-28 07:03:40
问题 I am attempting to draw an icosahedron following this popular OpenGl tutorial in the redBook. I am using GLUT to handle windowing. Here is my complete code. It is mostly the code from the tutorial plus some clerical work using GLUT #include <stdio.h> #include <GL/glut.h> #define X .525731112119133606 #define Z .850650808352039932 void mouseEventHandler(int button, int state, int x, int y){ } void display() { glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); static GLfloat vdata[12][3] = { {-X,0.0,Z

How to apply texture to glutSolidCube

倾然丶 夕夏残阳落幕 提交于 2019-11-28 06:56:30
I can find tutorials about mapping textures to polygons specifying vertices etc. but nothing regarding how to apply a texture to a cube (or other stuff) drawn with glut (glutSolidCube). I am doing something like: glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, decal); glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, repeat); glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, repeat); glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, nearest); glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, nearest); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glTexImage2D(GL_TEXTURE_2D, 0, 4,