opengl

3d model to fit in viewport

How does a 3D model handled unit wise ? When i have a random model that i want to fit in my view port i dunno if it is too big or not, if i need to translate it to be in the middle... I think a 3d object might have it's own origine. ...

OpenGL graphics program..

I got stuck with displaying multiple windows in openGL... That is if i display two windows, tranformation is not possible in both the windows... Is there any other way i can do it..??? ...

How do OpenGL contexts and device contexts work?

I'm new to U/I programming, and I'm trying to get started with OpenGL. When I run an example program which creates a new OpenGL window with GLUT, it works fine. Good. However, in the context of another program, where I have to respond to Draw events (on Windows), with a device context passed to me - and where I might not have GLUT ava...

OpenGL programming within a program already using OpenGL ?

Given that I am programming within another program already using OpenGL (let's say theoretically that I have no idea how they are using it). Can I just set up my context however I want and push/pop it from the stack and all should work as expected, or MUST I know how my (calling) program is using OpenGL in order to avoid accidentally sc...

Initializing OpenGL without GLUT

Hi, every introduction and sample that I can find seems to use GLUT or some other framework to "initialize" OpenGL. Is there a way of initializing OpenGL with just what is available in GL and GLU? If not, then what is GLUT doing that is not possible without it? ...

Is it possible to use OpenGL in a window that is already using GDI+ ?

Basically I am being called to render to an offscreen DC which is set up (I'm not sure how) to use GDI+. When I try to associate an OpenGL context with the DC, it just fails (i.e. returns zero but no error). SetPixelFormat also fails (probably because it is already set up?), again by returning zero, not an error. Anyone know whether i...

GLSL fragment shader newb question

the following simple fragment shader code fails, leaving me with an uninformative message in the log (ERROR: 0:1: 'gl_Color' : syntax error syntax error): void main() { vec4 myOutputColor(gl_Color); gl_FragColor = myOutputColor; } while the following one works: void main() { glFragColor = gl_Color; } This boggles my mind, as ...

how do i setup Borland C++ for OpenGL?

I am new to OpenGL. I want to setup my Borland c++ for openGL on Windows XP SP2. When I include windows.h or GL/glut.h I get "error: directory not found." I tried to include windows.h by using quotes as well as the angled brackets. How do I setup my PC for OpenGL application development? ...

C++ OpenGL application as a web service

Dear all, Let me explain the situation: we have created an OpenGL application in C++ which visualizes some physical simulations. The basic application is contained within a DLL which is used by a simple GUI. It currently runs on a desktop PC, but we have the idea to turn it into a web service. Since the simulations require dedicated h...

GLSL: enabling/disabling texturing + shaders

I'm looking for a way to access OpenGL states from a shader. The GLSL Quick Reference Guide, an awesome resource, couldn't really help me out on this one. In the example I'm working on I have the two following shaders: Vertex: void main() { gl_FrontColor = gl_Color; gl_TexCoord[0] = gl_MultiTexCoord0; gl_Position = ftra...

How do I apply a colour transformation matrix to a texture in OpenGL

Basically, I've got a colour matrix defined as such: struct ColourXForm { float4 mul; float4 add; float4 Transform(float4 colour) { return float4( colour.x * mul.x + add.x, colour.y * mul.y + add.y, colour.z * mul.z + add.z, colour.w * mul.w + add.w); } } What I want to do is to...

Cannot make VW34 (Oxford Active Vision Lab libraries) in Ubuntu 8.0.4

I'm trying to make a pretty obscure app called VW34 which is a computer vision library that uses openGL. I'm getting an error during make after most of the app compiles successfully "GeomObjects/point3d.cpp:88: error: ‘VW::Point3D VW::operator+(const VW::Point3D&, const VW::Point3D&)’ should have been declared inside ‘VW’" . Supposedly ...

How to batch same square in a single glVertexPointer

I've read that to optimize drawing, one can draw a set of figures using the same texture in one pass. But how do i connect my singles square together to form one figure to send to glVertexPointer. (read in PowerVR MBX.3D Application Development Recommendations.1.0.67a - page 5) ...

OpenGL - Copy texture from screen smaller than that screen.

I'm trying to capture the screen to a texture with a lower resolution than the screen itself (to render back onto the screen and create a blur/bloom effect), and it doesn't work quite well. I understand mipmaps can be used to do this, but I just can't get the correct sequence of commands to work. My current code: width=1024; height=102...

What is the minimum boilerplate code for a OpenGL 2D View?

What's the minimum boilerplate code required to setup an OpenGL view (with the necessary projections,camera angles etc) for drawing a 2D game? For example, the minimum required to do Quartz 2D drawing in a custom view (and, say, load a background image) is the following: #import <Cocoa/Cocoa.h> @interface MyView : NSView { } @end =...

Alpha transparency with particle effects in OpenGL

I have a simple particle effect in OpenGL using GL_POINTS. The following is called, being passed particles in order from the particle furthest from the camera first to the one nearest the camera last: void draw_particle(particle* part) { /* The following is how the distance is calculated when ordering. * GLfloat distance = sqrt...

Point-triangle intersection in 3d from mouse coordinates?

I know how to test intersection between a point and a triangle. ...But i dont get it, how i can move the starting position of the point onto the screen plane precisely by using my mouse coordinates, so the point angle should change depending on where mouse cursor is on the screen, also this should work perfectly no matter which perspect...

Why is stack getting overflowed in this code?

Hi, I wrote this function for filling closed loop, pixvali is declared globally to store the color value of the pixel where the first click will be done (inside the closed loop). But the problem is that this recursion doesn't terminate when its first fill(..,..)get over, and it says stack is overflowed... void fill(int x,int y) { G...

Is it possible to use OpenGL point sprites to simulate billboard sprites?

I was trying to set point sprites in OpenGL to change size with distance just as a billboarded sprite would, but I can't get the values in GL_POINT_DISTANCE_ATTENUATION_ARB to do anything useful. Is there a correlation of values to this that would match a given projection? Is what I'm trying to do even possible? Render code being used: ...

What's the purpose of glNormal3f in OpenGL ES?

What's the purpose of glNormal3f in OpenGL ES? If there is no immediate mode available in OpenGL ES, for what would I use glNormal3f? Example code would be nice. ...