Jump to content
  • Advertisement
Sign in to follow this  
polux

OpenGL Beginner question : How to make a thumbnails viewer in opengl ?

This topic is 4279 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi to all, I'm doing an application to manage a lot of scanned pages (it's in JAVA). It works find in 2D with the JAVA2D api, but I want to add som 3D effects like turnig, groupping, moving ... So I'm looking at opengl (jogl api). It looks great and powerfull as I need. So I created a lot of quads and I may apply on them 128x128 textures (thumbnails already prepared). The problem is that I have 2500 thumbnails in stock so I can't load them in seprate textures (the memory print is too hight). I tried to create a texture and change it on the fly but every quad render take 15ms and it's too slow 2500*0,015 = 37,5s So I imagine some solutions : _ Create a big image or texture and cut the 128x128 squares on it. _ Test which are the quads in the frustum and load the textures on demand. I will only have less than 100 quads viewed at a time. Is it possible to make the frustum culling before appying the texture ? Could you help me too chose which one is the best or if there is a better choice ? And give me some hints to realise that ? Thanks a lot.

Share this post


Link to post
Share on other sites
Advertisement
There's no way to have that many images instantly accessable at all times. You can possibly predict which ones might be needed soon, and keep those in memory, and release them when you know they won't be needed again for a while. Loading and unloading on demand shouldn't really be that bad though. If your interface has pages with a next/previous button or something, you could load the images in the next/previous pages in the background. Then going to the next/previous page doesn't require any immediate loading.


Quads shouldn't take 15ms to draw. Something really fishy is going on. You're not loading the texture data every frame or something are you?

Share this post


Link to post
Share on other sites
The predictive buffer is a good idea, I will bench the app to know how big can be my buffer.
I think in predicting by calculating the frustum and choosing what's inside and what I need to cache in the ouside.

You are right, the quad render in my test was without caching the thumbnails so in 15ms I got :
_ Choose texture
_ Load bitmap in a database
_ draw it in a texture
_ bind the texture
_ render the quad

It's amaizing what you can do in 15ms in JAVA !

Share this post


Link to post
Share on other sites
Only load the image data for the quads that are visible, there's no way you can see all 2500 thumbnails at once. That way, say you have 16 thumbnails on screen then thats 16*128*128*3 bits for each 'page' which is 98kBytes for each page. This is definately not too much.

Drawing a quad and having it textured shouldn't take 15ms, that's far too long. Ensure you're not accessing the image files each frame. That will certainly cause it to take so long.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!