Raw open gl commands.

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
caseybasichis
Greenskin
Posts: 100
Joined: Wed Jan 25, 2012 7:50 pm
x 1

Raw open gl commands.

Post by caseybasichis »

Is it possible to call raw open gl commands within ogre?

I want to render to a 2D texture using some opengl code, is that possible?
User avatar
lingfors
Hobgoblin
Posts: 525
Joined: Mon Apr 02, 2007 12:18 am
Location: Sweden
x 79

Re: Raw open gl commands.

Post by lingfors »

What exactly do you want to do, that you cannot do without exposing the OpenGL rendersystem?

Or is this a case of "I already know how to do it in OpenGL, why waste time learning how to do it in Ogre?"
caseybasichis
Greenskin
Posts: 100
Joined: Wed Jan 25, 2012 7:50 pm
x 1

Re: Raw open gl commands.

Post by caseybasichis »

I'm using a framework meant to work with OpenGl. It doesn't create its own gl context. Here is an example of it integrated:

Whatever works...

Code: Select all

VGPaint _paint;
VGPath _path;
void init() {
    ... setup platform specific opengl ...
    // setup the OpenVG context
    vgCreateContextMNK( 320, 480, VG_RENDERING_BACKEND_TYPE_OPENGLES20 );

    ...OR... for OpenGL ES 1.1

    vgCreateContextMNK( 320, 480, VG_RENDERING_BACKEND_TYPE_OPENGLES11 );

    // create a paint
    _paint = vgCreatePaint();
    vgSetPaint(_paint, VG_FILL_PATH );
    VGfloat color[4] = { 1.0f, 0.0f, 0.0f, 1.0f };
    vgSetParameterfv(_paint, VG_PAINT_COLOR, 4, &color[0]);

    // create a box path
    _path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F,1,0,0,0, VG_PATH_CAPABILITY_ALL);
    vguRect( _path, 50.0f, 50.0f, 90.0f, 50.0f );


}

void draw() {
    ... save any GL state here ...
    ... start opengl context ...

    /// draw the basic path
    vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
    vgLoadIdentity();
    vgTranslate( screenWidth/2, screenHeight/2 );
    vgSetPaint( _paint, VG_FILL_PATH );
    vgDrawPath( _path, VG_FILL_PATH );

    ... end opengl context ...
    ... restore and GL state here ...
}
caseybasichis
Greenskin
Posts: 100
Joined: Wed Jan 25, 2012 7:50 pm
x 1

Re: Raw open gl commands.

Post by caseybasichis »

Hi,

So is it possible to expose the render system is this way as you suggest?
User avatar
madmarx
OGRE Expert User
OGRE Expert User
Posts: 1671
Joined: Mon Jan 21, 2008 10:26 pm
x 50

Re: Raw open gl commands.

Post by madmarx »

yes, you can for example use a queue listener (to make the drawing after everything else), or create your own renderable.
There are examples on the forums. Here :
http://www.ogre3d.org/forums/viewtopic.php?p=296902
Tutorials + Ogre searchable API + more for Ogre1.7 : http://sourceforge.net/projects/so3dtools/
Corresponding thread : http://www.ogre3d.org/forums/viewtopic. ... 93&start=0
Post Reply