opengl

OpenGL - Textures loading improperly

UPDATE: I've posted the Renderer code below, since this code here doesn't seem to be the problem. I'm having a problem with some code of mine where when I try to upload multiple textures to openGL, one at a time, it fails somewhat spectacularly, with the renderer only ending up using a single texture. I've done a bit of debugging to ...

How to render an arabic character in OpenGL?

I am able to display chinese character correctly but when I try to display arabic string the output that display in OpenGL scene is different from the arabic string that display in Visual Studio Editor. I know it should be something to do with "Complex Script" but I am not able to find any good example regarding to this matter. I would l...

OpenGL Colorspace Conversion

Does anyone know how to create a texture with a YUV colorspace so that we can get hardware based YUV to RGB colorspace conversion without having to use a fragment shader? I'm using an NVidia 9400 and I don't see an obvious GL extension that seems to do the trick. I've found examples how to use a fragment shader, but the project I'm wor...

Rendering Video in OpenGL

Is there a good solution for playing a compressed video in OpenGL? It needs to Be cross-platform (Windows and MacOSX) Render to a texture (preferably but not 100% needed) Cost less than Bink Any ideas? ...

How do I translate single objects in OpenGL 3.x ?

I have a bit of experience writing OpenGL 2 applications and want to learn using OpenGL 3. For this I've bought the Addison Wesley "Red-book" and "Orange-book" (GLSL) which descirbe the deprecation of the fixed functionality and the new programmable pipeline (shaders). But what I can't get a grasp of is how to construct a scene with mult...

Recommendations for OpenGL / Scheme combination

I'd like to try out OpenGL programming in Scheme. Can anyone give a recommendation for a decent Scheme compiler / OpenGL library combination? I have no reservations, though it would be nice (but not a requirement) to be able to produce native, executable binaries primarily on Windows, but also on UNIX and/or Mac OS X. EDIT: Changed t...

GL fragment shaders 101

I want to add a GLSL fragment shader to a program of mine, however I have been unable to find comprehensive documentation related to the C language (not C++ or C#). Anyone has examples or steps to get the ARB extension for shaders, or some sort of "hello world" template? I don't need help on the shaders themselves, just how to get them ...

How to load PNG with alpha with Cocoa?

Hey guys, I'm developing an iPhone OpenGL application, and I need to use some textures with transparency. I have saved the images as PNGs. I already have all the code to load PNGs as OpenGL textures and render them. This is working fine for all images that don't have transparency (all alpha values are 1.0). However, now that I'm try...

Help me evaluate this casting

I found this in the PowerVR mesh drawing code and I don't really know how to read it. &((unsigned short*)0)[3 * mesh.sBoneBatches.pnBatchOffset[batchNum]] What is going on here? Is this a reference to void cast as an unsigned short pointer and then offset by (3*mesh(etc...) + batchNum)? It's breaking my brain. It's found in the con...

Can I send openGL a pointer to more pointers, and use that for glVertexPointer?

I'm using the PowerVR .pod file type for 3d meshes. The pod stores data as an interleaved array of the vertex/normal/UV/vertex_indices, etc, for each mesh in the file. I'm trying to set up some sort of texture batching to minimize my draw calls, my thinking was that I could combine all the data from the meshes that share a texture into...

CreateTexture loading bitmap problem

I have the following function it takes 3 arguments being a texture array, filename and texture id but when I invoke the function using: CreateTexture(g_Texture, "\\\\nsq021vs\\u2\\abcb433\\MyDocs\\Visual Studio 2008\\Projects\\CaptainEdsAdv\\CaptainEdsAdv\\Back.bmp", BACK_ID ); it returns this: - pBitmap 0xcccccccc {sizeX=???...

Display List generation

I'm developing an application which make use of display lists offered by OpenGL. My idea is to call display lists for a repeatitive tasks, such as tranformations and server state sets. Actually the implementation allow two display lists per renderable object. In these two cases display lists doesn't contains vertices, normals etc., but o...

Using axis and angle of rotation in glrotate

I followed the question here http://stackoverflow.com/questions/764313/quaternion-math-for-rotation to get an angle of rotation and the axis around which I need to rotate, My question is how do I pass the angle and axis as an argument to glrotate()? ...

Texture atlas software

What is a good tool to make texture atlases with? I have a 2d game and I am going to need to shove a bunch of small textures into a bigger one for performance reasons. I know of some that do this job for fonts, but what I need now is one for images for my sprite animations. Any ideas on what would work best? ...

How do I use a pointer as an offset?

This issue originally came up in a related question of mine where I was having trouble reading some bit of code. The answer turned out to be that this line &((GLushort *)0)[3 * mesh.sBoneBatches.pnBatchOffset[batchNum]] evaluates to be a pointer. And it's used in glDrawElements(GL_TRIANGLES, i32Tris * 3, GL_UNSIGNED_SHORT, &((uns...

How can I specify per-face colors when using indexed vertex arrays in OpenGL 3.x?

I'm trying to render a cube using an array of 8 vertices and an index-array of 24 (4*6) indices into the vertex array. But how can I specify per-face variables, like colors and normals without using deprecated functions? For this I need a separate set of indices, but when I specify two index-arrays (GL_ELEMENT_ARRAY_BUFFERs) and point th...

How to rotate object around local axis in OpenGL?

I apologize for this rather long question. I am working on an ongoing project where I want to align the links of a chain so that it follows the contours of a Bezier curve. I am currently following the steps below. Drawing the curve. Use a display list to create one link of the chain. Use a FOR loop to repeatedly call a function that...

Setting up a camera in OpenGL

I've been working on a game engine for awhile. I've started out with 2D Graphics with just SDL but I've slowly been moving towards 3D capabilities by using OpenGL. Most of the documentation I've seen about "how to get things done," use GLUT, which I am not using. The question is how do I create a "camera" in OpenGL that I could move...

How do you handle multiple textures in an OpenGL indexed buffer array for use with a data-shader?

I'm attempting to implement this paper. I've have most of it down, but the part about sending arbitrary, non-geometric data to the shader for use in determining and displaying geometric edges is causing me problems. I've managed to successfully send most of my data just fine using what I know of VBOs. However, I need to send a large amou...

Basic Open GL/GLUT Issue

I am studying graphics and currently using OpenGL with GLUT. Doing my editing in codeblocks and using an online tutorial located at lighthouse3d. I am using the main method declared on that page however it will not let me compile. The error message consists of the main method not returning an int, I have "played" with the code enough to ...