本文整理汇总了C++中set_viewport函数的典型用法代码示例。如果您正苦于以下问题:C++ set_viewport函数的具体用法?C++ set_viewport怎么用?C++ set_viewport使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_viewport函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: gl_xml_shader
static bool gl_xml_shader(void *data, const char *path)
{
gl_t *gl = (gl_t*)data;
#ifdef HAVE_FBO
gl_deinit_fbo(gl);
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
#endif
gl_shader_deinit();
if (!gl_glsl_init(path))
return false;
#ifdef HAVE_FBO
// Set up render to texture again.
gl_init_fbo(gl, gl->tex_w, gl->tex_h);
#endif
// Apparently need to set viewport for passes when we aren't using FBOs.
gl_shader_use(0);
set_viewport(gl, gl->win_width, gl->win_height, false, true);
gl_shader_use(1);
set_viewport(gl, gl->win_width, gl->win_height, false, true);
return true;
}
开发者ID:magicseb,项目名称:RetroArch,代码行数:27,代码来源:gl.c
示例2: GDISP_LLD
/**
* @brief Scroll vertically a section of the screen.
* @note Optional.
* @note If x,y + cx,cy is off the screen, the result is undefined.
* @note If lines is >= cy, it is equivelent to a area fill with bgcolor.
*
* @param[in] x, y The start of the area to be scrolled
* @param[in] cx, cy The size of the area to be scrolled
* @param[in] lines The number of lines to scroll (Can be positive or negative)
* @param[in] bgcolor The color to fill the newly exposed area.
*
* @notapi
*/
void GDISP_LLD(verticalscroll)(coord_t x, coord_t y, coord_t cx, coord_t cy, int lines, color_t bgcolor) {
/* This is marked as "TODO: Test this" in the original GLCD driver.
* For now we just leave the GDISP_HARDWARE_SCROLL off.
*/
static color_t buf[((GDISP_SCREEN_HEIGHT > GDISP_SCREEN_WIDTH ) ? GDISP_SCREEN_HEIGHT : GDISP_SCREEN_WIDTH)];
coord_t row0, row1;
unsigned i, gap, abslines;
#if GDISP_NEED_VALIDATION || GDISP_NEED_CLIP
if (x < GDISP.clipx0) { cx -= GDISP.clipx0 - x; x = GDISP.clipx0; }
if (y < GDISP.clipy0) { cy -= GDISP.clipy0 - y; y = GDISP.clipy0; }
if (!lines || cx <= 0 || cy <= 0 || x >= GDISP.clipx1 || y >= GDISP.clipy1) return;
if (x+cx > GDISP.clipx1) cx = GDISP.clipx1 - x;
if (y+cy > GDISP.clipy1) cy = GDISP.clipy1 - y;
#endif
abslines = lines < 0 ? -lines : lines;
acquire_bus();
if (abslines >= cy) {
abslines = cy;
gap = 0;
} else {
gap = cy - abslines;
for(i = 0; i < gap; i++) {
if(lines > 0) {
row0 = y + i + lines;
row1 = y + i;
} else {
row0 = (y - i - 1) + lines;
row1 = (y - i - 1);
}
/* read row0 into the buffer and then write at row1*/
set_viewport(x, row0, cx, 1);
lld_lcdReadStreamStart();
lld_lcdReadStream(buf, cx);
lld_lcdReadStreamStop();
set_viewport(x, row1, cx, 1);
stream_start();
write_data(buf, cx);
stream_stop();
}
}
/* fill the remaining gap */
set_viewport(x, lines > 0 ? (y+gap) : y, cx, abslines);
stream_start();
gap = cx*abslines;
for(i = 0; i < gap; i++) write_data(bgcolor);
stream_stop();
reset_viewport();
release_bus();
}
开发者ID:lord67,项目名称:ChibiOS-GFX,代码行数:68,代码来源:gdisp_lld.c
示例3: lld_gdisp_vertical_scroll
/**
* @brief Scroll vertically a section of the screen.
* @note Optional.
* @note If x,y + cx,cy is off the screen, the result is undefined.
* @note If lines is >= cy, it is equivelent to a area fill with bgcolor.
*
* @param[in] x, y The start of the area to be scrolled
* @param[in] cx, cy The size of the area to be scrolled
* @param[in] lines The number of lines to scroll (Can be positive or negative)
* @param[in] bgcolor The color to fill the newly exposed area.
*
* @notapi
*/
void lld_gdisp_vertical_scroll(coord_t x, coord_t y, coord_t cx, coord_t cy, int lines, color_t bgcolor) {
static color_t buf[((GDISP_SCREEN_HEIGHT > GDISP_SCREEN_WIDTH ) ? GDISP_SCREEN_HEIGHT : GDISP_SCREEN_WIDTH)];
coord_t row0, row1;
unsigned i, gap, abslines, j;
#if GDISP_NEED_VALIDATION || GDISP_NEED_CLIP
if (x < GDISP.clipx0) { cx -= GDISP.clipx0 - x; x = GDISP.clipx0; }
if (y < GDISP.clipy0) { cy -= GDISP.clipy0 - y; y = GDISP.clipy0; }
if (!lines || cx <= 0 || cy <= 0 || x >= GDISP.clipx1 || y >= GDISP.clipy1) return;
if (x+cx > GDISP.clipx1) cx = GDISP.clipx1 - x;
if (y+cy > GDISP.clipy1) cy = GDISP.clipy1 - y;
#endif
abslines = lines < 0 ? -lines : lines;
acquire_bus();
if (abslines >= cy) {
abslines = cy;
gap = 0;
} else {
gap = cy - abslines;
for(i = 0; i < gap; i++) {
if(lines > 0) {
row0 = y + i + lines;
row1 = y + i;
} else {
row0 = (y - i - 1) + lines;
row1 = (y - i - 1);
}
/* read row0 into the buffer and then write at row1*/
set_viewport(x, row0, cx, 1);
stream_start();
j = read_data(); // dummy read
for (j = 0; j < cx; j++)
buf[j] = read_data();
stream_stop();
set_viewport(x, row1, cx, 1);
stream_start();
for (j = 0; j < cx; j++)
write_data(buf[j]);
stream_stop();
}
}
/* fill the remaining gap */
set_viewport(x, lines > 0 ? (y+gap) : y, cx, abslines);
stream_start();
gap = cx*abslines;
for(i = 0; i < gap; i++) write_data(bgcolor);
stream_stop();
release_bus();
}
开发者ID:etmatrix,项目名称:ChibiOS-GFX,代码行数:67,代码来源:gdisp_lld.c
示例4: set_viewport
void OpenGL3RenderState::enable(OpenGL3ContextState& state) const
{
depth_state_.enable(state);
stencil_state_.enable(state);
blend_state_.enable(state);
rasterizer_state_.enable(state);
if (viewport_.is_empty())
set_viewport(state, rect<int>(0, 0, state.window_size.x(), state.window_size.y()));
else
set_viewport(state, viewport_);
set_scissor(state, scissor_state_);
}
开发者ID:icedmaster,项目名称:mhe,代码行数:12,代码来源:opengl3_render_state.cpp
示例5: reset_viewport
static __inline void reset_viewport(void) {
switch(GDISP.Orientation) {
case GDISP_ROTATE_0:
case GDISP_ROTATE_180:
set_viewport(0, 0, GDISP_SCREEN_WIDTH, GDISP_SCREEN_HEIGHT);
break;
case GDISP_ROTATE_90:
case GDISP_ROTATE_270:
set_viewport(0, 0, GDISP_SCREEN_HEIGHT, GDISP_SCREEN_WIDTH);
break;
}
}
开发者ID:lord67,项目名称:ChibiOS-GFX,代码行数:12,代码来源:gdisp_lld.c
示例6: u_setrt
void CRenderTarget::phase_downsamp ()
{
// DON'T DO THIS!!!
//IDirect3DSurface9 *source, *dest;
//rt_Position->pSurface->GetSurfaceLevel(0, &source);
//rt_half_depth->pSurface->GetSurfaceLevel(0, &dest);
//HW.pDevice->StretchRect(source, NULL, dest, NULL, D3DTEXF_POINT);
//Fvector2 p0,p1;
u32 Offset = 0;
u_setrt( rt_half_depth,0,0,0/*HW.pBaseZB*/ );
FLOAT ColorRGBA[4] = {0.0f, 0.0f, 0.0f, 0.0f};
HW.pContext->ClearRenderTargetView(rt_half_depth->pRT, ColorRGBA);
u32 w = Device.dwWidth;
u32 h = Device.dwHeight;
if (RImplementation.o.ssao_half_data)
{
set_viewport(HW.pDevice, Device.dwWidth/2, Device.dwHeight/2);
w /= 2;
h /= 2;
}
RCache.set_Stencil (FALSE);
{
Fmatrix m_v2w; m_v2w.invert (Device.mView );
// Fill VB
float scale_X = float(w) / float(TEX_jitter);
float scale_Y = float(h) / float(TEX_jitter);
// Fill vertex buffer
FVF::TL* pv = (FVF::TL*) RCache.Vertex.Lock (4,g_combine->vb_stride,Offset);
pv->set ( -1, 1, 0, 1, 0, 0, scale_Y ); pv++;
pv->set ( -1, -1, 0, 0, 0, 0, 0 ); pv++;
pv->set ( 1, 1, 1, 1, 0, scale_X, scale_Y ); pv++;
pv->set ( 1, -1, 1, 0, 0, scale_X, 0 ); pv++;
RCache.Vertex.Unlock (4,g_combine->vb_stride);
// Draw
RCache.set_Element (s_ssao->E[1] );
RCache.set_Geometry (g_combine );
RCache.set_c ("m_v2w", m_v2w );
RCache.Render (D3DPT_TRIANGLELIST,Offset,0,4,0,2);
}
if (RImplementation.o.ssao_half_data)
set_viewport(HW.pDevice, Device.dwWidth, Device.dwHeight);
}
开发者ID:2asoft,项目名称:xray-16,代码行数:52,代码来源:r3_rendertarget_phase_ssao.cpp
示例7: ui_create_window
void ui_create_window (float x1, float y1, float x2, float y2)
{
set_viewport (x1, y1, x2, y2);
ui_set_origin (x1, y1);
//ui_draw_area (0, 0, x2 - x1, y2 - y1, UI_OBJECT_STATE_OFF);
set_viewport (x1 + 1, y1 + 1, x2 - 1, y2 - 1);
ui_set_origin (x1 + 1, y1 + 1);
}
开发者ID:Comanche93,项目名称:eech,代码行数:13,代码来源:uiwindow.c
示例8: check_ui_object_clipped
int check_ui_object_clipped (ui_object *obj)
{
int
flag;
ui_object
*parent;
float
x1,
x2,
y1,
y2,
x_min,
y_min,
x_max,
y_max,
old_vp_x1,
old_vp_y1,
old_vp_x2,
old_vp_y2;
old_vp_x1 = active_viewport.x_min;
old_vp_y1 = active_viewport.y_min;
old_vp_x2 = active_viewport.x_max;
old_vp_y2 = active_viewport.y_max;
parent = get_ui_object_parent (obj);
ASSERT (parent);
x1 = get_ui_object_x (parent);
y1 = get_ui_object_y (parent);
x2 = x1 + get_ui_object_x_size (parent);
y2 = y1 + get_ui_object_y_size (parent);
x_min = get_ui_object_x (obj);
y_min = get_ui_object_y (obj);
x_max = x_min + get_ui_object_x_size (obj);
y_max = y_min + get_ui_object_y_size (obj);
set_viewport (x1, y1, x2, y2);
flag = ui_clip_area (&x_min, &y_min, &x_max, &y_max);
set_viewport (old_vp_x1, old_vp_y1, old_vp_x2, old_vp_y2);
return flag;
}
开发者ID:Comanche93,项目名称:eech,代码行数:50,代码来源:uiclip.c
示例9: gdisp_lld_read_start
LLDSPEC void gdisp_lld_read_start(GDisplay *g) {
acquire_bus(g);
set_viewport(g);
write_index(g, 0x2E);
setreadmode(g);
dummy_read(g);
}
开发者ID:kleopatra999,项目名称:arm_mcu,代码行数:7,代码来源:gdisp_lld_ILI9341.c
示例10: gdisp_lld_write_start
LLDSPEC void gdisp_lld_write_start(GDisplay *g) {
acquire_bus(g);
set_viewport(g);
#if !GDISP_HARDWARE_STREAM_POS
set_cursor(g);
#endif
}
开发者ID:bunnie,项目名称:chibi-ugfx,代码行数:7,代码来源:gdisp_lld_R61505U.c
示例11: gdisp_lld_read_start
LLDSPEC void gdisp_lld_read_start(GDisplay *g) {
acquire_bus(g);
set_viewport(g);
set_cursor(g);
setreadmode(g);
dummy_read(g);
}
开发者ID:bunnie,项目名称:chibi-ugfx,代码行数:7,代码来源:gdisp_lld_R61505U.c
示例12: GDISP_LLD
/**
* @brief Fill an area with a color.
* @note Optional - The high level driver can emulate using software.
*
* @param[in] x, y The start filled area
* @param[in] cx, cy The width and height to be filled
* @param[in] color The color of the fill
*
* @notapi
*/
void GDISP_LLD(fillarea)(coord_t x, coord_t y, coord_t cx, coord_t cy, color_t color) {
unsigned i, area;
#if GDISP_NEED_VALIDATION || GDISP_NEED_CLIP
if (x < GDISP.clipx0) {
cx -= GDISP.clipx0 - x;
x = GDISP.clipx0;
}
if (y < GDISP.clipy0) {
cy -= GDISP.clipy0 - y;
y = GDISP.clipy0;
}
if (cx <= 0 || cy <= 0 || x >= GDISP.clipx1 || y >= GDISP.clipy1) return;
if (x+cx > GDISP.clipx1) cx = GDISP.clipx1 - x;
if (y+cy > GDISP.clipy1) cy = GDISP.clipy1 - y;
#endif
area = cx*cy;
acquire_bus();
set_viewport(x, y, cx, cy);
stream_start();
for(i = 0; i < area; i++)
write_data(color);
stream_stop();
reset_viewport();
release_bus();
}
开发者ID:omgmog,项目名称:olvfw,代码行数:37,代码来源:gdisp_lld.c
示例13: gl_update_resize
static void gl_update_resize(gl_t *gl)
{
#ifdef HAVE_FBO
if (!gl->render_to_tex)
set_viewport(gl, gl->win_width, gl->win_height, false, true);
else
{
gl_check_fbo_dimensions(gl);
// Go back to what we're supposed to do, render to FBO #0 :D
gl_start_frame_fbo(gl);
}
#else
set_viewport(gl, gl->win_width, gl->win_height, false, true);
#endif
}
开发者ID:magicseb,项目名称:RetroArch,代码行数:16,代码来源:gl.c
示例14: set_2d_active_environment
void set_2d_active_environment (env_2d *env)
{
ASSERT (env);
active_2d_environment = env;
set_viewport (env->vp.x_min, env->vp.y_min, env->vp.x_max, env->vp.y_max);
}
开发者ID:Comanche93,项目名称:eech,代码行数:8,代码来源:2dview.c
示例15: while
void Shex::loop() {
SDL_Event e;
bool quit = false;
while(1) {
// process events:
while(SDL_WaitEvent(&e) != 0) {
if(e.type == SDL_QUIT) {
quit = true;
}
if(e.type == SDL_WINDOWEVENT &&
(e.window.event ==SDL_WINDOWEVENT_RESIZED ||
e.window.event == SDL_WINDOWEVENT_SIZE_CHANGED)) {
winw = e.window.data1;
winh = e.window.data2;
set_viewport();
}
if(e.type == SDL_MOUSEWHEEL) {
if(e.wheel.y < 0) {
doffset += 16;
} else {
if(doffset < 16) {
doffset = 0;
} else {
doffset -= 16;
}
}
load_data_file();
// std::cout << e.wheel.y << std::endl;
}
if(e.type == SDL_KEYDOWN) {
switch(e.key.keysym.sym) {
case SDLK_HOME:
doffset = 0;
load_data_file();
break;
case SDLK_END:
doffset = (dfsize - dfsize % 16);
load_data_file();
break;
case SDLK_PAGEUP:
doffset = (doffset < 400)? 0:
doffset - 400;
load_data_file();
break;
case SDLK_PAGEDOWN:
doffset += 400;
load_data_file();
break;
}
}
if(quit) break;
draw();
}
if(quit) break;
}
SDL_GL_DeleteContext(glcontext);
SDL_Quit();
}
开发者ID:alexkh,项目名称:shex,代码行数:58,代码来源:shex.cpp
示例16: set_2d_viewport
void set_2d_viewport (env_2d *env, const float x_min, const float y_min, const float x_max, const float y_max)
{
float
x_translate,
y_translate,
x_scale,
y_scale;
ASSERT (env);
env->vp.x_min = x_min;
env->vp.y_min = y_min;
env->vp.x_max = x_max;
env->vp.y_max = y_max;
//
// set viewport origin (centre of viewport)
//
x_translate = (env->vp.x_min + env->vp.x_max) / 2.0;
y_translate = (env->vp.y_min + env->vp.y_max) / 2.0;
env->viewport_translation[2][0] = x_translate;
env->viewport_translation[2][1] = y_translate;
env->inverse_viewport_translation[2][0] = -x_translate;
env->inverse_viewport_translation[2][1] = -y_translate;
//
// calc window to viewport scaling
//
x_scale = (env->vp.x_max - env->vp.x_min) / (env->window_x_max - env->window_x_min);
y_scale = (env->vp.y_max - env->vp.y_min) / (env->window_y_max - env->window_y_min);
env->window_scaling[0][0] = x_scale;
env->window_scaling[1][1] = y_scale;
env->inverse_window_scaling[0][0] = 1.0 / x_scale;
env->inverse_window_scaling[1][1] = 1.0 / y_scale;
//
// flags
//
env->composite_transformation_matrix_valid = FALSE;
env->inverse_composite_transformation_matrix_valid = FALSE;
//
// set graphics system viewport
//
if (env == active_2d_environment)
{
set_viewport (env->vp.x_min, env->vp.y_min, env->vp.x_max, env->vp.y_max);
}
}
开发者ID:Comanche93,项目名称:eech,代码行数:57,代码来源:2dview.c
示例17: gl_render_msg
static void gl_render_msg(gl_t *gl, const char *msg)
{
if (!gl->font)
return;
GLfloat font_vertex[8];
GLfloat font_vertex_dark[8];
GLfloat font_tex_coords[8];
// Deactivate custom shaders. Enable the font texture.
gl_shader_use(0);
set_viewport(gl, gl->win_width, gl->win_height, false, false);
glBindTexture(GL_TEXTURE_2D, gl->font_tex);
glTexCoordPointer(2, GL_FLOAT, 0, font_tex_coords);
// Need blending.
// Using fixed function pipeline here since we cannot guarantee presence of shaders (would be kinda overkill anyways).
glEnable(GL_BLEND);
struct font_output_list out;
// If we get the same message, there's obviously no need to render fonts again ...
if (strcmp(gl->font_last_msg, msg) != 0)
{
font_renderer_msg(gl->font, msg, &out);
struct font_output *head = out.head;
struct font_rect geom;
calculate_msg_geometry(head, &geom);
adjust_power_of_two(gl, &geom);
blit_fonts(gl, head, &geom);
font_renderer_free_output(&out);
strlcpy(gl->font_last_msg, msg, sizeof(gl->font_last_msg));
gl->font_last_width = geom.width;
gl->font_last_height = geom.height;
}
calculate_font_coords(gl, font_vertex, font_vertex_dark, font_tex_coords);
glVertexPointer(2, GL_FLOAT, 0, font_vertex_dark);
glColorPointer(4, GL_FLOAT, 0, gl->font_color_dark);
glDrawArrays(GL_QUADS, 0, 4);
glVertexPointer(2, GL_FLOAT, 0, font_vertex);
glColorPointer(4, GL_FLOAT, 0, gl->font_color);
glDrawArrays(GL_QUADS, 0, 4);
// Go back to old rendering path.
glTexCoordPointer(2, GL_FLOAT, 0, gl->tex_coords);
glVertexPointer(2, GL_FLOAT, 0, vertexes_flipped);
glColorPointer(4, GL_FLOAT, 0, white_color);
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
glDisable(GL_BLEND);
set_projection(gl, true);
}
开发者ID:magicseb,项目名称:RetroArch,代码行数:56,代码来源:gl.c
示例18: gdisp_lld_fill_area
LLDSPEC void gdisp_lld_fill_area(GDisplay *g) {
uint16_t c;
c = gdispColor2Native(g->p.color);
acquire_bus(g);
set_viewport(g);
set_cursor(g);
dma_with_noinc(g, &c, g->p.cx*g->p.cy);
release_bus(g);
}
开发者ID:bhdminh,项目名称:uGFX,代码行数:10,代码来源:gdisp_lld_ST7781.c
示例19: set_view_matrix
void Video::set_3d_view(const Camera &camera, const std::pair<Point2i, Point2i> &viewport) {
m_3d = true;
const Matrix4f view = camera.get_view_matrix();
set_view_matrix(view);
const Matrix4f projection = camera.get_projection_matrix(viewport);
set_projection_matrix(projection);
set_viewport(viewport);
}
开发者ID:Sonophoto,项目名称:Soar-SC,代码行数:11,代码来源:Video.cpp
示例20: gl_start_frame_fbo
static void gl_start_frame_fbo(gl_t *gl)
{
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
pglBindFramebuffer(GL_FRAMEBUFFER, gl->fbo[0]);
gl->render_to_tex = true;
set_viewport(gl, gl->fbo_rect[0].img_width, gl->fbo_rect[0].img_height, true, false);
// Need to preserve the "flipped" state when in FBO as well to have
// consistent texture coordinates.
// We will "flip" it in place on last pass.
if (gl->render_to_tex)
glVertexPointer(2, GL_FLOAT, 0, vertexes);
}
开发者ID:magicseb,项目名称:RetroArch,代码行数:13,代码来源:gl.c
注:本文中的set_viewport函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论