opengl

fixing glCopyTexSubImage2D upside down textures

Since I've started learning about rendering to a texture I grew to understand that glCopyTexSubImage2D() will copy the designated portion of the screen upside down. I tried a couple of simple things that came to mind in order to prevent/work around this but couldn't find an elegant solution. there are two problems with doing a ::glScal...

Suggest a Game Idea for my 3D World

Been creating a 3D complete world in OpenGL. For now, it features navigation like Google Earth, making possible the zooming from outter space to meter like level. My question is: How do you suggest I make this a fun and interesting game? My initial tought was to have a kind of moon lander where the user simply navigated the lander arou...

How to magnify/stretch a texture with Matlab Psychtoolbox (OpenGL)?

Update: This only seems to be a problem at some computers. The normal, intuitive code seems to work fine one my home computer, but the computer at work has trouble. Home computer: (no problems) Windows XP Professional SP3 AMD Athlon 64 X2 3800+ Dual Core 2.0 GHz NVIDIA GeForce 7800 GT 2 GB RAM Work computer: (this question applies t...

C With OpenGL and GLFW questions (Mainly a C question)

I am trying to build an application to simulate some basic spheres moving around for this assignment I have got. I am relatively new to C but I have been using .NET and java for some time. The problem that i am facing is that it doesn't look like the data is being assigned to the array outside of the init statement when i actually need...

Should I call glEnable and glDisable every time I draw something?

How often should I call OpenGL functions like glEnable() or glEnableClientState() and their corresponding glDisable counterparts? Are they meant to be called once at the beginning of the application, or should I keep them disabled and only enable those features I immediately need for drawing something? Is there a performance difference? ...

OpenGL: ShadowMapping: Shadows only visible at y=0

hello, i have implemented shadowmapping with an FBO and GLSL. it is used on a heightfield. that is some objects (trees, plants, ...) cast shadows on the heightfield. the problem i have, is that the shadows are only visible on the ground of the heightfield. that is, where the heightfield's height = 0. as soon as there is some height invo...

Moving particles in C

I want to be able to move a particle in a straight line within a 3D environment but I can't think how to work out the next location based on two points within a 3D space? I have created a struct which represents a particle which has a location and a next location? Would this be suitable to work out the next location to move too? I know ...

hi.. help needed in creating Buttons and Icons in open gl

hi.. i m trying to make an editor using Open GL.. similar to MS paint you can say, with a panel and all.. problem is i m not able to find material on how to create Buttons and icons.. P.S - i did find out about GLUI that provides such entities.. but i am not allowed to use anythiing other than GLUT.. Source code, if provided, will be...

How do I tell if a button is being held down in OpenGL/Glut? (linux)

This is a similar problem: Link Which was solved by calling GetAsyncKeyState(). While all fine and dandy, I need a Linux alternative. I need to know if a button is being held down, not just being pressed (because of the keyboard buffer delay). Does anything like this exist in the OpenGL/Glut libraries, or will I have to look elsewhere? ...

OpenGL Collision Detection

I am currently working on designing my first FPS game using JOGL. (Java bindings for OpenGL). So far I have been able to generate the 'world' (a series of cubes), and a player model. I have the collision detection between the player and the cubes working great. Now I am trying to add in the guns. I have the gun models drawn correctly a...

Unflip wxImage loading

I have the code here working fine except that all the non-power of 2 images are flipped in the y direction. In the wxImageLoader file there is this loop which I believe is the culprit: for(int y=0; y<newHeight; y++) { for(int x=0; x<newWidth; x++) { if( x<(*imageWidth) && y<(*imageHeight) ){ imageData[(x+y*newWidth)*bytes...

How to start writing a music visualizer in C++?

Hi, I'm interested in learning to use OpenGL and I had the idea of writing a music visualizer. Can anyone give me some pointers of what elements I'll need and how I should go about learning to do this? ...

Render PyCairo onto PyOpenGL surface?

I've recently started playing with pycairo - is it easy enough to render this to an pyopengl surface (e.g. on the side of a cube?)... my opengl is really non-existant so I'm not sure the best way to go about this. ...

OpenGL - Unable to render colors other than white after texture mapping.

Hi, I'm trying to render a colored cube after rendering other cubes that have textures. I have multiple "Drawer" objects that conform to the Drawer interface, and I pass each a reference to the GL object to the draw( final GL gl ) method of each individual implementing class. However, no matter what I do, I seem unable to render a color...

SDL_surface to OpenGL texture

Hey, I have this script to load a SDL_Surface and save it as a OpenGL texture: typedef GLuint texture; texture load_texture(std::string fname){ SDL_Surface *tex_surf = IMG_Load(fname.c_str()); if(!tex_surf){ return 0; } texture ret; glGenTextures(1, &ret); glBindTexture(GL_TEXTURE_2D, ret); glTexImage2D(GL_TEXTURE_2D, 0, 3, te...

OpenGL Screen Transitions Effects?

Hello! Anyone familiar with resources or sample source code that demonstrates screen/page transition effects using plain OpenGL? (Preferably C/C++ and not using QT). Thanks. ...

Setting up OpenGL with C++ and Visual Studio 2008

Hey I was wondering if there are any good tutorial out there on how to set this up? I have seen the NeHe tutorials from gamedev.net but some of them seem to be out dated... any clues? thanks ...

OpenGL to OpenGL-ES - glRectf()

I am trying to learn OpenGL on the iPhone using the "Super Bible" but am having trouble porting from OpenGLto OpenGL ES. My understanding is that the glRectf() function is not available in the latter. What is the substitute approach? Any relevant conceptual information would be appreciated as well. ...

How do I save/export an OpenGL surface into Quicktime in Cocoa/Objective C?

i've modified the quartz composer slideshow sample from xcode to render a high speed slide show using a custom transition. The sample uses OpenGL (Cocoa) to render the slide show. I would like to export this slideshow into a video. Is there a way to use Cocoa/OpenGL to output this scene into a quicktime video? OR, should I just reimpl...

OpenGL to OpenGL-ES - glBegin();

I am trying to learn to write OpenGL apps for the iPhone. How can I port the following code to work with OpenGL-ES? I know that I must store the vertices in an array and then call glDrawArrays(), but is there an optimal way to do this? My thought is to create a very large array and simply keep a counter of how many spaces are filled. Thi...