opengl

How to change single texel in OpenGL texture

Hi ! I want to change the some texels in a OpenGL texture for a given location. Can anyone help me with this pls ? This is the functionnality that I want, void ChangeTexelColor(int x, int y, GLuint id, int texW, int texH, GLenum format) { //What is here ? } This will use to maintain the minimap of my game (if anyone have a ...

Converting a depth texture sample to a distance

I'm currently reading from a depth texture in a postprocess depth of field shader using the following GLSL code: vec4 depthSample = texture2D(sDepthTexture, tcScreen); float depth = depthSample.x * 255.0 / 256.0 + depthSample.y * 255.0 / 65536.0 + depthSample.z * 255.0 / 16777216.0; And then converting the ...

What are the major differences between making cool stuff with OpenGL ES VS making it with Flash?

I am digging into OpenGL ES on the iPhone, and I have still no big idea about OpenGL ES and Flash. About Flash I only know it is capable of making really nice animations and transitions. For best example, lets look at the Ocarina flute for the iPhone. This application makes some simple but powerful animations. It expands little circles ...

OpenGL texture combining not (always) working

If you've seen my last few questions you'd know by now that I've been working on terrain stuff with OpenGL. I had a failed attempt at using vertex alphas and multiple render passes to blend one texture into another in a tiled heightmap... So now instead, I've got another plan. My WorldQuad object has 'bottom' and 'top' variables, both o...

OpenGL texture base internal format to a shader

I am trying to mimic the behavior of OpenGL glTexEnv with a shader. It is quite complex function but should be doable. The only problem is that the function works differently depending on the texture base internal format. How can I get that information out of a texture? The texture base internal format is given with glTexImage2D function...

OpenGL stuff within NIB viewcontroller

Hi, I want to have 3d rotating cubes using openGL within a UIview created using a nib file. How do I do that? For example, in the ADDMUSIC sample code by apple. I want to have a 3D cube on the view page with message 'your application here'. How do I merge opengl code in the sample code. Any grandmaster here who can add a tweak of that ...

Qt: transparent QRubberBand?

I'm trying to draw a QRubberBand on a QGLWidget. For some reason the area of the rubber band is drawn as opaque and I don't see what's behind it. This kinda beats the purpose of the rubber band as a way to select stuff inside it. I've seen in docs for QStyleOptionRubberBand that there's an 'opaque' member but I have no idea how to access...

OpenGL Alpha blending with wrong color

I am trying to create a simple ray tracer. I have a perspective view which shows the rays visibly for debugging purposes. In my example screenshot below I have a single white sphere to be raytraced and a green sphere representing the eye. Rays are drawn as lines with glLineWidth(10.0f) If a ray misses the sphere it is given color glC...

How do you know which OpenGL functions need to be called every frame, and which can only be called once?

As the question states. The best example of this I have right now is the function glSelectBuffer. I'd like to know if I can call it just once in my init function or if I have to call it every single time, before I do glRenderMode(GL_SELECT). But just in general, there have been many times when I've wondered whether I can just call a func...

iPhone OpenGL fps test

Anyone can tell me how to get and display the fps (frame rate) of a running program on screen? ...

OpenGL iPhone Sprite Sheet

I have a sprite sheet of images of differnet width and height, which i have the coordinates to. I need to render only a specific sprite and is wondering how to go about doing it. Can anyone help me? ...

OpenGL: Help with camera transformation

I'm trying to implement a camera-model in Delphi/OpenGL after the description given in OpenGL SuperBible. The camera has a position, a forward vector and a up vector. Translating the camera seems to work OK, but when I try to rotate the camera according to the forward vector, I loose sight of my object. function TCamera.GetCameraOrienta...

OpenGL vs OpenGL ES 2.0 - Can an OpenGL Application Be Easily Ported?

I am working on a gaming framework of sorts, and am a newcomer to OpenGL. Most books seem to not give a terribly clear answer to this question, and I want to develop on my desktop using OpenGL, but execute the code in an OpenGL ES 2.0 environment. My question is twofold then: If I target my framework for OpenGL on the desktop, will i...

Signed Angle in 3D Vectors

This is a purely math question, I believe. I have a camera object in an arbitrary coordinate system. I have the direction vector of the camera, and I have a vector that points in the direction of north along the surface of the sphere. I wish to calculate the angle of the camera in regards to the north vector. Is there a simple way to c...

GLScene camera question

I have a GLScene object of varying, but known size. It is completely surrounded by a TGLDummyCube. I want to position the GLCamera (CameraStyle: glPerspective) so that the object is completely visible on screen. I got this running basically - the object is visible, but the distance is sometimes too far, or the object is larger than the ...

Bands of blank or improperly rendered scan lines using offscreen rendering with Frame Buffer Objects

I am doing offscreen tiled rendering of very large output images using FBOs. In order to have the best performance, I am trying to create the largest FBO (and thus tile size) that I can. To that end, I am using GL_MAX_RENDERBUFFER_SIZE_EXT to retrieve the maximum possible size and then reducing it so that my FBO does not fill more than 1...

How to get games' FPS (with OpenGL) to like 800 FPS

Hi! How can we run a OpenGL applications (say a games) in higher frame rate like 500 - 800 FPS ? For a example AOE 2 is running with more than 700 FPS (I know it is about DirectX). Eventhough I just clear buffers and swap buffers within the game loop, I can only get about 200 (max) FPS. I know that FPS isn't a good messurenment (and al...

How to create textures within GPU

Hi! Can anyone pls tell me how to use hardware memory to create textures in OpenGL ? Currently I'm running my game in window mode, do I need to switch to fullscreen to get the use of hardware ? If I can create textures in hardware, is there a limit for no of textures (other than the hardware memory) ? and then how can I cache my textu...

I need help on how to rotate an image with OpenGL using SDL

I'm making a game and the arm of the character will be constantly rotating since it will be following the mouse cursor. I've never worked with openGL before and I need some help getting started. If anyone knows any good websites to start learning and one that specifically contains rotation, please let me know. I've already visited NeHe ...

Using OpenGL on Windows Form Application in Visual C++

Hello, I want to draw 3D graphics on Windows Form Application in Visual C++.How can I adjust OpenGL library on Visual Studi 2008 ?Could you advise me any tutorial that mention using OpenGl Library with Windows Form Application and Visual C++? Best Regards... ...