glu

iPhone OpenGL : Using gluUnProject (port) and detecting clicking on an object

天大地大妈咪最大 提交于 2020-01-04 06:13:42
问题 please help, this is my 4th question about this, I trying so hard I tried everything! All I want to do is detect clicking on a object(cube) in a 3D World (3D world created). This does it http://blog.nova-box.com/2010/05/iphone-ray-picking-glunproject-sample.html but has a completely different app structure and does a lot with render buffers etc. I am trying to use using gluUnProject (someone has ported it). On touch CGPoint pos = [[touches anyObject] locationInView:self.view]; glGetIntegerv(

glTexImage2D vs. gluBuild2DMipmaps

浪子不回头ぞ 提交于 2020-01-02 08:13:28
问题 Very basic OpenGL texture creation code: int width, height; BYTE * data; FILE * file; // open texture data file = fopen( filename, "rb" ); if ( file == NULL ) return 0; // allocate buffer width = 256; height = 256; data =(BYTE*) malloc( width * height * 3 ); // read texture data fread( data, width * height * 3, 1, file ); fclose( file ); glGenTextures( 1, &texture ); glBindTexture( GL_TEXTURE_2D, texture ); //gluBuild2DMipmaps( GL_TEXTURE_2D, 3, width, height, GL_RGB, GL_UNSIGNED_BYTE, data )

gluProject Converting 3D coordinates to 2D coordinates does not convert the 2D Y Coordinate correctly

蹲街弑〆低调 提交于 2019-12-30 04:35:13
问题 After two hours of googling (here, here, here, here, and here, and a ton others which I am not bothered to find), I thought I had finally learnt the theory of turning 3D coordinates to 2D coordinates. But it isn't working. The idea is to translate the 3D coordinates of a ship to 2D coordinates on the screen to render the username of the player controlling that ship. However, the text is rendering in the wrong location: The text is "Test || 2DXCoordinate || 2DZCoordinate". Here is my

glPushMatrix Deprecated, GL30-GL43 Solution? Basic Box example

隐身守侯 提交于 2019-12-25 07:36:11
问题 I'm working on a Program to Render a basic box, but through googling, I have not found a solution for Drawing a face(or group of faces) on screen. Currently every tutorial I've found uses glPushMatrix/glBegin/glEnd/glPopMatrix like this GL11.glPushMatrix(); GL11.glRotatef(pit, 1, 0, 0); GL11.glRotatef(yaw, 0, 1, 0); GL11.glRotatef(rol, 0, 0, 1); GL11.glTranslatef(pos.x, pos.y, pos.z); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex3f(-1.0f, -1.0f, 1.0f); // Bottom Left Of The Quad GL11.glVertex3f(

Moving a drawing around in openGL with mouse

不想你离开。 提交于 2019-12-23 20:57:01
问题 I am trying to move an image around in openGL while holding left mouse button. i am NOT trying to drag an object around, just move the whole picture. Its a 2d drawing of a fractal and i was told that i can use gluortho2d but i can't find any info or similar tries on how to do it. I am assuming something like void mouse_callback_func(int button, int state, int x, int y) { if (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN) gluOrtho2D(x-250.0, x+250.0, y-250.0,y+250.); glutPostRedisplay(); }

How to draw connected strip lines in OpenGL like this

*爱你&永不变心* 提交于 2019-12-22 04:34:26
问题 I want to draw a series of connected lines (GL_LINE_STRIP) in following way. I had tried to code by my own, but not get desired result, so i come here, help me to find out where i was wrong. here i am giving only my draw() function. glBegin(GL_LINE_STRIP); glVertex2f(-4.00, 0.00); glVertex2f(-3.00, 2.00); glVertex2f(-2.00, 0.00); glVertex2f(-1.00, 2.00); glVertex2f(0.0, 0.00); glVertex2f(1.00, 2.00); glVertex2f(2.00, 0.00); glVertex2f(3.00, 2.00); glVertex2f(4.00, 0.00); glEnd(); 回答1: Workin'

gluCylinder with rotated texture

ぃ、小莉子 提交于 2019-12-13 04:55:49
问题 I want to draw a cylinder using gluQuadric and gluCylinder. This cylinder shall be textured. My draw code is the following: pTexture->Enable(); pTexture->Bind(); glPushMatrix(); glRotatef(-90.0f, 1.0f, 0.0f, 0.0f); gluQuadricOrientation(quadric, GLU_OUTSIDE); gluQuadricNormals(quadric, true); gluQuadricTexture(quadric, true); gluCylinder(quadric, getRadius(), getRadius(), getHeight(), 16, 1); glPopMatrix(); pTexture->Unbind(); pTexture->Disable(); My problem with this is now, that the texture

get mouse in world coordinates with 2 gluUnproject calls to create ray

£可爱£侵袭症+ 提交于 2019-12-13 01:23:15
问题 I try to use what many people seem to find a good way, I call gluUnproject 2 times with different z-values and then try to calculate the direction vector for the ray from these 2 vectors. I read this question and tried to use the structure there for my own code: glGetFloat(GL_MODELVIEW_MATRIX, modelBuffer); glGetFloat(GL_PROJECTION_MATRIX, projBuffer); glGetInteger(GL_VIEWPORT, viewBuffer); gluUnProject(mouseX, mouseY, 0.0f, modelBuffer, projBuffer, viewBuffer, startBuffer); gluUnProject

cmake doesn't link libGLU using QtOpenGL

孤者浪人 提交于 2019-12-12 19:42:22
问题 I'm trying to compile a software that uses QtOpenGL, but I got a link error because -lGLU is not present. cmake is used. The only relevant line in CMakeLists.txt files seems to me find_package(Qt4 REQUIRED) The system is Linux 64bit, Debian unstable, qt version 4.7.3, cmake version 2.8 回答1: GLU is neither part of OpenGL nor Qt. You must add it as an additional dependency manually; the CMake FindOpenGL module also searches for GLU % cmake --help-module FindOpenGL cmake version 2.8.1 FindOpenGL

how do i get rid of these compiler errors in glu.h?

好久不见. 提交于 2019-12-12 12:07:22
问题 trying to use this tutorial on 64-bit windows 8 with netbeans and cygwin 4.8.1. i get many errors like this: /usr/include/w32api/GL/glu.h:68:79: error: expected ‘)’ before ‘*’ token. on statements like this: void APIENTRY gluQuadricCallback(GLUquadric *qobj,GLenum which,void (CALLBACK *fn)()); the pointer on error message points to the * before the fn(). edit: including windef.h gets rid of the compiler error messages. i am left with a bunch of undefined references like: glfwInit edit2: using