PDA

View Full Version : Displaying large photos using OpenGL



MikeArmstrong
10-22-2013, 03:59 AM
Hi all,

I've been learning about OpenGL recently. I am using an old implementation of 1.2 as I only have VB6 available to me to develop in. I know this isn't the best solution but it's all I have at the moment.

I have been following the NeHe tutorials and have gained a good grasp on the basics.

My application gives the user the ability to draw polygons by clicking on my canvas and to give these polygons a 'height' so they display as 3d objects. The user can navigate their 3d scene in a manner similar to google earth ie the camera can be tilted and rotated and zoomed in and out.

My problem is this. I am trying to give my app the ability to display a large photo, say up to 3000x3000 pixels as a 'floor' to the scene. This floor can be completely flat. It does need to be one large photo/bitmap, rather than a smaller grass texture/water texture etc. I can't see any way of simply reading in the bitmap and and displaying it as a 3d surface. I came to the conclusion that the way to do this is to create multiple tile objects and to texture these tiles with textures created from tiles of the original photo.

I kind of have this working but the frame rate just drops through the floor, and I also can't seem to get rid of a red cast which is over the whole photo.

Am I taking the correct approach here or is there a better way?

Thanks in advance

Mike

GClements
10-22-2013, 07:51 AM
I came to the conclusion that the way to do this is to create multiple tile objects and to texture these tiles with textures created from tiles of the original photo.
Sounds about right.


I kind of have this working but the frame rate just drops through the floor,
Are you re-uploading the texture data every frame?

Do you have enough video memory to hold all of the textures? If the implementation has to swap data between system memory and video memory, frame rate will suffer.


and I also can't seem to get rid of a red cast which is over the whole photo.
By default, texture colours are multiplied with the current colour (determined by glColor() and/or lighting). If you want texture colours to be reproduced exactly, you need to disable lighting and set the current colour to white (or use glTexEnvi(GL_TEXTURE_2D, GL_TEXTURE_ENV_MODE, GL_REPLACE) to force the current colour to be ignored when texturing is enabled).