🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

OpenGL output in a bitmap?

Started by
7 comments, last by CO 23 years, 11 months ago
I want to write a ROAM-engine. The terrain is good... but I want to optimise the displayed trees. I''ve seen in the game ''Motocross Madness 2'' that it''s possible to display the trees which are far away from the player only as bitmap''s without a great loss of quality. So I want to render a tree at the program start and store the picture in a bitmap which I want to use as a texture that I use to show the trees which are far away. (Wow that''s a bad English!) Now... is it possible to force OpenGL to render the output in a bitmap, or have I start programming with DirectX (which I didn''t want to do)?
Advertisement
render it in a drawing program and use the texture ontop of a polygon. + billboard it towards the camera. thats what i do with the trees in this shot http://members.xoom.com/myBollux/home.html .
though 2d polys look crap viewed from above.
alternatively u could do what black+white does + thats draw a piramid with the tree texture pasted onto it 8 triagles maybe..

btw it is possible to render to a bitmap.
To load the tree bitmaps was my first thought, but I want to make something variable.

Render to a bitmap... but how is this done. (I''ve no experience with OpenGL... that''s new for me...)
What you want to do is texture mapping. You want to apply the texture of a tree to a polygon. Check out NeHe''s tutorial on texture mapping, and you might also want to check the SuperBible (link on NeHe''s main page) about this topic.

EL

----------------------------------------
"Inash neteia haeg joa kavari quilm..." SD4
----------------------------------------"Inash neteia haeg joa kavari quilm..." SD4
I think I explained my problem wrong. I know what texture mapping is (I had wrote such a function a long time ago by hand). For the texture mapping you will need a texture (or also called bitmap...), you can load it... or create it in your program.
What I want to do is to render a 3D object at the program start into a texture and every time when the 3D object has changed the texture should updated. I want to use this method to display the 3D object which are far way from the player only as a texture (one 4 edge polygon) and when it is near to the player it will become a ''really'' 3D objects. This should improve the speed when many object are displayed in a scene.

But how can I render a 3D object into a texture??
To write all by hand is easy... but doing this with ''engines'' like OpenGL...
If you do it under Win9x and up, then you should try out the following:

- Create a Device Context (CreateDC)
- set it to bitmap type (can''t remembere whether this is necessary or how to do it)
- attach the Rendering context to this new DC
- Render your stuff
- Destroy the Rendering Context, but *NOT* the DC
- now you should have a bitmap in memory.

I hope it works, just how I would try to do it...

Hope this helps

pi~
Jan PieczkowskiBrainwave Studios
Or maybe you could use the color buffer with glReadPixels to store your trees into memory, then use this as a texture.

EL

----------------------------------------
"Inash neteia haeg joa kavari quilm..." SD4
----------------------------------------"Inash neteia haeg joa kavari quilm..." SD4
To The_[PI]_ehT:
Yes, this help's me absolutely!!
The idea is great, why is this not my? (Maybe I'am too stupid for so clever idea's? NOO!)
I think you will become my new god... the old couldn't answered my prayer!


Edited by - CO on July 29, 2000 1:09:48 PM
no problem!
Nice that I could help you

pi~

p.s.: notify me when you got the first church ready for me
Jan PieczkowskiBrainwave Studios

This topic is closed to new replies.

Advertisement