opengl

Can someone explain how this code transforms something from per vertex lighting to per pixel?

In a tutorial there was a diffuse value calculation of the type float diffuse_value = max(dot(vertex_normal, vertex_light_position), 0.0); ..on the vertex shader. That was supposed to be making per vertex lighting if later on the fragment shader.. gl_FragColor = gl_Color * diffuse_value; Then when he moved the first line - appropr...

OpenGL: Set position instead of translating?

Can I set the current render position to be an arbitrary value, instead of just giving it an offset from the current location? This is what I'm doing currently: gl.glTranslatef(3.0f, 0.0f, 2.0f); It allows me to say "I want to move left" but not "I want to move to point (2, 1, 2)". Is there a way to do the latter? I'm using OpenGL w...

Parsing .obj files: How to do materials/textures?

Hello, I'm new to OpenGL. I'm playing around with it using JOGL. I'm using this model. I am successfully rendering it to the window. However, I would like to apply textures/materials. I'm not entirely sure how to do this. From the .obj file: f 6307/4525/3 6303/4524/3 6327/4523/3 6315/4526/3 usemtl kahki_light_pave_W.png f 6445/3470/3...

Per Pixel lighting in modern GLSL?

I'm looking for a proper simple example. Right now I had something based on a tutorial but I don't see variations in the middle of the triangles. It appears each triangle changes color but only in whole. out vec3 vertex_normal; out vec3 vertex_light_position; .. on the vertex shader. with vertex_normal = normalize(NormalM...

My OpenGL Cubemap is using 6 copies of the same texture instead of 6 different textures

Hi all, I'm new to opengl and have been able to learn a lot on my own, but i am stuck on this one. I have a room rendered, but I need a sphere that hovers in the center reflecting everything else perfectly. So far, I've been able to cube map to it with pretty good results, but the 6 textures are all the same: namely, the view I have of...

I'd like to begin learning game programming, where to start?

Possible Duplicate: Learning game programming I'm fairly fluent in C/C++ and ObjC languages and would like to venture into game programming. I've always sort of wanted to do this but never really had the time, but now I do and I'm ready to learn! My goal is to start out and make a simple 2D game on the iPhone (Doesn't have to ...

Menu for MFC application

Hi, I am new to MFC programming. My application is an OpenGL based game using MFC. I have completed the graphics part of the app, but is stuck at adding a landing menu for my game. How does one add different dialog to an MFC application? Regards, Aibin ...

What is gl_ModelViewMatrix and gl_ModelViewProjectionMatrix in modern OpenGL?

I have this code which is context "#version 330 core" gl_Position = PerspectiveViewMatrix(90.0, AspectRatio, 0.01, 1000.0 ) * TranslationMatrix(0, 0, -4 -0.35*MouseWheel) * RotationMatrix(MouseMovement.y, X_AXIS) * RotationMat...

OpenGL: Choose which poly face is forwards?

I'm new to OpenGL. I'm using Java/JOGL. I'm having difficulty with polygon faces. I want to be able to control which side is the front or back. I've been working through this documentation. I thought this line of code, in my display() method, would make all poly faces be drawn, but it had no effect: gl.glPolygonMode(GL.GL_FRONT_AND_BA...

Porting IRIS GL to Open GL?

Hi I'm really new to IRIX, IRIS GL, and Motif. I must compile more than 30 C codes written in 1997. Because these sources require header files such as XmAll.h, Xlib.h, and so on, I thought I just needed Unix and Open Motif to compile them. I installed FreeBSD as a guest OS on my Mac OSX, so almost all missing header files were found. (e...

Get camera inside my skybox

So I am working on a homework assignment and I have managed to create my skybox and it looks correct, the only problem is that my camera is outside the skybox. I tried the command gluLookAt thinking maybe that would focus me into the box, but it didn't work. Here's the code that I have now. If anyone could let me know what I'm doing...

What is Half vector in modern GLSL?

http://www.lighthouse3d.com/opengl/glsl/index.php?ogldir2 reports that half vector in OpenGL context is 'Eye position - Light position' but then it goes on to say 'luckily OpenGL calculates it for us' [which is now deprecated]. How can, practically be calculated (a simple example would be greatly appreciated) [mainly, it puzzles me wh...

Set screen resolution in game programming

I have to make a multiplayer game and give the users(on different) an option to change their screen resolution in order to sustain their hardware requirements.Similar to counterstrike. How can I implement this in c ? how can I give the users sitting on different computers an option to change their screen resolution ? ...

OpenGL 3.2 Core Profile Guide

Can anyone suggest a guide for learning the OpenGL 3.2 core profile? The SDK is hard to read, and most of the guides I have seen only taught the old method. ...

OpenGL ARB function in Mac

I want to use glCurrentPaletteMatrixARB in Mac application. OpenGL library is imported GLEW library and GLUT and, glewInit() function calling was successful. glWeightPointerARB function is able to call, but my application crashed in glCurrentPaletteMatrixARB. Reason is function pointer value is null pointer error. Extension string is no...

Java: BufferUtil?

I'm trying to use this class with JOGL. It references BufferUtil, which I can't find anywhere. I found documentation, but no actual code. Eclipse doesn't suggest to import it from anywhere. What do I have to do to be able to use this code? ...

OpenGL Heightmap

I am working on a project for school and part of it was making a height map. I managed to create the height map as requested, but was hoping to go for a little extra credit and smooth the entire surface. Here's an image of what I have now: http://img.photobucket.com/albums/v222/shavus/hMap.png The code that I used to generate it was ...

OpenGL Triangle Strip Viewing Question

Hey all, I'm having an awful time trying to get these triangle strips to show up. Where am I going wrong? InitGL: InitGL() { glEnable(GL_DEPTH_TEST); // Enables Depth Testing glDepthFunc(GL_LEQUAL); glMatrixMode(GL_PROJECTION); glLoadIdentity();// gluPerspective(45, //view angle WINDOW_WIDTH/WINDOW_HEIGHT, //aspect ratio...

OpenGL being ported to XNA

I'm beginning to port my game over to XNA from a C/OpenGL codebase. I'm just now getting to the rendering code, and I'm wondering what the best methods would be for transitioning from a system where you simply bind a texture with one call, then output vertex buffers objects to an XNA equivalent set of methods? I can see how you pass ve...

OpenGL CubeMap Texture Dimensions

After struggling all weekend, I finally have a sphere reflecting its environment in OpenGL. It almost looks good. Problem is, certain features don't line up. I can't find much information on the topic of OpenGL sphere mapping, outside of a two page section in the Red Book and a few scattered, and mostly unfinished forum topics. Not sure ...