opengl

Python OpenGL module - can't render basic triangle

I'm trying to use the OpenGL module with Python. Here is my source: pygame.init() screen = pygame.display.set_mode((800, 600), HWSURFACE|OPENGL|DOUBLEBUF) def init(): glEnable(GL_DEPTH_TEST) glShadeModel(GL_FLAT) glClearColor(1.0, 1.0, 1.0, 0.0) glEnable(GL_COLOR_MATERIAL) glEnable(GL_LIGHTI...

How i can calculate 2d bounding box with 3d transformation

I'm working on opengl project. I set up perspective projection and render a transformed rectangle (rotated, scaled) How i can calculate rectangle's bounding box (rectangle position,size) Thank you ...

Use stl vectors to manage opengl buffer objects

I don't think I am the first one to think about this ... but would it be possible to write a STL allocator that manages VRAM/Buffer Objects(BO) in OpenGL? As a result of this Question I currently use vectors to write to and read from BOs. Additionally i use some templating to map BOs as almost anything i like. Like this: TypedBufferO...

How to create static background image in OpenGL(GLUT) scene?

I create some scene, and i would like to display some static background image, which would not change from how and what I am doing with the scene. ...

Understanding 3D space

Hey Guys, I'm confusing myself terribly grasping the concept of plotting on a 3D plane, if I'm looking down the -Z axis, to put an objectinfront of me I just make the Z value Negative and to put it behind I just make it positive.. but.. how do I Put objects to my left or right? Sorry, I realise this is a stupid question but none the les...

changing GLUT calls to work with MFC/C++

I have a program that uses GLUT for its OpenGL rendering. Now I need it to be inside of a MFC project so that it can work with another program component. I've followed this tutorial: 1/Setting-Up-OpenGL-in-an-MFC-Control.htm">http://www.codeguru.com/cpp/g-m/opengl/openfaq/article.php/c10975_1/Setting-Up-OpenGL-in-an-MFC-Control.htm I ...

OpenGL: How to calculate the angle where my mouse is pointing at in the 3d space?

I only need to know which angle (x,y,z vector) my cursor is pointing at. So i can shoot any particle in the direction i am pointing at. I cant use depth testing, so the typical picking methods are not an option. Is this possible with pure math only? if i know the view port aspect ratio and perspective etc? Edit: I need to get the coor...

c++ opengl: can i calculate normals in gpu? If so, how?

Hiya. I have an opengl application that loads a dxf and draws it on the screen, each time i need to calculate normals. is there a way to calculate normals in GPU instead of CPU ? if so how ? ...

can OpenGL do this?

I'm making an application that draws shapes and I use a camera to draw in other places. Basically, let's say I have a 4x3 rectangle and would like to use glgetpixels to get all the pixels for something that is 1024x768, but my monitor might not support that resolution. How can I render something bigger than the monitor. I do this so I ca...

opengl matrix rotation quaternions

Im trying to do a simple rotation of a cube about the x and y axis: I want to always rotate the cube over the x axis by an amount x and rotate the cube over the yaxis by an amount y independent of the x axis rotation first i naively did : glRotatef(x,1,0,0); glRotatef(y,0,1,0); then but that first rotates over x then rotates over ...

Where can I download Source Code Of "OpenGL" ?

Where can I download Source Code Of "OpenGL" ? ...

What is the best implementations of OpenGL ?

What is the best implementations of OpenGL in C++ ? please compare them. PS. Take a look at Here ...

Fast nbody algorithms / solutions (with opengl/c++/??)

Dear reader, I'm working on a (c++, opengl) project where I need to have lots of particles which influence eachother, if I'm correct this is called a nbody problem. Does someone knows what solutions there are for algorithms like this. I know the barnes hut algorithm and maybe I can peek around openCL, though I'm not just wondering if y...

About the fate of malloc()ed arrays of arrays.

Hello everyone - my first question on Stackoverflow. Let me start with a bit of code. It's a bit repetitive so I'm going to cut out the parts I repeat for different arrays (feel free to ask for the others). However, please ignore the code in preference to answering the Qs at the bottom. Firstly: thank you to answerers in advance. Se...

KD-Tree in GLSL

Hi everybody, after one day of trying to figure out how to implement a kd-tree in OpenGL/GLSL i am pretty frustrated ... I declare my KD-Nodes like this in GLSL: layout(std140) uniform node{ ivec4 splitPoint; int dataPtr; } nodes[1024]; SplitPoint holds the kd-tree splitpoint, the fourth element of the vector holds the splitDire...

Can this be done with OpenGL?

I'm making a vector drawing application with OpenGL. Is there a way to implement a clipping mask? Ex: if I have Circle A and Circle B, I only want to see the part of circle B which intersects into Circle A's space. Is there a way to do this that isn't very expensif, I do not want to kill my application. Thanks ...

Subtractive blending with OpenGL?

I would like to for example draw shapes A, B, C then set the blender, then draw shape D and everywhere where shape D is, the scene shows my background color of (1,1,1,0). Thanks ...

Texturing a model

I have coded a 3d-terrain engine with simplistic model engine on top of it. I use a rectangular heightmap for my terrain, so texturing those triangles is pretty straightforward. However, on texturing my model i am a bit stuck. I use a custom model format, so answers like use blender or use 3ds will not be helpful. The reason for this...

how to pick up mouse in 3d world.

Hi, everyone, i have some questions about how to pick up mouse in 3d world. Now i have several points in 3d world,by using these points i can draw curve i want to choose a point on this curve using mouse, the viewport of the 3d world can be changed, so i want to know at any viewport when i chick mouse button near the curve, which po...

Opengl drawing in the center of the window

Hi all, I am started to deal with opengl. My application is written in Java using SWT as windowing system. Using http://lwjgl.org/ and SWT, I am able to use opengl in my SWT canvas. I wrote the following simple opengl code in my canvas paint listener: // clear to background color GL11.glClearColor(.3f, .5f, .8f, 1.0f); GL11.glClear(GL...