opengl

What can glStencil do?

I'm wondering what the stencil buffer is and what it can do. Thanks ...

2D OpenGL scene slows down with lots of overlapping shapes

I'm drawing 2D shapes with OpenGL. They aren't using that many polygons. I notice that I can have lots and lots of shapes as long as they don't overlap. If I get a shape behind a shape behind.... etc.. it really starts lagging. I feel like I might be doing something wrong. Is this normal and is there a way to fix this (I can't omit rende...

Should i always use GL_ARGB format for all textures in OpenGL?

This has been bothering me a while... and it's really hard to really see any difference in performance, so i ask here: If my images doesnt use alpha channel, should i use 'GL_RGB' for saving them in GFX card memory, or 'GL_ARGB' as if that would be faster in processing since its full 32 bit block? Or does GFX cards automatically conver...

Develop for OpenGL ES on the desktop

I'm developing a desktop OpenGL application, and I want to make sure it'll be compatible to OpenGL ES, so that it'll be easier to port it to mobile platforms later. What's the best way to make sure I'm using only the OpenGL ES specifications in my software? ...

Simple OpenGL implementatione

Hi all. I work on port of some casual games to Flash. They are based on OpenGL. Used OpenGL version is 1.x mostly. Game engine relies is 2D. It bases on OpenGL textures and simplest glBegin/glTexCoord/glVertex/glEnd. Blending and tiling is used too. The question. I do not want to reinvent OpenGL again. Please tell - maybe you know simpl...

Converting mouse position to world position OpenGL

Hey, I'm working on a map editor for my game, and I'm trying to convert the mouse position to a position in the game world, the view is set up using gluPerspective ...

Gracefully shutting down a Java OpenGL (JOGL) app

I have an application with a JOGL component. When it shuts down using System.exit(0), I frequently get the exception: java.lang.InterruptedException at java.lang.Object.wait(Native Method) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:118) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:134) at sun.java2d.Dispose...

How do I trap display driver drawing commands on Mac OS X?

I am trying to find a clean and elegant way to trap all display driver drawing commands on Mac OS X so I have visibility to anything that gets drawn on the screen, before it goes to the physical display driver. Simple bitmaps won't do it -- I need the actual drawing commands and not just notifications on which areas have changed. This ...

Drawing the alpha channel correctly in OpenGl.

After loading an image, I have the individual bytes for each channel loaded into an array of unsigned characters. It's passed to a function that projects it as a texture onto a quad. Everything seems to work properly other than the alpha channel, which shows up as the background color. I'm using OpenGL to draw the image. Would I benefit ...

OpenGL blending (Java)

I'm writing some Java OpenGL code (though the principles are the same in C++ openGL). I have a situation where I want to render certain items on top of others. I can do that by disable the depth test or by setting it to GL_ALWAYS) for those items and that works well. The issue is that colors of those items on top seem to be darkened by t...

Can't draw triangles in OpenGL but other primitives render fine...

Good afternoon, I'm trying to learn to use a graphics library that uses OpenGL. I can draw 2D primitives (text and lines) but 3D triangles don't render. I've tried everything I can think of but as an OpenGL newcomer I've probably missed something obvious. This code is not intended to be efficient. I'm trying to get it to work first. ...

Knowing when an OpenGL rendering context gets destroyed

How could I get Windows to tell me when a particular OpenGL rendering context is destroyed? I am creating a small UI widget library that utilizes information stored in a single OpenGL rendering context per library context. To make the UI widget graphical resources available for other purposes, as well as to eliminate slow wglMakeCurrent...

What are the possible reasons for textures not appearing in GLSL?

I was learning about how to use textures with GLSL (in LWJGL) to create a simple fragment shader that blurs a texture. The first attempt (for testing purposes) was a very simple shader which just takes the original color values: uniform sampler2D rectTexture; void main(){ vec4 color = texture2D(rectTexture, gl_FragCoord.st); gl_Fra...

Update Qt4 statusbar from glwidget

Hi, I've got a window containing a QGLWidget and a QStatusBar. I calculate the fps inside a timerEvent call, but I don't know the 'correct' way to update the statusbar on every frame. fps is a member variable of GLWidget: void GLWidget::timerEvent(QTimerEvent* event){ updateGL(); // Calculate FPS. prevTime = currentTime; ...

Are there major differences between shader languages?

I am currently learning GLSL. It would seem that once you learn one of the shader languages, learning one of the others would not be too difficult. Is it something analogous to learning a widget toolset like wxWidgets and then switching to Qt? Once you get the idea of what is happening within one widget toolset, another toolset will d...

How to get VBO working

I tried to use this tutorial http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=45 I load it in my visual studio 2008, compile it, and it says missing file: "GLES/glplatform.h" so i google the file... then it whines missing file: "KHR/khrplatform.h", so i google that too... then it whines everything possible, "GLDouble undeclared id...

how to draw transparent polygon in openGL

Hi everyone I need your help. I know there is alpha in openGL, and it's help me to draw polygon on transparent mode, but I do not know how to do that, what should enable to allow opengGL to draw that polygon. and thanks for any help. ...

how do i extract vertex data from an fbx file

hi, im tryin to extract vertice and uv map informatie from a fbx file created with 3ds max 2010. All i could get from the file are good vertice and polygon index data but wrong uv maps. Can please someone help me pointing in a good direction or give me a tutorial. Thanks for ready this. ...

'SIGTERM' problem.

Hi, I have this problem that when there is an OpenGL application I am working on. When I try drawing this particular piece of code: for (float i = 0; i < 100; i++) { glBegin(GL_LINE_LOOP); glVertex3f(cos(i), i, -10.0f); } glEnd(); I get this problem where the program crashes and returns: “SIGTERM” Any suggestions to he...

OpenGL Newbie - Best way to move objects about in a scene

I'm new to OpenGL and graphics programming in general, though I've always been interested in the topic so have a grounding in the theory. What I'd like to do is create a scene in which a set of objects move about. Specifically, they're robotic soccer players on a field. The objects are: The lighting, field and goals, which don't cha...