opengl

understanding this opengl code

I'm a Java programmer, learning opengl in C for the first time. I wanna dissect this simple code that my instructor gave me without much explanation: void renderScene (void) { glClear(GL_COLOR_BUFFER_BIT); glBegin(GL_TRIANGLES); glVertex3f(-0.5,-0.5,0.0); glVertex3f(0.5,0.0,0.0); glVertex3f(0.0,0.5,0.0); ...

OpenGL Glass HUD?

Hello I Would like to know how to make somthing that looks like "Glass" the example would be in the game called Pikmin. its in the HUD and i would like to know how to create somthing similar. I Am not trying to copy the game i just like how it looks. It looks like this: http://3.bp.blogspot.com/_CWor6UdXxBk/SbaZDWSF6VI/AAAAAAAAFCU/UQgB...

Resources on basics of 3D model rendering

Maybe I've missed something, but I couldn't find any questions about this already. If anyone knows of any then it would be great if you could post the links. I know there's loads of massive opensource engines out there already that it'd be really easy to use, it's not a problem of needing one, but I don't like not knowing how the things...

Is there an easy way to get shadows in OpenGL?

Hi, I recently created a landscape code which I full understand, and added some diffuse lighting to the scene. However to my disappointment there was no shadows. I looked around the web for hours, looking for ways to get shadows in OpenGL, however they all seemed terribly complicated; and very unique to their own demo programs. Is thei...

Why isn't Visual Studio allowing me to compile this Bresenham code?

I want to make this code run, but I'm still too much of a n00b on C, and OpenGL and VS 2008 to identify on which of them is the fault: #include <stdio.h> #include <stdlib.h> #include <GL/glut.h> #include<math.h> void init(void) { //set display-window background color to white glClearColor(1.0,1.0,1.0,0.0); //set projection paramaters...

develop c++ without Xcode IDE

I want to develop c++ programs on mac os and I have installed Xcode with a bunch of frameworks. However I would like to write code without Xcode IDE but just write my own makefile and directly compile/link with gcc (shipped with Xcode). Take a opengl program as example I tried to compile it with the command gcc -I/usr/include/ ...

What's #pragma comment (lib, "lib/glut32.lib")?

I saw the code on the top of a GLUT demo and I'm curious about its functionality. Why would someone want to write a #pragma instead of just including the library? ...

How to store OpenGL Primitives in a tree data structure in C++ ?

I'm new to OpenGL and C++. Say I start with a 2D square (on the very left) like shown in the picture below. I want to make it interactive with the glutKeyboardFunc() so when I press a number a new box will draw next to the corresponding edge. Figure the best way to do this is to have a tree structure that hold all the boxes. But I'm n...

opengl off screen rendering

Hi, I am using off screen rendering using opengl FBO and glut on a MAC OS X 10.6. The program involves movement of multiple 3D objects. The program seems to be working fine except that I am required to include an option where the off screen buffer contents are not swapped to the on screen buffer. Hence you do not see anything on the sc...

Getting a Virtual Trackball to work from any viewing angle.

Hi, I am currently trying to work on getting my virtual trackball to work from any angle. When I am looking at it from the z axis, it seems to work fine. I hold my mouse down, and move the mouse up... the rotation will move accordingly. Now, if I change my viewing angle / position of my camera and try to move my mouse. The rotation will...

VTK (visualization toolkit) versus OSG (OpenSceneGraph) , other?

Does anyone have experience to fairly compare VTK and OpenSceneGraph? I'm more familiar with VTK, but I'm curious as to whether anyone has tried both extensively. I have both built, 5.6 vtk and 2.9.9 osg, can run the examples... at first glance OSG seems more 'rough', but maybe that's OK. In particular I worry about being able to fidd...

How can binding a texture for a quad in OpenGL affect all the display ?

Hi, When I bind a specific texture for drawing a quad in OpenGL, it affects all the display : if I use a red BMP file, I see all the screen like if I was wearing red glasses (same for every color : in black I see very dark, in white everything looks almost OK). This is for texture-mapping fonts, which work well (currently I have only d...

Can't get Display List to Work

Hey all, First of all, as usual, thanks to all for the great support from the SO community. So I wrote code to draw 6 gl_quads (to form a cube). Initially, this code was drawn immediately (explicitly made 24 vertex calls in the display function). I'd like to put these in a display list. I read a tutorial about display lists, and gav...

Open-GL difficulties in linux

Hi, i have had this problem for 3-4 months. OpenGL codes do not run that good as they should in windows. I have a project that i need to run it in linux, with times, pipes, ... that use the Windows API. I need to migrate the code but it doesn't look good. For example they are flashing on the screen! is it from my graphics card on linux? ...

Segmentation fault when call an static library function from OpenGL

I have simple OpenGL C program (from NeHe lesson 2). There is initialization function InitGL. And i have function foo in my static library: void foo(double *p) { p[0] = 1.0; } When i define array of double at start of InitGL: double arr[1000]; and modify it in InitGL all works fine. When i allocate memory for this array dynam...

Resizing glut window

I'm doing 2D drawing in a glut window, and I'm having trouble making the window resize properly. My glutDisplayFunc and glutReshapeFunc are below. As it is, the drawing disappears when the window is resized. If I delete the glClear() from displayFunc(), new pixels don't "initialize" and there are clipping problems. How do I fix this?...

Countless warnings with SDL/OpenGL on OS X when dynamic graphics device switching is active

On Snow Leopard with a macbook pro that has two graphics devices the following error is printed to stderr multiple times a second: Wed Oct 6 02:35:27 nausicaa.local TestApp[92464] <Warning>: CGDisplayIsCaptured: Fixing up display ID 0x4272ec2 for offline mux head to 0x4272ec0 When I force the graphics device to be either Nvidia or In...

Repeating Textures in OpenGL

Hi i am quite new to OpenGL. My task is to implement the GDI brushes in OpenGL for drawing on MAC OS X. Thus I turned to textures in OpenGL to first draw the pattern and then this needs to be mapped to drawing primitives such as a polygon (rectangle a case in point). I am creating a 8x8 texels texture and then mapping it on a polygon ...

OpenGL config in Visual Studio 2010

Hey Guys, i would like to use OpenGl in Visual Studio 2010. Following Problem: "error LNK1104: Data "GIU32.lib OpenGL32.lib freeglut.lib glut32.lib" could not be oppend" I read many Tutorials but they don´t help me :-(. The lib data sets are in "C:\Program Files(x86)\Microsoft SDKs\Windows\v7.0a\lib". The header data sets are in "C:\...

Is there a CADisplayLink equivalent for macos/cocoa/opengl ?

I've discovered CADisplayLink for IOS 3.1+ which triggers events when the display has been refreshed, effectively allowing you to synchronise with display updates without having to use NSTimer. Is there an equivalent for timing when writing opengl applications under macos/cocoa? ...