Sign in to follow this  
Emark

OpenGL Rendering into a texture?

Recommended Posts

How i can render my stuff into other texture? I know how to change the pixel data, but it would be easier to just render on the texture by using OpenGL. The purpose is to create a minimap for my game, using 1024x1024 texture. I need to render it only once, so the rendering speed isnt important. (the simplier, the better). I readed about glCopyTexImage2D() but it copies framebuffer, so my window size must be at least 1024x1024 to work...? so how i can create another rendering surface just for the minimap? Also i should change the rendering mode to orthographic, how to do this on fly? So, what is the recommended way to do minimap creation by this method?

Share this post


Link to post
Share on other sites
Look into the Frame Buffer Object extension (FBO).
Here's something to get you started:

OpenGL Frame Buffer Object 101
OpenGL Frame Buffer Object 201

Quote:
Original post by Emark
Also i should change the rendering mode to orthographic, how to do this on fly?


glMatrixMode(GL_PROJECTION); // Subsequent matrix operations affect the projection matrix
glLoadIdentity(); // Reset the current projection matrix
gluOrtho2D(left, right, bottom, top); // Set an orthographic projection matrix
glMatrixMode(GL_MODELVIEW); // Restore matrixmode to modelview

Share this post


Link to post
Share on other sites
Thanks for help, but i cant get the glut libary working, using Microsoft Visual Studio:

Quote:
error C2065: 'glGenFramebuffersEXT' : undeclared identifier
error C2065: 'glBindFramebufferEXT' : undeclared identifier
error C2065: 'glGenRenderbuffersEXT' : undeclared identifier
error C2065: 'glBindRenderbufferEXT' : undeclared identifier
error C2065: 'glRenderbufferStorageEXT' : undeclared identifier
error C2065: 'glFramebufferRenderbufferEXT' : undeclared identifier
error C2065: 'glFramebufferTexture2DEXT' : undeclared identifier
error C2065: 'glCheckFramebufferStatusEXT' : undeclared identifier
error C2065: 'glDeleteFramebuffersEXT' : undeclared identifier
error C2065: 'glDeleteRenderbuffersEXT' : undeclared identifier


i tried to put glut32.lib in the lib folder and adding it in the project settings, and then adding the include line #include <gl\glut.h> (and the files in include/gl folder) but it still makes same errors.

is there any way to do this without third party libaries? i really want to avoid these and make a simple program with as less dependencies as possible.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this