VirtualBox

source: vbox/trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_getteximage.c@ 18255

Last change on this file since 18255 was 15532, checked in by vboxsync, 16 years ago

crOpenGL: export to OSE

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.1 KB
Line 
1/* Copyright (c) 2001, Stanford University
2 * All rights reserved
3 *
4 * See the file LICENSE.txt for information on redistributing this software.
5 */
6
7#include "chromium.h"
8#include "cr_error.h"
9#include "cr_mem.h"
10#include "cr_pixeldata.h"
11#include "server_dispatch.h"
12#include "server.h"
13
14void SERVER_DISPATCH_APIENTRY
15crServerDispatchGetTexImage(GLenum target, GLint level, GLenum format,
16 GLenum type, GLvoid * pixels)
17{
18 GLsizei width, height, depth, size;
19 GLvoid *buffer = NULL;
20
21 cr_server.head_spu->dispatch_table.GetTexLevelParameteriv(target, level, GL_TEXTURE_WIDTH, &width);
22 cr_server.head_spu->dispatch_table.GetTexLevelParameteriv(target, level, GL_TEXTURE_HEIGHT, &height);
23 cr_server.head_spu->dispatch_table.GetTexLevelParameteriv(target, level, GL_TEXTURE_DEPTH, &depth);
24
25 size = crTextureSize(format, type, width, height, depth);
26
27 if (size && (buffer = crAlloc(size))) {
28 /* Note, the other pixel PACK parameters (default values) should
29 * be OK at this point.
30 */
31 cr_server.head_spu->dispatch_table.PixelStorei(GL_PACK_ALIGNMENT, 1);
32 cr_server.head_spu->dispatch_table.GetTexImage(target, level, format,
33 type, buffer);
34 crServerReturnValue( buffer, size );
35 crFree(buffer);
36 }
37 else {
38 /* need to return _something_ to avoid blowing up */
39 GLuint dummy = 0;
40 crServerReturnValue( (GLvoid *) &dummy, sizeof(dummy) );
41 }
42}
43
44
45#if CR_ARB_texture_compression
46
47void SERVER_DISPATCH_APIENTRY
48crServerDispatchGetCompressedTexImageARB(GLenum target, GLint level,
49 GLvoid *img)
50{
51 GLint size;
52 GLvoid *buffer=NULL;
53
54 cr_server.head_spu->dispatch_table.GetTexLevelParameteriv(target, level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &size);
55
56 if (size && (buffer = crAlloc(size))) {
57 /* XXX the pixel PACK parameter should be OK at this point */
58 cr_server.head_spu->dispatch_table.GetCompressedTexImageARB(target, level,
59 buffer);
60 crServerReturnValue( buffer, size );
61 crFree(buffer);
62 }
63 else {
64 /* need to return _something_ to avoid blowing up */
65 GLuint dummy = 0;
66 crServerReturnValue( (GLvoid *) &dummy, sizeof(dummy) );
67 }
68}
69
70#endif /* CR_ARB_texture_compression */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette