opengl

How to write a Cocoa OpenGL app in C++?

I'm writing an application that needs to use OpenGL, on the Mac, in C++. Is there anyway I can get Cocoa to just give me an OpenGL context and let me do my work in C++? (I want my app to run on both Mac OS X and iPHone; but all the GUI is in OpenGL, I just need a OpenGL context). Thanks! ...

Error when starting GLUT app when compiled for 64 bit

I have the bare bones of a GLUT app. When I compile it for Win32 it works fine, but if I compile it for x64 I get this error: The application was unable to start correctly (0xc000007b). Click OK to close the application. I have glut64.lib as an input for the Linker, which comes from the nVidia CUDA sdk at "C:\ProgramData\NVIDIA Corp...

Creating a proper Android Splash/Loading screen

I have an application that uses OpenGL on a GLSurfaceView. The problem is that the initial load takes quite a while processing textures and getting things ready. What i want to do is have a simple PNG displayed (with a slight animation) while the GLSurfaceView is getting ready. As soon as it's ready to render, i would like to tear down ...

Transparent FrameBuffer background in OpenGL

I want to use glClear and glClearColor to fill a frame buffer with a colour including alpha transparency. However the framebuffer always renders as opaque when binded to a texture which is rendered to the screen. I want everything which is rendered to the framebuffer to kept their transparency. I just want to change the background. See...

OpenGL Threaded Tile Texture Loading with Qt 4.5 / 4.6

Hi, I am trying to develop am map application for scientific purposes at my university. Therefor I got access to a lot of tiles (256x256). I can access them and save them to an QImage in a seperate QThread. My Problem is, how can I actually manage to load the QImage into a texture within the seperate QThread (not the GUI main thread)? Or...

How to transform back-facing vertices in GLSL when creating a shadow volume

I'm writing a game using OpenGL and I am trying to implement shadow volumes. I want to construct the shadow volume of a model on the GPU via a vertex shader. To that end, I represent the model with a VBO where: Vertices are duplicated such that each triangle has its own unique three vertices Each vertex has the normal of its triangle...

hardware acceleration / performance and linkage of different macosx graphics apis, frameworks and layers

the more i read about the different type of views/context/rendering backends, the more i get confused. regarding to http://en.wikipedia.org/wiki/Quartz_%28graphics_layer%29 MacOSX offers Quartz (Extreme) as a render-backend which itself is part of Core Graphics. in the Apple docs and in some books too they say that in any case somehow y...

First time ever creating a Terrain

First night at taking a look at different ways to create Terrain. I'm wanting to work on a racing project and was wondering if there was a way to create a 3D race track some how. We plan on using C++, and are also using PhysX and openGL. Where should I be looking for creating Terrain? Also, does anyone know of some good Tutorials/Tips ...

load .model file in C++

I am working on a opengl project in C++. I need to write a loader to input features from a .model file. It seems fstream can not handle that. Any comment or advice? Thanks. ...

OpenGL: GL_LINE_SMOOTH not supported on all cards; wont even draw the lines, unless...

First of all, whats the purpose of this code? glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); I could put there GL_DONT_CARE but it doesnt make my lines drawn, unless i use glDisable(GL_LINE_SMOOTH) So im asking if theres some built in mechanism to make it draw the lines even if the smooth lines arent supported (So it would draw them withou...

Inconsistent SDL/OpenGL results?

I have this little SDL/OpenGL game that I am working on. It runs great, but only on one computer. If I compile it and run it on my desktop, it just pops up a blank screen. If I run it on my netbook, it works just fine and I am able to see what I am trying to render. My question is: What could be causing these inconsistent rendering resul...

How to create a class to wrap OpenGL drawing for a game

I'm writing a game for school in OpenGL. Since there will be several more similar assignments I want to make a small framework for doing common things in OpenGL. I have made a few simple games before and I usually break it down into an IO class to handle input and drawing to the screen, Game class for the main game loop/logic, and classe...

Grab Mac OS Screen using GL_RGB format

Hi, I'm using the glgrab code to try and grab a full-screen screenshot of the Mac screen. However, I want the bitmap data to be in the GL_RGB format. That is, each pixel should be in the format: 0x00RRGGBB The original code specified the GL_BGRA format. However, changing that to GL_RGB gives me a completely blank result. The total sou...

Switching between fullscreen and windowed in Mac OS X

I have a project in the works with OpenGL and SDL. Users have the option of using a full-screen or windowed mode for the display. I use SDL_SetVideoMode to set up the window, but this solution destroys the original SDL_Surface context (so all my OpenGL textures get cleaned too). How can I correctly switch between full-screen and window...

Alpha masks with OpenGL

I want to use an alpha mask in OpenGL so that white(1)=visible and black(0)=hidden. So what I do is I write something in the alpha component of the framebuffer using glColorMask(False, False, False, True) (I'm using python, you see) and then draw some geometry above it using blending. But it isn't working: I tried filling the alpha buf...

Seeking advice on using QGLWidget in Qt4

Hi all, I'm new here, and have a question about opengl in Qt4, which I've been learning over the last few months. Particularly, I'm seeking advice on the best way to compose a scene in a good object-oriented fashion using the QGLWidget. I'd ideally like every item in my scene to be sub-classes of a super 'Entity' class. Then in my main...

Tools/Resources to Convert DirectX Code to OpenGL

Are there any tools and/or documentation providing a mapping from DirectX to OpenGL? If you had to do a conversion, how would you approach it and what would you use? I know that ATI Technologies provides HLSL2GLSL, but my understanding is that this is just for shader languages and not a full coverage of the APIs. ...

opengl: glFlush() vs. glFinish()

I'm having trouble distinguishing the practical difference between calling glFlush() and glFinish(). The docs say that glFlush() and glFinish() will push all buffered operations to opengl so that one can be assured they will all be executed, the difference being that glFlush() returns immediately where as glFinish() blocks until all the...

Is it possible to achieve MAX(As,Ad) openGL blending?

I am working on a game where I want to create shadows under a series of sprites on a grid. The shadows are larger than the sprites themselves and the sprites are animated (i.e. move and rotate). I cannot simply render them into the sprite png, or the shadows will overlap adjacent sprites. I also cannot simply put shadows on a lower la...

Getting screenshot of a child window running OpenGL in it (Windows)

I have a main window with children. I need to take screenshots programmatically to crop and draw them back on my main window. The way I do this is: HDC hDC = GetWindowDC(hWnd); HDC memDC = CreateCompatibleDC(hDC); HBITMAP memBM = CreateCompatibleBitmap(hDC, Width, Height); HBITMAP OldBM = (HBITMAP)::SelectObject(memDC, memBM ); BitBlt(m...